8 Replies Latest reply on Dec 28, 2006 12:07 AM by palam

    Embedded EJB3.0 and Tomcat JDNI error

    thillerson

      I'm deploying a fairly simple web app with embedded ejb3 (RC9) to Tomcat 5.5.20. I get These errors:

      ERROR 06-10 15:53:41,437 (AbstractController.java:incrementState:440) -Error installing to Start: name=UserTransaction state=Create
      ...
      Caused by: javax.naming.NameNotFoundException: Name TransactionManager is not bound in this Context

      The relevent lines from web.xml:

      <context-param>
      <param-name>jboss-kernel-deployments</param-name>
      <param-value>embedded-jboss-beans.xml, jboss-jms-beans.xml</param-value>
      </context-param>


      <listener-class>org.jboss.ejb3.embedded.ServletBootstrapListener</listener-class>


      Just like the examples say. Any ideas what I'm doing wrong?

        • 1. Re: Embedded EJB3.0 and Tomcat JDNI error
          thillerson

          I noticed a release note for RC9
          [EJBTHREE-654] - remove hard coding of TransactionManager

          I've also noticed that when running an embedded ejb3 app in Tomcat the jndi.properties file is not enough to make an initial context pick up the correct properties, and I need to do this to find anything that embedded ejb3 deployed:

          Hashtable<String, String> props = new Hashtable<String, String>();
          props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
          props.put("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory");
          InitialContext ic = new InitialContext(props);


          Perhaps there's an issue deep in there when looking up the transaction manager? I'm unsure of how to log this to JIRA... Is this an issue that should be logged to JIRA or am I doing something wrong configuring the JNDI for Tomcat?



          • 2. Re: Embedded EJB3.0 and Tomcat JDNI error
            allonrauer

            i'm having the same issue: the new InitialContext() sometimes picks up the apache tomcat properties instead of the jboss ones...

            what is the correct way to configure tomcat to use the jndi implementation supplied w/ jboss ejb3?

            • 3. Re: Embedded EJB3.0 and Tomcat JDNI error
              thillerson

              Just to be clear, the error I'm getting is caused when embedded jboss starts up and tries to find the TransactionManager. This isn't a call I'm making myself.

              Allon, any of my own calls I have to pass in the jboss jndi properties explicitly.

              • 4. Re: Embedded EJB3.0 and Tomcat JDNI error
                keenan

                Has anyone found a solution to this? I'm having the same problem the original poster reports, directly with the embedded-war example from the tutorial. I'm using Embeddable_ALPHA_9 and Tomcat 5.5.17 on a Windows XP machine.

                I agree with the other posters that it is a JNDI properties problem, not in user code but in how the UserTransaction code finds the UserTransactionManager. So where should the jndi.properties file go?
                --keenan

                • 5. Re: Embedded EJB3.0 and Tomcat JNDI error (was JDNI)
                  keenan

                  The problem is not limited to Tomcat, it appears with Jetty also. I took the same standalone.war from the embedded-war example, as distributed with Embeddable_ALPHA_9, and deployed it in a fresh Jetty installation, and still get the JNDI error trying to find the TransactionManager during bootstraping of the UserTransaction.

                  Since it happens with Jetty, I doubt it is the Tomcat read-only JNDI service properties causing the problem. (I was sure not to use a Jetty configuration that included JNDI.) Maybe the TransactionManager is getting bound somewhere unexpected?

                  The problem occurs with the unmodified embedded-war example from Alpha9, and happens during the microcontainer's creation of the UserTransaction (as specified in embedded-jboss-beans.xml), long before it gets to any application level code.

                  Has anyone successfully deployed a war containing the embedded EJB 3 container? What's your trick?
                  --keenan

                  • 6. Re: Embedded EJB3.0 and Tomcat JDNI error
                    thillerson

                    Added a JIRA issue. I hope I did it right.

                    • 7. Re: Embedded EJB3.0 and Tomcat JDNI error
                      wonnekeysers

                      Think it is related to this issue:
                      http://jira.jboss.com/jira/browse/EJBTHREE-756

                      • 8. Re: Embedded EJB3.0 and Tomcat JDNI error
                        palam

                        i am still fcing probelm