1 2 Previous Next 18 Replies Latest reply on May 11, 2010 8:17 AM by jaikiran

    NPE in StateslessContainer at line 396

      Jboss 6.0 uses jboss-ejb3-core-1.2.2.jar . I am getting null ponter exception at line 396 of StateslessContainer class of  jboss-ejb3-core-1.2.2.jar.

      I am not able to understand why I am getting this error, while same application is running fine in jboss 4.3.2. Can somebody help to sort out the issue?

        • 1. Re: NPE in StateslessContainer at line 396
          jaikiran

          Please post the entire exception stacktrace and also the exact version of JBoss AS 6.0. Have you done any changes to the clean JBoss AS download?

          • 2. Re: NPE in StateslessContainer at line 396

            I am using Jboss 6.0.0M2

             

            Following is complete stacktrace

             

            java.lang.NullPointerException

            at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(

            StatelessContainer.java:396)

            at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(

            InvokableContextClassProxyHack.java:53)

            at org.jboss.aop.Dispatcher.invoke(

            Dispatcher.java:91)

            at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(

            AOPRemotingInvocationHandler.java:82)

            at org.jboss.remoting.ServerInvoker.invoke(

            ServerInvoker.java:897)

            at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(

            ServerThread.java:768)

            at org.jboss.remoting.transport.socket.ServerThread.processInvocation(

            ServerThread.java:721)

            at org.jboss.remoting.transport.socket.ServerThread.dorun(

            ServerThread.java:548)

            at org.jboss.remoting.transport.socket.ServerThread.run(

            ServerThread.java:234)

            at org.jboss.remoting.MicroRemoteClientInvoker.invoke(

            MicroRemoteClientInvoker.java:163)

            at org.jboss.remoting.Client.invoke(

            Client.java:1634)

            at org.jboss.remoting.Client.invoke(

            Client.java:548)

            at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(

            InvokeRemoteInterceptor.java:62)

            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(

            MethodInvocation.java:101)

            at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(

            ClientTxPropagationInterceptor.java:67)

            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(

            MethodInvocation.java:101)

            at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(

            SecurityClientInterceptor.java:65)

            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(

            MethodInvocation.java:101)

            at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(

            IsLocalInterceptor.java:74)

            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(

            MethodInvocation.java:101)

            at org.jboss.aspects.remoting.PojiProxy.invoke(

            PojiProxy.java:61)

            at $Proxy44.invoke(Unknown Source)

            at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(

            SessionProxyInvocationHandlerBase.java:188)

            at $Proxy43.authenticateUser(Unknown Source)

            at com.acknow.servlets.login.GreetingServiceImpl.greetServer(

            GreetingServiceImpl.java:45)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(

            Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

            at java.lang.reflect.Method.invoke(Unknown Source)

            at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(

            RPC.java:562)

            at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(

            RemoteServiceServlet.java:188)

            at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(

            RemoteServiceServlet.java:224)

            at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(

            AbstractRemoteServiceServlet.java:62)

            at javax.servlet.http.HttpServlet.service(

            HttpServlet.java:637)

            at javax.servlet.http.HttpServlet.service(

            HttpServlet.java:717)

            at org.mortbay.jetty.servlet.ServletHolder.handle(

            ServletHolder.java:487)

            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(

            ServletHandler.java:1097)

            at com.acknow.webcore.WebAccessFilter.doFilter(

            WebAccessFilter.java:39)

            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(

            ServletHandler.java:1088)

            at org.mortbay.jetty.servlet.ServletHandler.handle(

            ServletHandler.java:360)

            at org.mortbay.jetty.security.SecurityHandler.handle(

            SecurityHandler.java:216)

            at org.mortbay.jetty.servlet.SessionHandler.handle(

            SessionHandler.java:181)

            at org.mortbay.jetty.handler.ContextHandler.handle(

            ContextHandler.java:729)

            at org.mortbay.jetty.webapp.WebAppContext.handle(

            WebAppContext.java:405)

            at org.mortbay.jetty.handler.HandlerWrapper.handle(

            HandlerWrapper.java:152)

            at org.mortbay.jetty.handler.RequestLogHandler.handle(

            RequestLogHandler.java:49)

            at org.mortbay.jetty.handler.HandlerWrapper.handle(

            HandlerWrapper.java:152)

            at org.mortbay.jetty.Server.handle(

            Server.java:324)

            at org.mortbay.jetty.HttpConnection.handleRequest(

            HttpConnection.java:505)

            at org.mortbay.jetty.HttpConnection$RequestHandler.content(

            HttpConnection.java:843)

            at org.mortbay.jetty.HttpParser.parseNext(

            HttpParser.java:647)

            at org.mortbay.jetty.HttpParser.parseAvailable(

            HttpParser.java:211)

            at org.mortbay.jetty.HttpConnection.handle(

            HttpConnection.java:380)

            at org.mortbay.io.nio.SelectChannelEndPoint.run(

            SelectChannelEndPoint.java:395)

            at org.mortbay.thread.QueuedThreadPool$PoolThread.run(

            QueuedThreadPool.java:488)

            at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(

            InvokeRemoteInterceptor.java:74)

            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(

            MethodInvocation.java:101)

            at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(

            ClientTxPropagationInterceptor.java:67)

            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(

            MethodInvocation.java:101)

            at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(

            SecurityClientInterceptor.java:65)

            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(

            MethodInvocation.java:101)

            at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(

            IsLocalInterceptor.java:74)

            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(

            MethodInvocation.java:101)

            at org.jboss.aspects.remoting.PojiProxy.invoke(

            PojiProxy.java:61)

            at $Proxy44.invoke(Unknown Source)

            at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(

            SessionProxyInvocationHandlerBase.java:188)

            at $Proxy43.authenticateUser(Unknown Source)

            at com.acknow.servlets.login.GreetingServiceImpl.greetServer(

            GreetingServiceImpl.java:45)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(

            Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

            at java.lang.reflect.Method.invoke(Unknown Source)

            at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(

            RPC.java:562)

            at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(

            RemoteServiceServlet.java:188)

            at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(

            RemoteServiceServlet.java:224)

            at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(

            AbstractRemoteServiceServlet.java:62)

            at javax.servlet.http.HttpServlet.service(

            HttpServlet.java:637)

            at javax.servlet.http.HttpServlet.service(

            HttpServlet.java:717)

            at org.mortbay.jetty.servlet.ServletHolder.handle(

            ServletHolder.java:487)

            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(

            ServletHandler.java:1097)

            at com.acknow.webcore.WebAccessFilter.doFilter(

            WebAccessFilter.java:39)

            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(

            ServletHandler.java:1088)

            at org.mortbay.jetty.servlet.ServletHandler.handle(

            ServletHandler.java:360)

            at org.mortbay.jetty.security.SecurityHandler.handle(

            SecurityHandler.java:216)

            at org.mortbay.jetty.servlet.SessionHandler.handle(

            SessionHandler.java:181)

            at org.mortbay.jetty.handler.ContextHandler.handle(

            ContextHandler.java:729)

            at org.mortbay.jetty.webapp.WebAppContext.handle(

            WebAppContext.java:405)

            at org.mortbay.jetty.handler.HandlerWrapper.handle(

            HandlerWrapper.java:152)

            at org.mortbay.jetty.handler.RequestLogHandler.handle(

            RequestLogHandler.java:49)

            at org.mortbay.jetty.handler.HandlerWrapper.handle(

            HandlerWrapper.java:152)

            at org.mortbay.jetty.Server.handle(

            Server.java:324)

            at org.mortbay.jetty.HttpConnection.handleRequest(

            HttpConnection.java:505)

            at org.mortbay.jetty.HttpConnection$RequestHandler.content(

            HttpConnection.java:843)

            at org.mortbay.jetty.HttpParser.parseNext(

            HttpParser.java:647)

            at org.mortbay.jetty.HttpParser.parseAvailable(

            HttpParser.java:211)

            at org.mortbay.jetty.HttpConnection.handle(

            HttpConnection.java:380)

            at org.mortbay.io.nio.SelectChannelEndPoint.run(

            SelectChannelEndPoint.java:395)

            at org.mortbay.thread.QueuedThreadPool$PoolThread.run(

            QueuedThreadPool.java:488)

            • 3. Re: NPE in StateslessContainer at line 396
              jaikiran

              The NPE is a known bug https://jira.jboss.org/jira/browse/EJBTHREE-1994

               

              But the root cause is something specific to your application. Which bean method are you calling from the "authenticateUser" method? Can you post the relevant piece of code from the bean and its interfaces?

              • 4. Re: NPE in StateslessContainer at line 396

                authentiacteUser is mtheod of Statless Session bean  UserService.

                 

                here is excerpt from my code

                 

                 

                @Remote

                public

                 

                 

                interface UserService

                {

                 

                 

                User authenticateUser ()

                throws ApplicationException;

                }

                 

                 

                @Stateless

                 

                 

                public

                 

                 

                class UserServiceBean implements UserService {

                 

                 

                public

                 

                User authenticateUser() throws ApplicationException {

                 

                     System.

                out.println(" in UserServiceBean: authenticateUser");

                 

                 

                }

                 

                I am calling this method from servlet client as follows :

                 

                 

                 

                UserService service = (UserService) BeanLocator.getBean(

                "UserServiceBean/remote");

                User u = service.authenticateUser();

                 

                getBean  method in Beanlocater class looks into JNDI and provides the proxy for stateless bean UserServiceBean.

                 

                This code works fine in jboss 4.3.2, but not in jbosss 6.0M2

                 

                looking into source code of StatlessContainer at line 396

                 

                MethodInfo info = advisor.getMethodInfo(methodHash);
                         Method unadvisedMethod = info.getMethod();

                looks loke info is null, but why? I am not able to understand.

                 

                The mehod authenticateUser is present in UserServiceBean

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                • 5. Re: NPE in StateslessContainer at line 396
                  jaikiran

                  Are you sure, the bean deployed on the server has that method? Also, does your client application (which calls this bean) have the correct (version of) jar files with the bean interface?

                  • 6. Re: NPE in StateslessContainer at line 396
                    jaikiran

                    Also, please provide more details about your client application? Is it a standalone application? Is it a client application deployed on some other server instance? Or is it running on the same server? A complete exception stacktrace is also useful (Please do not use font colours while posting. Instead use the formatting options available in the forum editor).

                    • 7. Re: NPE in StateslessContainer at line 396

                      The authenticateUser bean method is indeed available in Stateless bean UserServiceBaen. (same code is working fine in jboss 4.3.2).This method is been called from Servlet which is running another Servletcontainer(and not the jboss's tomcat).The earlier exception stack trace provided by me is complete one that I get on client.

                      • 8. Re: NPE in StateslessContainer at line 396

                        Problem got resolved as there were some client jar missing on the client.

                        thanks for your prompt replies and help.

                        However I am getting new error in my application.

                        My application has Interceptor with following code

                         

                         

                         

                         

                        public class ApplicationIterceptor implements Interceptor {

                         

                        public Object invoke(Invocation invocation) throws Throwable {

                             EJBContainerInvocation ejb = (EJBContainerInvocation) invocation;
                         
                               Principal p =  ejb.getBeanContext().getEJBContext().getCallerPrincipal();

                        }

                        }

                        In jboss 4.3.2 ejb.getBeanContext() was returing value, however in jboss 6.0M2 it is returning null. Is there any change in thw way for getting CallerPrincipal in Jboss6?

                         

                        thanks in advance.

                        • 9. Re: NPE in StateslessContainer at line 396

                          Hi Jai,

                           

                          any  clue why BeanContext is null in this case?

                          • 10. Re: NPE in StateslessContainer at line 396
                            jaikiran

                            Nagin Kothari wrote:


                            My application has Interceptor with following code

                             

                             

                             

                             

                            public class ApplicationIterceptor implements Interceptor {

                             

                            public Object invoke(Invocation invocation) throws Throwable {

                                 EJBContainerInvocation ejb = (EJBContainerInvocation) invocation;
                             
                                   Principal p =  ejb.getBeanContext().getEJBContext().getCallerPrincipal();

                            }

                            }

                            In jboss 4.3.2 ejb.getBeanContext() was returing value, however in jboss 6.0M2 it is returning null. Is there any change in thw way for getting CallerPrincipal in Jboss6?

                             

                            thanks in advance.

                            I haven't looked into the details yet, but why are you using a AOP interceptor and accessing JBoss internal classes to get hold of the caller principal?

                            • 11. Re: NPE in StateslessContainer at line 396

                              Intention to use AOP interceptor was not to get to caller principal.It is written for getting context data  passed by client which are generic and not specific to bean method call(e.g  Locale). And also to pass on response data to client back through

                               

                              invocation.setResponseContextInfo(responseMap); 

                              there i needed callerprincipal. In 4.3.2  , I  used get value for Beancontext as well as value for  invocation.getTargetObject(). but now both are null in case of 6.0M2

                               

                               

                              • 12. Re: NPE in StateslessContainer at line 396
                                jaikiran

                                Post your -aop.xml configs where you have added your custom interceptor.

                                 

                                By the way, I would recommend that it's better to not rely on JBoss internal classes.

                                 

                                Intention to use AOP interceptor was not to get to caller principal.It is written for getting context data  passed by client which are generic and not specific to bean method call(e.g  Locale)

                                Can't it be done through javax.interceptor.* interceptors?

                                • 13. Re: NPE in StateslessContainer at line 396

                                  Yes context data coming from client is available through ejb interceptor , but can data be passed back to client through it. I do not think so.

                                  that's why i have use AOP interecptor. Also client side interceptor is also AOP interceptor.

                                  • 14. Re: NPE in StateslessContainer at line 396
                                    jaikiran

                                    I guess you missed this part of my previous message?

                                     

                                    jaikiran wrote:

                                    Post your -aop.xml configs where you have added your custom interceptor.
                                    1 2 Previous Next