Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Looking up an EJB  RSS feed

Sam Suresh
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am new to j2ee..
i hav one existing enterprise application.
when it is build using ant script it creates an EAR file and gets deployed on the jboss server.
i am writing a standalone java program inside the application only, in eclipse to access one EJB of my deployed application. I hav one framework running for my application.
The interface class of the EJB extends the services of the framework.
i wrote the following code to lookup the ejb say named - xyzEJB, which has a interface class xyz.

xyzEJB myBean;

Properties props = new Properties();
props.put(Context.URL_PKG_PREFIXES,"org.jboss.naming rg.jnp.interfaces");

InitialContext ctx = new InitialContext(props);

//InitialContext ctx = new InitialContext();

Object object = ctx.lookup("xyzEJB");

myBean = (xyzEJB) PortableRemoteObject.narrow( object, xyzEJB.class);
catch (NamingException e){

when i am running this java file i am getting the following error - xyzEJB not bound.

Please let me know if any one can guess wat i m doing wrong....or how can i remove this is error, and access the EJB

Jeanne Boyarsky
author & internet detective
Posts: 36406
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

Is "xyzEJB" the name of your EJB in the JNDI? (You can check your deployment descriptors to check this.) Usually names look like "ejb/xyzEJB".
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!