8 Replies Latest reply on Aug 12, 2002 1:14 PM by Adrian Brock

    javax.naming.NameNotFoundException: UDetails not bound

    declan boylan Newbie

      I'm using JBoss3/Tomcat on a linux box and i am having some problems calling an EJB. This is actually working fine with jboss 2.4 on windows machine, but really need it working with jboss3

      ==================== jboss.xml ========================

      <enterprise-beans>

      <ejb-name>UDetails</ejb-name>

      </enterprise-beans>


      ========================================================
      =================== ejb-jar.xml ========================

      <ejb-jar>

      <enterprise-beans>


      <ejb-name>UDetails</ejb-name>
      com.venutec.vvenue.User.UserDetailsHome
      com.venutec.vvenue.User.UserDetailsObject
      <ejb-class>com.venutec.vvenue.User.UserDetailsEJB</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>


      </enterprise-beans>


      <assembly-descriptor>
      <container-transaction>

      <ejb-name>UDetails</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Supports</trans-attribute>
      </container-transaction>

      <security-role>
      Users
      <role-name>users</role-name>
      </security-role>
      </assembly-descriptor>

      ========================================================
      =================== file.jsp ===========================

      within the JSP file it's called as follows...

      Properties props = new Properties();
      props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      props.put(Context.PROVIDER_URL, "136.206.17.39:1099");

      //User details bean
      Context ctx = new InitialContext(props);
      UserDetailsHome home = (UserDetailsHome)ctx.lookup("UDetails");
      UserDetailsObject bean = home.create();

      =======================================================

      in the jboss.xml i've tried putting in <jndi-name>UDetails</jndi-name> but it still throws up the same error. I've included the full error in a file.

      Any ideas?

        • 1. Re: javax.naming.NameNotFoundException: UDetails not bound
          declan boylan Newbie

          sorry, here is the error file..

          • 2. Re: javax.naming.NameNotFoundException: UDetails not bound
            Adrian Brock Master

            Do you have any errors during deployment?
            Look in ${jboss.dist}/server/default/log/server.log

            If you are using embedded Tomcat, use
            new InitialContext()
            without the properties.
            This will avoid the nasty rmi calls.

            Regards,
            Adrian

            • 3. Re: javax.naming.NameNotFoundException: UDetails not bound
              declan boylan Newbie

              >Do you have any errors during deployment?
              >Look in ${jboss.dist}/server/default/log/server.log

              nope, nothing standing out wrong there

              >If you are using embedded Tomcat, use
              >new InitialContext()
              >without the properties.
              >This will avoid the nasty rmi calls.

              as in:

              //User details bean
              Context ctx = new InitialContext();
              ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
              ctx.addToEnvironment(Context.PROVIDER_URL, "136.206.17.39:1099");
              UserDetailsHome home = (UserDetailsHome)ctx.lookup("UDetails");

              or:
              Context ctx = new InitialContext();
              ctx.lookup("UDetails");

              • 4. Re: javax.naming.NameNotFoundException: UDetails not bound
                Adrian Brock Master

                The last one

                Context ctx = new InitialContext();
                ctx.lookup("UDetails");

                Can you invoke the "list" operation for
                jboss:service=JNDIView on
                http://136.206.17.39:8082
                or
                http://136.206.17.39:8080/jmx-console

                Is your bean listed in the global namespace?

                Regards,
                Adrian

                • 5. Re: javax.naming.NameNotFoundException: UDetails not bound
                  declan boylan Newbie


                  >Can you invoke the "list" operation for
                  >jboss:service=JNDIView on
                  >http://136.206.17.39:8082

                  Yes...

                  > Is your bean listed in the global namespace?

                  Nope..

                  java: Namespace
                  +- DefaultDS (class: org.jboss.resource.adapter.jdbc.local.LocalDataSource)
                  +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
                  +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
                  +- DefaultJMSProvider (class: org.jboss.jms.jndi.JBossMQProvider)
                  +- CounterService (class: org.jboss.varia.counter.CounterService)
                  +- comp (class: javax.naming.Context)
                  +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
                  +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
                  +- jaas (class: javax.naming.Context)
                  | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
                  | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
                  +- timedCacheFactory (class: javax.naming.Context)
                  Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy
                  +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
                  +- Mail (class: javax.mail.Session)
                  +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
                  +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
                  +- TransactionManager (class: org.jboss.tm.TxManager)

                  Global JNDI Namespace
                  +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
                  +- UserTransactionSessionFactory (class: org.jboss.tm.usertx.server.UserTransactionSessionFactoryImpl)
                  +- RMIXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
                  +- topic (class: org.jnp.interfaces.NamingContext)
                  | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
                  | +- testTopic (class: org.jboss.mq.SpyTopic)
                  | +- securedTopic (class: org.jboss.mq.SpyTopic)
                  +- queue (class: org.jnp.interfaces.NamingContext)
                  | +- A (class: org.jboss.mq.SpyQueue)
                  | +- testQueue (class: org.jboss.mq.SpyQueue)
                  | +- ex (class: org.jboss.mq.SpyQueue)
                  | +- DLQ (class: org.jboss.mq.SpyQueue)
                  | +- D (class: org.jboss.mq.SpyQueue)
                  | +- C (class: org.jboss.mq.SpyQueue)
                  | +- B (class: org.jboss.mq.SpyQueue)
                  +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
                  +- RMIConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
                  +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
                  +- ejb (class: org.jnp.interfaces.NamingContext)
                  | +- mgmt (class: org.jnp.interfaces.NamingContext)
                  | | +- MEJB (proxy: $Proxy13 implements interface javax.management.j2ee.ManagementHome,interface javax.ejb.Handle)
                  | +- jmx (class: org.jnp.interfaces.NamingContext)
                  | | +- ejb (class: org.jnp.interfaces.NamingContext)
                  | | | +- Adaptor (proxy: $Proxy17 implements interface org.jboss.jmx.adaptor.interfaces.AdaptorHome,interface javax.ejb.Handle)
                  +- invokers (class: org.jnp.interfaces.NamingContext)
                  | +- Apathy (class: org.jnp.interfaces.NamingContext)
                  | | +- jrmp (class: org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy)
                  +- jmx:Apathy:rmi (class: org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl)
                  +- UILXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
                  +- UILConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)

                  Ok, me thinks i'm doing something really wrong here.

                  in my deploy folder i have a vv.war directory which contans all my jsp's, ejb folder (com.venutec.vvenue yada yada) META-INF and WEB-INF.

                  I've created a jar file of the ejb folder and the META-INF, am i suppose to stick this out in the deploy folder or will it automagically be deployed withing the vv.war folder?

                  • 6. Re: javax.naming.NameNotFoundException: UDetails not bound
                    Adrian Brock Master

                    wars do not support nested deployments.

                    You have to put the ejb jar directly in the deploy
                    folder.

                    You might want to create an ear.

                    Regards,
                    Adrian

                    • 7. Re: javax.naming.NameNotFoundException: UDetails not bound
                      declan boylan Newbie

                      Emm thats seems to have solved that problem,

                      now for the really silly question, how do i go about creating an EAR file for Jboss.. (how-to-steps would be nice)

                      Regards
                      Declan

                      • 8. Re: javax.naming.NameNotFoundException: UDetails not bound
                        Adrian Brock Master

                        Put your war and jar in a folder called something like
                        myapp.ear
                        create a folder inside the ear called
                        META-INF
                        inside META-INF add an
                        application.xml
                        file with something like

                        <?xml version="1.0" encoding="ISO-8859-1"?>


                        <display-name>whatver you like</display-name>


                        myejb.jar



                        myweb.war




                        The war and ejb can now be re-deployed together
                        by touching application.xml. This is important
                        if you change the ejb classes.

                        Regards,
                        Adrian