The following worked for me. Comments and corrections are welcome.
I assume that you have previously deployed the Advice application using the Reference Implementation (RI) of
J2EE, and you have obtained a jar file AdviceAppClient.jar for the client application's use. Why? Because we are going to cheat a little to get hold of the ejb-jar.xml file which is the AdviceBean's deployment descriptor. I also assume that you have installed
JBoss. I'm using 3.2.3 on Windows XP. I'm also assuming you have an environment variable JBOSS_HOME correctly set up.
Let's take a look at the directory structure:
Add a
lib directory to this to get:
Into the lib directory copy jboss-j2ee.jar and jbossall-client.jar. These two jars are to be found in %JBOSS_HOME%\client. jboss-j2ee.jar is JBoss's version of j2ee.jar and jbossall-client.jar contains classes required by the client.
Copy the previously generated (by the RI deploytool) AdviceAppClient.jar file into HFEJBCODE\advice\classes and extract the file ejb-jar-ic.jar which contains the Advice bean:
Now extract the Advice Bean's ejb-jar.xml deployment description from ejb-jar-ic.jar:
Delete the two jars to destroy all evidence of cheating:
You should now have the following:
We must now compile all the classes. First the Advice bean's classes:
And the client:
The directory structure should now have the following contents:
We have to show JBoss how to set up JNDI for this bean. To do this create a file called
jboss.xml with the following contents:
Copy this file to the META-INF directory to get:
We are now ready to make a jar file and copy it to the jboss deployment directory:
Provided you have started it with:
you should now see JBoss automatically deploy the Advice bean.
To run the client we need one more file named jndi.properties containing:
Copy this file into the advice directory:
Finally we can run the client:
[ December 14, 2003: Message edited by: Barry Gaunt ]