• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB-JBOSS - Problem in accessing JNDI  RSS feed

 
arnav prateek
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To access ejb from servlet follwoing code snippet has been written:
-----------Start--------------
InitialContext init = new InitialContext();
Object objref = init.lookup("CDSAdminJNDI");
CDSAdminHome cdsAdminHome = (CDSAdminHome)PortableRemoteObject.narrow(objref,CDSAdminHome.class);
CDSAdmin cdsAdmin = cdsAdminBean.create();
cdsAdmin.saveCDSAdminRecords(hmAdminParameters);
----------End-----------------

jboss xml file is as follows:
------Start -----------------
<?xml version="1.0" encoding="UTF-8"?>
<jboss>
<enterprise-beans>
<session>
<ejb-name>CDSAdmin</ejb-name>
<jndi-name>CDSAdminJNDI</jndi-name>
</session>
</enterprise-beans>
</jboss>
-------End------------

While accessing this Bean..I get following exception on jboss console:

Exception While accessing EJB: javax.naming.NameNotFoundException: CDSAdminJNDI not bound

Can Any body help where is problem?

Thanks in advance
 
Andreas Schaefer
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This means that the EJB is not bound by this name. To investigate that problem you should first check if the EJB was deployed successfully (consult the log file).
Then open the JMX Console (default: 'localhost:8080/jmx-console'), search for the 'JNDI Viewer', click on that, the click on the button for the method 'list', scroll down to the 'global' namespace and search for your EJB. If you cannot find your Remote Home interface listed somewhere then your deployment must have failed.

-Andy
 
arnav prateek
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks..It works
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!