Hi Scott,
The error message was
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.titan.clients.Client.main(Client.java:79)
Your comment brought me to a good point. I checked the ant file again and found the directory was added explicitly:
<pathelement location="${basedir}/client-config"/>
So I went to the run configuration, selected the tab "Classpath", selected User Entries, pressed "Advanced" and added the path to that dir called "client-config". And now, the initial configuration seems to work, and - eventually - it runs, but only once...
(output)
methods in TravelAgentBean:
...
remove
createCabin
findCabin
...
Master Suite
1
1
3
I have seen the note in Chapter 24 of Enterprise JavaBeans 3.0, 5th Edition by Richard Monson-Haefel:
You cannot run this program more than once
unless you stop JBoss, clean the database by invoking the Ant task clean.db, and restart
the application server. Otherwise, you will get the following error:
run.client:
[java] Exception in thread "main" java.lang.RuntimeException:
org.jboss.tm.JBossRollbackException: Unable to commit
, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1099/7,
BranchQual=null:1099, localId=0:7], status=STATUS_NO_TR
ANSACTION; - nested throwable: (org.hibernate.exception.GenericJDBCException:
If I understood it correctly, you cannot execute twice, because the entries in the db are already there and do not allow a new creation.
But the error message I get is quite different. In fact it has the same error pattern as described in my other post
https://coderanch.com/t/320810/EJB-JEE/java/invoke-method-existing-bean-JEE and I still don't know, why the bean could be found in one run, but not in the next run.
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at $Proxy0.createCabin(Unknown Source)
at com.titan.clients.Client.main(Client.java:96)
Caused by: java.lang.ClassNotFoundException: [Ljava.lang.StackTraceElement;
Thanks a lot for help
Markus