Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / January 2005

Tip: Looking for answers? Try searching our database.

ejb not bound

Thread view: 
Simon - 10 Jan 2005 10:41 GMT
Hi there,

When doing a context lookup, I get the following message:

javax.naming.NameNotFoundException: NewComplaintEJB not bound

Now, the EJB seems to deploy correctly, that is there are no errors
listed in the jboss server.log file. I have added a bit of code to my
servlet, which shows that my ejb name is not bound in JNDI. I think my
jboss.xml and ejb-jar.xml files are correct. I have included them here
along with a snippet of the servlet code:

************* EJB-JAR.XML *******************
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN" "ejb-jar_2_0.dtd">

<ejb-jar>
 <enterprise-beans>
   <session>
     <description>Complaint Display and config controls</description>
     <ejb-name>NewComplaintEJB</ejb-name>
     <ejb-class>regency.NewComplaintEJB.ComplaintBean</ejb-class>
     <home>regency.NewComplaintEJB.ComplaintHome</home>
     <remote>regency.NewComplaintEJB.Complaint</remote>
     <session-type>Stateless</session-type>
     <transaction-type>Container</transaction-type>
     <resource-ref>
        <res-ref-name>java:/RegencyDataSource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
     </resource-ref>
   </session>
 </enterprise-beans>
</ejb-jar>

*************JBOSS.XML***************************
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">

<jboss>

  <enterprise-beans>
     <session>
        <ejb-name>NewComplaintEJB</ejb-name>
        <local-jndi-name>local.NewComplaintEJB</local-jndi-name>
        <resource-ref>
          <res-ref-name>java:/RegencyDataSource</res-ref-name>
          <jndi-name>java:/RegencyDataSource</jndi-name>
        </resource-ref>
     </session>
  </enterprise-beans>

  <resource-managers>
  </resource-managers>

</jboss>

****** SERVLET **********************

     Context ctx = new InitialContext(props);
      Object obj = ctx.lookup("NewComplaintEJB" );
      ComplaintHome home =
(ComplaintHome)javax.rmi.PortableRemoteObject.narrow(obj,
ComplaintHome.class );
      complaintEJB = (Complaint)home.create();

I get the not bound message in the tomcat logs when it hits the
ctx.lookup line. Any help would be greatly appreciated.

Simon
praveen - 10 Jan 2005 15:25 GMT
If you have your EJB on a different server, make sure you have the
entire JAR file containing all the EJB components in the class path of
the servlet. Regardless try putting the whole EJB in the classpath.
Used to be a problem that client was not able to download the stubs and
you would get naming exception if you have only client jar for EJB on
the clientside.
praveen - 10 Jan 2005 15:25 GMT
If you have your EJB on a different server, make sure you have the
entire JAR file containing all the EJB components in the class path of
the servlet. Regardless try putting the whole EJB in the classpath.
Used to be a problem that client was not able to download the stubs and
you would get naming exception if you have only client jar for EJB on
the clientside.
Frank Langelage - 10 Jan 2005 20:55 GMT
> *************JBOSS.XML***************************
> <?xml version="1.0" encoding="UTF-8"?>
[quoted text clipped - 23 lines]
> ComplaintHome.class );
>        complaintEJB = (Complaint)home.create();

Goto http://<JBoss Server IP>:8080/jmx-console -> jndi-view -> list and
look for your bean in the global jndi namespace.

You did not put a jndi-name into jboss.xml, only a local-jndi-name.
Don't know if there is a default value for jndi-name (ejb-name?).

At least the local-jndi-name should appear in the jndi-view.
You may use that, if servlet and session bean are in the same app
(ear-file). the narrow call is not needed then.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.