9 Replies Latest reply on Apr 10, 2008 12:40 AM by jaikiran pai

    NameNotBoundException

    lui dan Newbie

      Hi, I have a problem in lookup an stateless session bean from jsf.
      I use jboss4.2.2.GA, seam and EJB3.
      I have the jndiPatter in in xml file to myApp/#{ejbName}/local but when call the ejb from JSF page an exception is throws.
      The exception is NameNotBoundExcpetion myApp not bound.

      The strange thing is that if I change jndiPatter to aaaa/#{ejbName}/local the exeption is NameNotBoundExcpetion aaaa is not bound.

      If I change the jndiPatter to #{ejbName}/local the exception is
      NameNotBoundExcpetion #{ejbName}is not bound.

      It seems thet the jndiName is cut to the first / in the jndiPatter.

      Can you help me?

      Thanks

        • 1. Re: NameNotBoundException
          jaikiran pai Master

          Use the JNDIView from the jmx-console http://wiki.jboss.org/wiki/en/DisplayTheJNDITreeWithTheJMXConsole to see the jndi-name of your bean. Then use that jndi-name for the lookup.

          • 2. Re: NameNotBoundException
            lui dan Newbie

             

            "jaikiran" wrote:
            Use the JNDIView from the jmx-console http://wiki.jboss.org/wiki/en/DisplayTheJNDITreeWithTheJMXConsole to see the jndi-name of your bean. Then use that jndi-name for the lookup.


            I have used the JNDIView and the jndi-name of the bean is correct, but when I use that the name is cut to the first / of the name.

            • 3. Re: NameNotBoundException
              jaikiran pai Master

              Please post the output of your JNDIView. While posting the contents , remember to wrap it in a code block using the Code button in the message editor window and please hit the Preview button to make sure your post is correctly formatted.

              • 4. Re: NameNotBoundException
                lui dan Newbie

                 

                "jaikiran" wrote:
                Please post the output of your JNDIView. While posting the contents , remember to wrap it in a code block using the Code button in the message editor window and please hit the Preview button to make sure your post is correctly formatted.


                This is the output of the JNDIView
                My bean is RivalseEar/AccessoBean/local.

                Global JNDI Namespace
                 +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
                 +- jmx (class: org.jnp.interfaces.NamingContext)
                 | +- invoker (class: org.jnp.interfaces.NamingContext)
                 | | +- RMIAdaptor (proxy: $Proxy47 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)
                 +- RivalseEar (class: org.jnp.interfaces.NamingContext)
                 | +- EjbSynchronizations (class: org.jnp.interfaces.NamingContext)
                 | | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
                 | | +- local (class: java.lang.Object)
                 | +- TimerServiceDispatcher (class: org.jnp.interfaces.NamingContext)
                 | | +- local (proxy: $Proxy89 implements interface org.jboss.seam.async.LocalTimerServiceDispatcher,interface org.jboss.ejb3.JBossProxy)
                 | +- AccessoBean (class: org.jnp.interfaces.NamingContext)
                 | | +- local (proxy: $Proxy82 implements interface it.inail.rivalse.session.security.Accesso,interface org.jboss.ejb3.JBossProxy)
                 +- persistence.units:ear=RivalseEar.ear,jar=Rivalse-ejb.jar,unitName=Rivalse (class: org.hibernate.impl.SessionFactoryImpl)
                 +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
                 +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
                 +- UserTransactionSessionFactory (proxy: $Proxy14 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
                 +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
                 +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
                 +- TransactionSynchronizationRegistry (class: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple)
                 +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
                 +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
                 +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
                 +- 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)
                 +- topic (class: org.jnp.interfaces.NamingContext)
                 | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
                 | +- testTopic (class: org.jboss.mq.SpyTopic)
                 | +- securedTopic (class: org.jboss.mq.SpyTopic)
                 +- console (class: org.jnp.interfaces.NamingContext)
                 | +- PluginManager (proxy: $Proxy48 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)
                
                


                The exception is


                12:37:02,875 ERROR [STDERR] javax.naming.NameNotFoundException: RivalseEar not bound
                12:37:02,875 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
                12:37:02,875 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
                12:37:02,875 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
                12:37:02,875 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
                12:37:02,875 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
                12:37:02,875 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
                12:37:02,875 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:774)
                12:37:02,875 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
                12:37:02,875 ERROR [STDERR] at javax.naming.InitialContext.lookup(Unknown Source)
                12:37:02,875 ERROR [STDERR] at it.inail.rivalse.jsf.converters.ConfermaSceltaSedeEvent.changeSceltaSede(ConfermaSceltaSedeEvent.java:29)
                12:37:02,875 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                12:37:02,875 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                12:37:02,875 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                12:37:02,875 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
                12:37:02,875 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
                12:37:02,875 ERROR [STDERR] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                12:37:02,875 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                12:37:02,875 ERROR [STDERR] at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
                12:37:02,875 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                12:37:02,875 ERROR [STDERR] at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
                12:37:02,875 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                12:37:02,875 ERROR [STDERR] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
                12:37:02,875 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                12:37:02,875 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                12:37:02,875 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
                12:37:02,875 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
                12:37:02,875 ERROR [STDERR] at it.inail.rivalse.jsf.converters.ConfermaSceltaSedeEvent_$$_javassist_3.changeSceltaSede(ConfermaSceltaSedeEvent_$$_javassist_3.java)
                12:37:02,875 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                12:37:02,875 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                12:37:02,875 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                12:37:02,875 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
                12:37:02,875 ERROR [STDERR] at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
                12:37:02,875 ERROR [STDERR] at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
                12:37:02,875 ERROR [STDERR] at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
                12:37:02,875 ERROR [STDERR] at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
                12:37:02,875 ERROR [STDERR] at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                12:37:02,875 ERROR [STDERR] at org.jboss.seam.el.OptionalParameterMethodExpression.invoke(OptionalParameterMethodExpression.java:39)
                12:37:02,875 ERROR [STDERR] at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                12:37:02,875 ERROR [STDERR] at javax.faces.event.MethodExpressionValueChangeListener.processValueChange(MethodExpressionValueChangeListener.java:80)
                12:37:02,875 ERROR [STDERR] at javax.faces.event.ValueChangeEvent.processListener(ValueChangeEvent.java:123)
                12:37:02,890 ERROR [STDERR] at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:746)
                12:37:02,890 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
                12:37:02,890 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:160)
                12:37:02,890 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:337)
                12:37:02,890 ERROR [STDERR] at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
                12:37:02,890 ERROR [STDERR] at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                12:37:02,890 ERROR [STDERR] at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                12:37:02,890 ERROR [STDERR] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                12:37:02,890 ERROR [STDERR] at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                12:37:02,890 ERROR [STDERR] at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                12:37:02,890 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                12:37:02,890 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                12:37:02,890 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                12:37:02,890 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                12:37:02,890 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                12:37:02,890 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                12:37:02,890 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                12:37:02,890 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                12:37:02,890 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                12:37:02,890 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
                
                


                • 5. Re: NameNotBoundException
                  jaikiran pai Master

                   

                  +- RivalseEar (class: org.jnp.interfaces.NamingContext)
                  | +- EjbSynchronizations (class: org.jnp.interfaces.NamingContext)
                  | | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
                  | | +- local (class: java.lang.Object)
                  | +- TimerServiceDispatcher (class: org.jnp.interfaces.NamingContext)
                  | | +- local (proxy: $Proxy89 implements interface org.jboss.seam.async.LocalTimerServiceDispa
                  tcher,interface org.jboss.ejb3.JBossProxy)
                  | +- AccessoBean (class: org.jnp.interfaces.NamingContext)
                  | | +- local (proxy: $Proxy82 implements interface it.inail.rivalse.session.security.Accesso,interface org.jboss.ejb3.JBossProxy)

                  The jndi tree does show that the bean is bound with that jndi-name. Can you post the code of it.inail.rivalse.jsf.converters.ConfermaSceltaSedeEvent.changeSceltaSede method where you are doing the lookup? Are you passing anything to the InitialContext constructor? Or do you have a jndi.properties in your application?

                  • 6. Re: NameNotBoundException
                    lui dan Newbie

                    Thisi is the code that call for lookup ejb

                     public void changeSceltaSede(ValueChangeEvent event){
                     log.info("Sede selezionata #0 :: #1 ", utenteRivalse.getSedeSelezionata().getCodice(),utenteRivalse.getSedeSelezionata().getDenominazione());
                     //devo caricare le info della sede
                     Context context;
                     try {
                     context = getContext();
                     Accesso accessoBean = (Accesso)context.lookup("java:comp/env/RivalseEar/AccessoBean/local");
                     accessoBean.confermaSceltaSede();
                     } catch (NamingException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
                     }
                     }
                    
                     private static Context getContext()throws NamingException{
                    
                     Context ctx = new InitialContext(System.getProperties());
                     ctx.addToEnvironment("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
                     ctx.addToEnvironment("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
                     ctx.addToEnvironment("java.naming.provider.url", "localhost:1099");
                     return ctx;
                     }
                    
                    


                    • 7. Re: NameNotBoundException
                      Jeroen Wenting Newbie

                      the jndi name you supply is different from the one under which it is mapped, with a NameNotBoundException as the predictable result.

                      • 8. Re: NameNotBoundException
                        lui dan Newbie

                         

                        "jwenting" wrote:
                        the jndi name you supply is different from the one under which it is mapped, with a NameNotBoundException as the predictable result.



                        Can you repeat?. I don't understand what you say.

                        • 9. Re: NameNotBoundException
                          jaikiran pai Master

                           

                          "bambooh" wrote:

                           Accesso accessoBean = (Accesso)context.lookup("java:comp/env/RivalseEar/AccessoBean/local");
                          
                          
                          




                          Global JNDI Namespace
                          +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
                          +- jmx (class: org.jnp.interfaces.NamingContext)
                          | +- invoker (class: org.jnp.interfaces.NamingContext)
                          | | +- RMIAdaptor (proxy: $Proxy47 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,i
                          nterface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
                          | +- rmi (class: org.jnp.interfaces.NamingContext)
                          | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
                          +- RivalseEar (class: org.jnp.interfaces.NamingContext)
                          | +- EjbSynchronizations (class: org.jnp.interfaces.NamingContext)
                          | | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
                          | | +- local (class: java.lang.Object)
                          | +- TimerServiceDispatcher (class: org.jnp.interfaces.NamingContext)
                          | | +- local (proxy: $Proxy89 implements interface org.jboss.seam.async.LocalTimerServiceDispa
                          tcher,interface org.jboss.ejb3.JBossProxy)
                          | +- AccessoBean (class: org.jnp.interfaces.NamingContext)
                          | | +- local (proxy: $Proxy82 implements interface it.inail.rivalse.session.security.Accesso,i
                          nterface org.jboss.ejb3.JBossProxy)


                          bambooh, as you can see from the JNDIView, the bean is bound in "Global JNDI namespace". In your lookup code, you are using the java:comp/env namespace for doing the lookup. Hence the lookup fails.

                          Change the lookup to:
                          Accesso accessoBean = (Accesso)context.lookup("RivalseEar/AccessoBean/local");