Hi When i deploy 2 or more webapps in the same EAR each of them have (webapp) with their own session bean and use a request.login method.
I get a java.lang.NullPointerException: context parameter can not be null (this error happens in each web app where i get WARNING - Could NOT lazily initialize session context because of null RequestContext) i read some posts about this but in those posts they says is ONLY A WARNING!! I reproduce this behavior in my github project. You can download and test the example. https://github.com/maxtorzito/tomee.git Setps: 1. Run with tomee plugin the pom.xml (ear project) 2. Add mymailing.com and mymailing2.com to your hosts files 3. Try to access to mymailing.com:8080 (you get an WARNING - Could NOT lazily initialize session context because of null RequestContext ) the webapp shows the index.xhtml 4. Try to acess to mymailing2.com:8080 (you dont get any warning like webapp1) the webapp show the index.xhtml 5. Then click on Login button in webapp1 or webapp2 (the order doesn't matter) Results: When you try to login in webapp2 you can see the successful message, but when you try to login with webapp1 you get this exception: Log: java.lang.NullPointerException: context parameter can not be null at org.apache.webbeans.util.Asserts.assertNotNull(Asserts.java:50) at org.apache.webbeans.web.context.SessionContextManager.addNewSessionContext(SessionContextManager.java:58) at org.apache.openejb.cdi.UpdatableSessionContextManager.updateSessionIdMapping(UpdatableSessionContextManager.java:50) at org.apache.openejb.cdi.CdiAppContextsService.updateSessionIdMapping(CdiAppContextsService.java:516) at org.apache.tomee.catalina.TomEEContainerListener.containerEvent(TomEEContainerListener.java:42) at org.apache.catalina.core.ContainerBase.fireContainerEvent(ContainerBase.java:1398) at org.apache.catalina.session.ManagerBase.changeSessionId(ManagerBase.java:776) at org.apache.catalina.authenticator.AuthenticatorBase.register(AuthenticatorBase.java:715) at org.apache.catalina.authenticator.AuthenticatorBase.login(AuthenticatorBase.java:801) at org.apache.catalina.connector.Request.login(Request.java:2622) at org.apache.catalina.connector.RequestFacade.login(RequestFacade.java:1065) at com.maxtorzito.web1.managedbean.Web1IndexMBean.login(Web1IndexMBean.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.webbeans.intercept.InterceptorHandler.invoke(InterceptorHandler.java:322) at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:117) at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:108) at com.maxtorzito.web1.managedbean.Web1IndexMBean_$$_javassist_28.login(Web1IndexMBean_$$_javassist_28.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.el.parser.AstValue.invoke(AstValue.java:278) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274) at org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpression.invoke(ContextAwareTagMethodExpression.java:96) at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:88) at javax.faces.event.ActionEvent.processListener(ActionEvent.java:51) at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:420) at javax.faces.component.UICommand.broadcast(UICommand.java:103) at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:1028) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:286) at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1375) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752) at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:38) at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170) at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117) at org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.execute(CodiLifecycleWrapper.java:95) at org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.execute(CodiLifecycleWrapper.java:95) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) I guess this is for the first WARNING in webapp 1 (WARNING - Could NOT lazily initialize session context because of null RequestContext ). I reproduce this problem in the github project, in my real app i have 4 webapps in the same ear (because they share sources etc..) and i have the same problem, i can login only in 1 webapp, if i just deploy 1 webapp in the ear i could login, but if i N webapps i can only access (login) to 1 of them, each webapp unless 1 show the WARNING message, the webapp where the warning message is not present is the webapp where i can login. What could be?
