10 Replies Latest reply on Dec 14, 2006 12:51 PM by Henry Orunkoya

    JBoss failed JNDI lookup without any error

    Henry Orunkoya Newbie

      Hello Everyone,

      I believe someone must have come across this problem before. Basically I have just migrated my stateful session bean from OC4J to JBoss and managed to sort out the initial teething problems. In essence, it looks as if I am now faced with a problem that i cannot comprehend. in short whenever my code attempts a JNDI lookup on my bean, nothing seems to be happening and to prove that it is going beyond the section where it should be picking up the bean, I have added a log code to my code and this does not get printed out. Please Help.

        • 1. Re: JBoss failed JNDI lookup without any error
          Peter Johnson Master

          Based on the information you have given so far, I would say that you should fix your jndi lookup code, and then it will work. :-)

          If you could provide the following, I could probably be more specific:

          1) Post the code that does the lookup, pointing out the specific line that is failing. (Use [ code ] ... [ /code ] brackets around your code, without the spaces)

          2) Post the exception stack trace (if your log code never gets printed out, an exception was probably thrown)

          3) Use twiddle to list out the JNDI contents. From the bin directory, enter:

          ./twiddle.sh invoke jboss:service=JNDIView list true


          (If you are in Windows, use 'twiddle' instead of './twiddle.sh')

          Post the results from the twiddle command.

          • 2. Re: JBoss failed JNDI lookup without any error
            Henry Orunkoya Newbie

            Ok. I've managed to extract the error message and it is as follows:
            $Proxy82
            java.lang.ClassCastException: $Proxy82
            at com.janes.jf.action.LoginAction.process(LoginAction.java:50)
            at com.janes.jf.action.RequestAction.execute(RequestAction.java:21)
            at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
            at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
            at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
            at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at com.janes.jf.filter.LoginFilter.doFilter(LoginFilter.java:24)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
            at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
            at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
            at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
            at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
            at java.lang.Thread.run(Thread.java:595)

            The below is the code I am using to do the lookup

            InitialContext ic = new InitialContext();
            MAPDelegateHome mapHome = (MAPDelegateHome)ic.lookup("java:comp/env/ejb/MAPDelegate");
            


            Thanks

            • 3. Re: JBoss failed JNDI lookup without any error
              Peter Johnson Master

              Is that a local or a remote EJB you are looking up? For a remote EJB, you should be using:

              Object obj = ic.lookup("java:comp/env/ejb/MAPDelegate");
              MAPDelegateHome mapHome = (MAPDelegateHome)PortableRemoteObject.narrow(obj, MAPDelegateHome.class);


              • 4. Re: JBoss failed JNDI lookup without any error
                Henry Orunkoya Newbie

                Thanks for your prompt reply. Yes it is a remote Object. I will try out your suggestion and report back soon.

                Once again, Thanks.

                • 5. Re: JBoss failed JNDI lookup without any error
                  Henry Orunkoya Newbie

                  after following your suggestion, the below is the exception that was thrown:

                   null
                   java.lang.ClassCastException
                   at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
                   at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
                   at com.janes.jf.action.LoginAction.process(LoginAction.java:52)
                   at com.janes.jf.action.RequestAction.execute(RequestAction.java:21)
                   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
                   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
                   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
                   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                   at com.janes.jf.filter.LoginFilter.doFilter(LoginFilter.java:24)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                   at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                   at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                   at java.lang.Thread.run(Thread.java:595)
                   Caused by: java.lang.ClassCastException: $Proxy57
                   at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)
                  


                  • 6. Re: JBoss failed JNDI lookup without any error
                    Henry Orunkoya Newbie

                    Hello there,

                    I am still experiencing this problem and it is now becoming a joke as I have tried everything I know. Could somebody please help as I am quickly running out of options here. the latest exception which is no different from the previous is :

                    $Proxy57
                    java.lang.ClassCastException: $Proxy57
                     at com.janes.jf.action.LoginAction.process(LoginAction.java:52)
                     at com.janes.jf.action.RequestAction.execute(RequestAction.java:21)
                     at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
                     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
                     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
                     at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                     at com.janes.jf.filter.LoginFilter.doFilter(LoginFilter.java:24)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                     at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                     at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                     at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                     at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                     at java.lang.Thread.run(Thread.java:595)
                    


                    The line of code that throws this exception is:

                     InitialContext ic = new InitialContext();
                     Object obj = ic.lookup("ejb/MAPDelegate");
                     MAPDelegateHome mapHome = (MAPDelegateHome)obj;
                    


                    ejb-jar.xml is as follows:

                    ejb-jar>
                     <enterprise-beans>
                     <session>
                     <description>Session Bean ( Stateful )</description>
                     <display-name>MAPDelegate</display-name>
                     <ejb-name>ejb/MAPDelegate</ejb-name>
                     <home>com.janes.jf.ejb.MAPDelegateHome</home>
                     <remote>com.janes.jf.ejb.MAPDelegate</remote>
                     <local-home>com.janes.jf.ejb.MAPDelegateLocalHome</local-home>
                     <local>com.janes.jf.ejb.MAPDelegateLocal</local>
                     <ejb-class>com.janes.jf.ejb.MAPDelegateBean</ejb-class>
                     <session-type>Stateful</session-type>
                     <transaction-type>Container</transaction-type>
                     </session>
                     </enterprise-beans>
                    </ejb-jar>
                    


                    Please HELP!!!!!.



                    • 7. Re: JBoss failed JNDI lookup without any error
                      Peter Johnson Master

                      See my recommendation #3 above (thought I had posted this reply yesterday, must have posted it to the wrong topic).

                      • 8. Re: JBoss failed JNDI lookup without any error
                        Henry Orunkoya Newbie

                        Hi Peter,

                        Using twiddle returns the following:

                        16:16:22,015 ERROR [Twiddle] Exec failed
                        javax.management.MalformedObjectNameException: Unterminated key prop
                         at javax.management.ObjectName.construct(ObjectName.java:465
                         at javax.management.ObjectName.<init>(ObjectName.java:1304)
                         at org.jboss.console.twiddle.command.MBeanServerCommand.quer
                         at org.jboss.console.twiddle.command.InvokeCommand.execute(I
                         at org.jboss.console.twiddle.Twiddle.main(Twiddle.java:305)
                        


                        and recommendation No. 3, fails with same old class cast exception.

                        • 9. Re: JBoss failed JNDI lookup without any error
                          Henry Orunkoya Newbie

                          Ok, I restarted JBoss and got the following when I tried to run my web app:

                          16:19:45,667 ERROR [LogInterceptor] EJBException in method: public abstract com.janes.jf.ejb.MAPDelegate com.janes.jf.ejb.MAPDelegateHome.create() throws java.rmi.RemoteException,javax.ejb.CreateException:
                          javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract com.janes.jf.ejb.MAPDelegate com.janes.jf.ejb.MAPDelegateHome.create() throws java.rmi.RemoteException,javax.ejb.CreateException
                           at org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor.invokeHome(StatefulSessionContainer.java:525)
                           at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:145)
                           at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:189)
                           at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invokeHome(StatefulSessionInstanceInterceptor.java:143)
                           at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:56)
                           at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:125)
                           at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
                           at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:161)
                           at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:132)
                           at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)
                           at org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer.java:637)
                           at org.jboss.ejb.Container.invoke(Container.java:975)
                           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                           at java.lang.reflect.Method.invoke(Method.java:585)
                           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                           at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
                           at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
                           at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
                           at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
                           at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
                           at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
                           at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:184)
                           at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
                           at $Proxy68.create(Unknown Source)
                           at com.janes.jf.action.LoginAction.process(LoginAction.java:56)
                           at com.janes.jf.action.RequestAction.execute(RequestAction.java:21)
                           at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
                           at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
                           at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
                           at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
                           at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                           at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                           at com.janes.jf.filter.LoginFilter.doFilter(LoginFilter.java:24)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                           at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                           at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                           at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)