13 Replies Latest reply on Feb 26, 2009 6:14 PM by Brian unknown

    Name not Bound

    Brian unknown Newbie

      Hi all. I'm getting a "javax.naming.NameNotFoundException: shadows not bound" error when I hit my app in a web browser. Its deployed on JBoss. I have a shadows.ear, which contains Shadows.jar, and Shadows.war.

      I read the following on jndi naming:

      "When the EJBs are deployed in an .ear file, the default jndi binding will be prepended by the name of the .ear file. So if the ear file name is foo.ear the default jndi names would be foo/EJB-NAME/remote and foo/EJB-NAME/local."

      According to that, my jndi name should be shadows/EJB-NAME/local. So why would shadows not be bound?

      I would really appreciate any help with this, as its been driving me crazy for a long time now. Let me know if there's any more info I should provide that would be helpful.

      Thanks
      Brian

        • 1. Re: Name not Bound
          Brian unknown Newbie

          By the way, here is the stack trace:

          exception
          
          net.sourceforge.stripes.exception.StripesServletException: Exception encountered processing request.
           net.sourceforge.stripes.controller.DispatcherServlet.doPost(DispatcherServlet.java:189)
           net.sourceforge.stripes.controller.DispatcherServlet.doGet(DispatcherServlet.java:65)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
           net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:201)
           org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          
          root cause
          
          javax.naming.NameNotFoundException: shadows not bound
           org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
           org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
           org.jnp.server.NamingServer.getObject(NamingServer.java:543)
           org.jnp.server.NamingServer.lookup(NamingServer.java:267)
           org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
           org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
           javax.naming.InitialContext.lookup(InitialContext.java:392)
           com.castofshadows.web.JndiInterceptor.intercept(JndiInterceptor.java:25)
           net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:154)
           net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:111)
           net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:154)
           net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:73)
           net.sourceforge.stripes.controller.DispatcherHelper.resolveActionBean(DispatcherHelper.java:98)
           net.sourceforge.stripes.controller.DispatcherServlet.resolveActionBean(DispatcherServlet.java:206)
           net.sourceforge.stripes.controller.DispatcherServlet.doPost(DispatcherServlet.java:140)
           net.sourceforge.stripes.controller.DispatcherServlet.doGet(DispatcherServlet.java:65)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
           net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:201)
           org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          


          • 2. Re: Name not Bound
            Peter Johnson Master

            The first thing to do is look up the name using the jmx console and make sure it is there and you are using the right name: http://www.jboss.org/community/docs/DOC-9583

            • 3. Re: Name not Bound
              Brian unknown Newbie

              Thanks for the feedback. I looked up the namespaces, and my beans did not appear in them. However, I did see an entry for shadows.ear and Shadows.war. I double checked the ear file, and it definitely contains shadows.jar. So why would its beans not be bound to any namespace?

              Here are some snippets from my jndi tree:

              java:comp namespace of the shadows.ear/Shadows.war application:
              
               +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
               +- ORB (class: org.jacorb.orb.ORB)
               +- env (class: org.jnp.interfaces.NamingContext)
               | +- security (class: org.jnp.interfaces.NamingContext)
               | | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
               | | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)


              java:comp namespace of the Shadows.war application:
              
               +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
               +- ORB (class: org.jacorb.orb.ORB)
               +- env (class: org.jnp.interfaces.NamingContext)
               | +- security (class: org.jnp.interfaces.NamingContext)
               | | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
               | | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)


              java: Namespace
              
               +- jaas (class: javax.naming.Context)
               | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
               | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
               | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
               +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
               +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
               +- JBossCorbaNaming (class: org.omg.CosNaming.NamingContextExt)
               +- DefaultDS (class: javax.sql.DataSource)
               +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
               +- TransactionManager (class: org.jboss.tm.TxManager)
               +- JBossCorbaPOA (class: org.omg.PortableServer.POA)
               +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
               +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
               +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
               +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
               +- JBossCorbaInterfaceRepositoryPOA (class: org.omg.PortableServer.POA)
               +- Mail (class: javax.mail.Session)
               +- JBossCorbaORB (class: org.omg.CORBA.ORB)
               +- timedCacheFactory (class: javax.naming.Context)
              Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy cannot be cast to javax.naming.NamingEnumeration
               +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
               +- comp (class: javax.naming.Context)
              
              
              Global JNDI Namespace
              
               +- HASessionState (class: org.jnp.interfaces.NamingContext)
               | +- Default (class: org.jboss.ha.hasessionstate.server.HASessionStateImpl)
               +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
               +- jmx (class: org.jnp.interfaces.NamingContext)
               | +- invoker (class: org.jnp.interfaces.NamingContext)
               | | +- RMIAdaptor (proxy: $Proxy50 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
               | +- rmi (class: org.jnp.interfaces.NamingContext)
               | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
               +- JAXR (class: org.apache.ws.scout.registry.ConnectionFactoryImpl)
               +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
               +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
               +- UserTransactionSessionFactory (proxy: $Proxy12 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
               +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
               +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
               +- invokers (class: org.jnp.interfaces.NamingContext)
               | +- HQWS263 (class: org.jnp.interfaces.NamingContext)
               | | +- iiop (class: org.jboss.invocation.iiop.IIOPInvoker)
               +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
               +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
               +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
               +- HAPartition (class: org.jnp.interfaces.NamingContext)
               | +- DefaultPartition (class: org.jboss.ha.framework.server.HAPartitionImpl)
               +- 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)
               +- console (class: org.jnp.interfaces.NamingContext)
               | +- PluginManager (proxy: $Proxy51 implements interface org.jboss.console.manager.PluginManagerMBean)
               +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
               +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
               +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
               +- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
               +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)
              


              • 4. Re: Name not Bound
                Peter Johnson Master

                Looks like your EJBs are not being deployed. At minimum they would show up in the java: or global namespace.

                • 5. Re: Name not Bound
                  Brian unknown Newbie

                  I took a look at the jboss server log to see what's going on with the ejb jar. With my limited knowledge of jboss, it looks like its deploying the jar. However, I noticed it didn't mention anything about the beans. Do you have any idea why its finding the jar, but not binding the beans? Here are the lines from the log that have the term "Shadows.jar" in them.

                  2009-02-26 11:14:08,066 DEBUG [org.jboss.deployment.EARDeployer] Extracted deployable content: Shadows.jar
                  2009-02-26 11:14:09,269 DEBUG [org.jboss.deployment.EARDeployer] Deployment Info: org.jboss.deployment.DeploymentInfo@c5ef8fe8 { url=file:/C:/dev/jboss-4.0.5.GA/server/all/tmp/deploy/tmp6695379174028898419shadows.ear-contents/Shadows.jar }
                   deployer: null
                   status: null
                   state: CONSTRUCTED
                   watch: file:/C:/dev/jboss-4.0.5.GA/server/all/tmp/deploy/tmp6695379174028898419shadows.ear-contents/Shadows.jar
                   altDD: null
                   lastDeployed: 0
                   lastModified: 0
                   mbeans:
                  , isDirectory: false
                  2009-02-26 11:14:10,082 DEBUG [org.jboss.deployment.MainDeployer] Starting deployment (init step) of package at: file:/C:/dev/jboss-4.0.5.GA/server/all/tmp/deploy/tmp6695379174028898419shadows.ear-contents/Shadows.jar
                  2009-02-26 11:14:10,082 DEBUG [org.jboss.deployment.JARDeployer] looking for nested deployments in : file:/C:/dev/jboss-4.0.5.GA/server/all/tmp/deploy/tmp6695379174028898419shadows.ear-contents/Shadows.jar
                  2009-02-26 11:14:10,082 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] Added url: file:/C:/dev/jboss-4.0.5.GA/server/all/tmp/deploy/tmp6695379174028898419shadows.ear-contents/Shadows.jar, to ucl: org.jboss.mx.loading.UnifiedClassLoader3@1ff3900{ url=file:/C:/dev/jboss-4.0.5.GA/server/all/tmp/deploy/tmp6695379174028898419shadows.ear ,addedOrder=42}
                  2009-02-26 11:14:10,082 DEBUG [org.jboss.deployment.MainDeployer] found 0 subpackages of file:/C:/dev/jboss-4.0.5.GA/server/all/tmp/deploy/tmp6695379174028898419shadows.ear-contents/Shadows.jar
                  2009-02-26 11:14:11,785 DEBUG [org.jboss.deployment.MainDeployer] create step for deployment file:/C:/dev/jboss-4.0.5.GA/server/all/tmp/deploy/tmp6695379174028898419shadows.ear-contents/Shadows.jar
                  2009-02-26 11:14:11,785 DEBUG [org.jboss.deployment.MainDeployer] Done with create step of deploying Shadows.jar
                  2009-02-26 11:14:11,800 DEBUG [org.jboss.deployment.MainDeployer] Begin deployment start file:/C:/dev/jboss-4.0.5.GA/server/all/tmp/deploy/tmp6695379174028898419shadows.ear-contents/Shadows.jar
                  2009-02-26 11:14:11,800 DEBUG [org.jboss.deployment.MainDeployer] End deployment start on package: Shadows.jar


                  • 6. Re: Name not Bound
                    Peter Johnson Master

                    I assume that when you say "EJB" you mean session beans, and not entity beans. How are they declared? Post the class declaration along with the annotations on the class.

                    Also, post the contents of the Shadows.jar file, using:

                    jar -tf Shadows.jar

                    • 7. Re: Name not Bound
                      Brian unknown Newbie

                      I'm not sure which type of bean they are. Here is one of the classes:

                      package com.castofshadows.manager;
                      
                      import com.castofshadows.entity.Address;
                      
                      import ...
                      
                      @Stateless
                      public class AddressManagerBean implements AddressManager {
                      
                       @PersistenceContext(unitName = "castOfShadows")
                       private EntityManager entityManager;
                      
                       @TransactionAttribute(TransactionAttributeType.REQUIRED)
                       public void saveAddress(Address address) {
                       entityManager.persist(address);
                       }
                      }


                      And here is everything inside the jar file. I'm not sure how to run the jar command in windows, so I just copied and pasted out of the 7zip viewer:

                      entity
                      Address.class
                      Event.class
                      Notification.class
                      Photo.class
                      PhotoAlbum.class
                      Product.class
                      ProductType.class
                      User.class
                      Venue.class
                      enums
                      EventStatus.class
                      NotificationStatus.class
                      manager
                      AddressManager.class
                      AddressManagerBean.class
                      EventManager.class
                      EventManagerBean.class
                      NotificationManager.class
                      NotificationManagerBean.class
                      PhotoManager.class
                      PhotoManagerBean.class
                      ProductManager.class
                      ProductManagerBean.class
                      UserManager.class
                      UserManagerBean.class
                      util
                      ProductGroup.class


                      • 8. Re: Name not Bound
                        Brian unknown Newbie

                        Actually I think these would be session beans

                        • 9. Re: Name not Bound
                          Peter Johnson Master

                          Post the declaration, and annotations, for the AddressManager interface.

                          To run the jar utility, open a command prompt, cd to the directory containing the jar file, and enter the command I posted (the 7zip listing is useless - it doesn't provide the directory nesting). If you get a "command not found" error, insteaf of simply 'jar' use the full path to jara.exe within the JDK's bin directory.

                          • 10. Re: Name not Bound
                            Peter Johnson Master

                            Wait a minute. I just now saw that you are using 4.0.5. Why? Could you move up to 4.2.3 or 5.0 instead? I ask because those evrsions have built-in EJB3 support. 4.0.5 doesn't include EJB3 support out of the box, but there is a JEMS installer that will install 4.0.5 along with EJB support.

                            Note that providing the JBoss AS level is critical when posting to the forums or people will assume you are using the latest version and thus provide useless help if you are instead running on an old version.

                            • 11. Re: Name not Bound
                              Brian unknown Newbie

                              Oh, I'm sorry about that. I will try upgrading first.

                              • 12. Re: Name not Bound
                                Peter Johnson Master

                                I saw that you are using Stripes. I recommend that you use 4.2.3 - I had some problems deploying my Stripes app to 5.0 and I haven't had time to debug it yet. But I had no problems with 4.2.3.

                                Also, make sure you get the download that matches your JDK - the one with "jdk6" in the name is for JDK 6 only, the other one is for JDK 5.

                                • 13. Re: Name not Bound
                                  Brian unknown Newbie

                                  Thanks a lot for the help. I'm not quite there yet, but I've been making progress ever since I upgraded jboss. Funny, now it bound my session beans, but is no longer binding my action beans in Stripes! Ah, such is the price of being a software developer.