|
I've been trying to run Sun's J2EE
tutorial simple Converter example within jboss with no success. I am also
having a problem with the jboss example InterestClient. Digging into the problem
I have found that following the web documentation and running ant with the
build.xml file works fine. However, I found that the build.xml creates a
classpath which includes the location of the classes for the InterestBean and
InterestHome residing on disk as shown in bold below.
Excerpt from on-line example doc http://www.jboss.org/online-manual/HTML/ch01s15.html :
interest-client:
[echo] Using client classpath: /tmp/JBoss-2.2.2/client/ejb.jar:/tmp/JBoss-2.2.2/client/jaas.jar:/tmp/JBoss-2.2.2/client/jbosssx-client.jar:/tmp/JBoss-2.2.2/client/jboss-client.jar:/tmp/JBoss-2.2.2/client/jnp-client.jar:/tmp/tomcat/lib/servlet.jar:/tmp/examples/build-examples/interest/classes:/tmp/examples/resources This shows that the classpath used to execute the client included a number
of jars located in the JBoss client directory as well as the directory
containing the compiled example classes and the directory containing
the jndi.properties file.
This implies that I cannot write an application
that accesses jboss deployed beans without having the classes for the beans
reside on disk in my classpath.
I removed InterestClient from the same package
as the EJB. If I rename the org ( to org- ) in this location (examples/build-examples/interest/classes)then the example
does not run ( cannot find InterestHome ). I thought the idea
was to retrieve the classes from jboss instead of from disk. I know I have
succesfully deployed the EJB as interest/Interest from the jboss/log file shown
below. Can somebody enlighten me as I have pounded on this for 2 days and am
getting nowhere. Why are the classes being included in the build.xml for
execution of the client? The jndi.properties file resides under the resources
dir indicated at the tail end of the classpath above.
ampere jec zen 151> ls
/home/marconi/users/jec/java/jboss-examples/examples/build-examples/interest/classes
InterestClient.class org- ampere jec zen 152> jbossRunClient
InterestClient
/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jboss-j2ee.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jaas.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jbosssx-client.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jboss-client.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jnp-client.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/catalina/common/lib/servlet.jar:/home/marconi/users/jec/java/jboss-examples/examples/resources:/home/marconi/users/jec/java/jboss-examples/examples/build-examples/interest/classes:. Got context javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: org.jboss.docs.interest.InterestHome] ampere jec zen 153> cd
/home/marconi/users/jec/java/jboss-examples/examples/build-examples/interest/classes
ampere jec zen 154> mv org- org ampere jec zen 155> cd ~/java/jboss-examples/examples/org/jboss/docs/interest ampere jec zen 156> jbossRunClient InterestClient /home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jboss-j2ee.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jaas.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jbosssx-client.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jboss-client.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jnp-client.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/catalina/common/lib/servlet.jar:/home/marconi/users/jec/java/jboss-examples/examples/resources:/home/marconi/users/jec/java/jboss-examples/examples/build-examples/interest/classes:. Got context Got reference Interest on 1000 units, at 10% per period, compounded over 2 periods is: 210.00000000000023 ampere jec zen 157> [13:52:02,440,StatelessSessionContainer] Begin
java:comp/env for EJB: Interest
[13:52:02,441,StatelessSessionContainer] TCL: java.net.URLClassLoader@34f7c5 [13:52:02,458,StatelessSessionContainer] End java:comp/env for EJB: Interest [13:52:02,458,StatelessSessionContainer] Mapped Container method remove HASH -1842617161 [13:52:02,459,StatelessSessionContainer] Mapped Container method getEJBHome HASH -993218923 [13:52:02,460,StatelessSessionContainer] Mapped Container method getHandle HASH 1182305581 [13:52:02,460,StatelessSessionContainer] Mapped Container method getPrimaryKey HASH -131865408 [13:52:02,461,StatelessSessionContainer] Mapped Container method isIdentical HASH 285457048 [13:52:02,462,StatelessSessionContainer] Mapped calculateCompoundInterest 130738471to public double org.jboss.docs.interest.InterestBean.calculateCompoundInterest(double,double,double) [13:52:02,463,StatelessSessionContainer] Mapping remove [13:52:02,463,StatelessSessionContainer] Mapping remove [13:52:02,464,StatelessSessionContainer] Mapping getEJBMetaData [13:52:02,464,StatelessSessionContainer] Mapping getHomeHandle [13:52:02,465,StatelessSessionContainer] Mapping create [13:52:02,534,JRMPContainerInvoker] JRMP 1.3 CI initialized [13:52:02,593,JRMPContainerInvoker] Bound Interest to interest/Interest [10:03:45,939,Default] Someone called
`calculateCompoundInterest!'
marconi jec zen 109> cat ~/bin/jbossRunClient
#!/bin/csh set CP="/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jboss-j2ee.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jaas.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jbosssx-client.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jboss-client.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/jboss/client/jnp-client.jar:/home/marconi/users/jec/java/JBoss/JBoss-2.4.4_Tomcat-4.0.1/catalina/common/lib/servlet.jar:/home/marconi/users/jec/java/jboss-examples/examples/resources:/home/marconi/users/jec/java/jboss-examples/examples/build-examples/interest/classes:." echo $CP java -cp $CP $1 |
