how to run a application client in jboss?

Hi guys, i have create a jar file for the ejb and a stand alone java application to communicate with the ejb.

Pardon me for asking such a stupid question. I know how to package and run a web EJB eg:the webpages are package in war, EJB in jar and both together in a ear file. however dealling with the standalone java application to communicate with the ejb, i have no idea how to package or put into the application server.

I have the java application: customerTest.jar and the EJB: ejb-jar-customer.jar.

What i want to know is how to i run on the application server with these two files?
Should i place both in the jboss or package them into a ear file.
By the way, i using Jboss4.0.3 version

Please advise.
Thanks

Message was edited by:
Shirley

5 comments
Comment actions Permalink

Shirley,

Just deploy the EJB jar into JBoss and then launch your client
application like any other standalone application. There's no benefit
from telling JBoss about your client application.

- Martin

Shirley wrote:

Hi guys, i have create a jar file for the ejb and a stand alone java application to communicate with the ejb.

Pardon me for asking such a stupid question. I know how to package and run a web EJB eg:the webpages are package in war, EJB in jar and both together in a ear file. however dealling with the standalone java application to communicate with the ejb, i have no idea how to package or put into the application server.

I have the java application: customerTest.jar and the EJB: ejb-jar-customer.jar.

What i want to know is how to i run on the application server with these two files?
Should i place both in the jboss or package them into a ear file.

Please advise.
Thanks


--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com

0
Comment actions Permalink

Forgot to mention:
You need a file jndi.properties in your client jar (along with all necessary libraries and classes from the EJB jar) with this content:

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=jnp://localhost:1099
java.naming.factory.url.pkgs=org.jboss.naming.client
j2ee.clientName=

The part 'localhost:1099' has to be replaced by your settings of course.

0
Comment actions Permalink

Hi Martin,

So that means i just have to place the ejb jar without the client jar into the jboss and thats it?

Secondly, for the client jar, how do i run it if i package the client application into a jar file? And where do i put the client jar? Anywhere location in the machine or must be inside jboss?

And inside the client jar, i write an deployment descriptor file to connect to the ejb. do i still need a jndi.properties file? If yes, where to i place the .properties file.
Is it along with the class file or inside the META-INF?

Sorry for asking so many questions. I'm quite new to EJB. So please pardon me..
Thanks

0
Comment actions Permalink

So that means i just have to place the ejb jar
without the client jar into the jboss and thats it?


Yes, that's all for the server side.

Secondly, for the client jar, how do i run it if i
package the client application into a jar file? And
where do i put the client jar? Anywhere location in
the machine or must be inside jboss?


You can run it from wherever you want, even from a machine which hasn't JBoss installed at all. You just need the client.jar, a jar containing the home and bean interfaces of the EJBs your referencing, and the file jbossall-client.jar. Then run it with

java -classpath .../jboss-all.jar;.../your-ejb.jar -jar your-client.jar

And inside the client jar, i write an deployment
descriptor file to connect to the ejb. do i still
need a jndi.properties file? If yes, where to i place
the .properties file.


The jndi.properties is required to connect initially to the JBoss server. On the other hand you don't need a deployment descriptor - there's nobody looking at it. (You could use a jboss-client.xml to tamper with JNDI names, but that's another story.)

Is it along with the class file or inside the
META-INF?


The jndi.properties file has to be in the root directory of the client jar file.

Sorry for asking so many questions. I'm quite new to
EJB. So please pardon me..
Thanks


You're welcome :)

0
Comment actions Permalink

Hi Martin, thanks for your great help.

Without your answers, i dun think i'm able to solve the problem especially the help i get from the jndi properties which u have posted.

Thanks alot..

0

Please sign in to leave a comment.