2 Replies Latest reply on Oct 6, 2006 9:21 AM by gagote

    Deploy Problem: JBoss, EJB3, NetBeans and the web.xml file s

    wls

      Admittedly, I'm a beginner here, so go gentle on me.

      I'm using the NetBeans 5.5 beta 2 with the JBoss 4.0.4 GA installer, which supposedly includes EJB3 stuff, from http://www.netbeans.org/products/ide/ and so far things had been working perfectly.

      That was until I did right clicked "Enterprise Resources > Call Enterprise Bean" from the pop up window in an servlet of an Enterprise Application and referenced a working bean.

      Now my question isn't one of using the NetBeans environment, but rather that after it generated the code, which did compile perfectly, I started getting errors that my bean could not be deployed to JBoss due to an error in the web.xml file.

      Looking in the web.xml file, which I assume is some kind of deployment file (hey, I said I was new to J2EE), there is a new element in the xml called <ejb-local-ref>. And it's on this xml section that JBoss seems to be choking.

      Inside http://www.netbeans.org/kb/55/ejb30-jboss.html, it suggests that JBoss automatically adds session beans to the JNDI namesspace, and thus one should remove the ejb-local-ref from the web.xml file by going to the WEB-INF folder inside the Web Pages node.

      Doing so didn't help, and instead created a new problem with the bean not being bound to a name.

      From what I can tell from various Google searches and reading different documents, it seems that not only is NetBeans is generating Java EE 5 code, but deployment notation as well. And, while JBoss is using EJB3, it does not recognize the newer xml syntax.

      My problem is fairly obvious, and I'm drowning in a sea of documentation that's in one world or the other, but not bridging the gap between them.

      NetBeans is producing this:

      javax.naming.Context c = new javax.naming.InitialContext();
      return (MyBeanLocal) c.lookup("java:comp/env/ejb/MyBean");


      Which exceptions with a
      javax.naming.NameNotFoundException: ejb not bound


      My guess is that I need something inside the web.xml file to do that binding, but I'm just not sure what. I'm also pondering in that there seems to be a jboss.xml file that I could create, but I don't know if this is on the right track or not, either.

      Would someone mind pointing me in the right direction?

      Many thanks,
      -Walt Stoneburner, wls@wwco.com

        • 1. Re: Deploy Problem: JBoss, EJB3, NetBeans and the web.xml fi
          wls

          Made some progress, independently.

          After using the NetBeans code generation:
          1) Removed the ejb-local-red from the web.xml file
          2) Changed "java:comp/env/ejb/MyBean" to "MyBaseEARFilename/MyBean/local"

          Seems the JNDI name auto generated isn't correct.

          Anyone else having the similar problems with NetBeans, JBoss, and EJB, or did I do something wrong?

          -wls

          • 2. Re: Deploy Problem: JBoss, EJB3, NetBeans and the web.xml fi
            gagote

            Hi,

            I have the same problem while I'm trying to get started with a tutorial. I followed the steps from your second post but, the error dissapear but at the runtime I get the following error:

            java.lang.RuntimeException: javax.naming.NameNotFoundException: HelloBean not bound

            Any solutions?

            Thanks.