1 Reply Latest reply on Mar 6, 2002 8:55 PM by gjanga

    NamingException

    georgep

      Hi,
      I'm running Tomcat separately from JBoss and am trying to access the Interest example Session Bean from a servlet client. Accessing it from the InterestClient example works fine, but I get the following error in the stack trace from a servlet exception:
      "javax.naming.NamingException: Cannot create resource instance"

      From the debug code I can verify that a JNDI context object is successfully generated. But the lookup method fails to generate a reference to the Interest bean, as listed:
      Object ref = jndiContext.lookup("java:comp/env/ejb/Interest");

      I have declared in the Tomcat deployment descriptor for my webapp the corresponding EJB references, as follows in web.xml:
      <ejb-ref>
      EJB reference to Interest Session Bean
      <ejb-ref-name>ejb/Interest</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      org.jboss.docs.interest.InterestHome
      org.jboss.docs.interest.Interest
      </ejb-ref>

      I would greatly appreciate any suggestions on solving this one.
      Thanks,

      George

      P.S. Sorry if this problem has already been covered somewhere!

        • 1. Re: NamingException
          gjanga

          Hi george,

          I've been trying out this combo of Tomcat 4.0
          (running separately) with JBoss as well
          and have found a couple of a things to check
          to ensure no JNDI related problems when
          accessing EJBs from servlets -

          a) the servlet webapp has the
          jndi.jar,jnp-client.jar,jboss-j2ee.jar
          and jboss-client.jar in the WEB-INF/lib directory

          b) Tomcat is started with the -nonaming option.
          You can edit the startup.bat/startup.sh
          in the bin directory of the installation
          eg:
          call "%EXECUTABLE%" start -nonaming %CMD_LINE_ARGS%

          let me know if this works for you.

          Gokul.