2 Replies Latest reply on Aug 10, 2002 10:27 AM by morgan

    Problem with JNDI lookup

    morgan

      I'm new to JBoss (using 3.0.0) and am having a bit of a problem setting up a webapp.

      JBoss starts up fine and deploys my application, but when I attempt to lookup the home object of my test ejb, a "javax.naming.NameNotFoundException" is thrown by "org.jnp.server.NamingServer.getBinding".

      In searching the forums for clues, I came across talk of JNDIView ... using that, and looking under "Global JNDI Namespace", I find no mention of my ejb (which I take it, is bad).

      My application (including the ejb code) is packaged together in a "war" file. In "./web-inf" is "web.xml", and in "./meta-inf" are the files, "jboss.xml" and "ejb-jar.xml" (I've listed these two at the end of this message). I've also done nothing with "jndi.properties".

      I've looked around for a quite a while now and don't have a clue as to what to try next, if anyone has such a clue, I'd be most grateful to hear it.

      Thanks,
      :Paul

      jboss.xml:


      <enterprise-beans>

      <ejb-name>Generate-EJB</ejb-name>
      <jndi-name>com.mv.ejb.GenerateHome</jndi-name>

      </enterprise-beans>


      ejb-jar.xml:

      <ejb-jar>
      <enterprise-beans>

      <ejb-name>Generate-EJB</ejb-name>
      com.mv.ejb.GenerateHome
      com.mv.ejb.Generate
      <ejb-class>com.mv.ejb.GenerateBean</ejb-class>

      <session-type>stateless</session-type>
      <transaction-type>container</transaction-type>

      </enterprise-beans>
      </ejb-jar>

        • 1. Re: Problem with JNDI lookup
          jwkaltz

          > My application (including the ejb code) is packaged
          > together in a "war" file. In "./web-inf" is
          > "web.xml", and in "./meta-inf" are the files,
          > "jboss.xml" and "ejb-jar.xml" (I've listed these two
          > at the end of this message). I've also done nothing
          > with "jndi.properties".

          My understanding (but I'm not 100% sure on this), is that if you package servlet/jsps together with ejbs, then you have to package the whole thing as an .ear, not a .war. A war archive would contain only the frontend stuff, not the ejb's.

          (Like I said, not 100% sure, but it's worth trying it out with an .ear (Enterprise Archive) package)

          • 2. Re: Problem with JNDI lookup
            morgan

            Thanks Frank, you nailed it. That's the problem when you try to learn too many new things at once (e.g., J2EE and JBoss) you're never sure exactly which piece of knowledge you're missing or where the clue to the solution lies.

            So I refactored the jar/war files, put everything into an ear file, added the appropriate deployment descriptors, and now it seems to be working.

            Once again, thanks!

            :Paul