The moose likes EJB and other Java EE Technologies and the fly likes EJB Basic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB Basic" Watch "EJB Basic" New topic

EJB Basic

Suhas Mohamedali

Joined: Jun 05, 2012
Posts: 29
I have got a Main.Java file which is out side application server (JBOSS)

I have one remote interface and one implementation and entity as server side components.

I tried one example ( in O'reilly's enterprise java beans work book) where the client is also included in the server side jar.

and instantiating the jar using ant command run.client.

My question is can I invoke the EJB method if run the java class from out side the container.

Please help me with some good examples..... PLEASE.....
Myyron Murray Latorilla
Ranch Hand

Joined: Dec 10, 2009
Posts: 65

You can by doing remote lookup on your EJB.

First you need to build the context, you will need specific JBoss libraries to be included in your application, this one you need to refer to their documentation:

Then lookup the remote object:

For EJB2.x

For EJB3.x

Hope this helps.

Aparna Rajan

Joined: Sep 18, 2008
Posts: 5
I think you can refer 'EJB3 in Action' from Manning. It is a good one and covers the basics.

Aparna<br />SCJP 1.4 91%<br />SCWCD 1.4 92%<br/>SCBCD 5 86%
Suhas Mohamedali

Joined: Jun 05, 2012
Posts: 29
Hi myyron and aparna ....

thanks for the reply..... when I tried to start the client class as java application from eclipse...
It gives me javax.naming.NoInitialContextException exception...

I places in root folder and server is running.......

Please suggest.....
Suhas Mohamedali

Joined: Jun 05, 2012
Posts: 29
Hi found the solution....

included jbossall-client.jar in class path....
I agree. Here's the link:
subject: EJB Basic
It's not a secret anymore!