5 Replies Latest reply on Aug 14, 2006 1:38 PM by asaf sh

    Glassfish and Seam - NullPointerException...

    asaf sh Expert

      Hey,
      I am trying to make SEAM work with any of Glassfish server but I always get the following exception,


      Can anyone point me to the right directions?


      [#|2006-08-14T19:37:53.067+0300|SEVERE|sun-appserver-ee9.1|javax.enterprise.system.container.web|_ThreadID=12;_ThreadName=httpWorkerThread-4848-0;_RequestID=51a80fc9-e383-4283-a5a9-a8f3df51e4c9;|WebModule[/edentity-web]PWC1220: Exception thrown by attributes event listener
      java.lang.NullPointerException
       at com.sun.faces.application.ApplicationAssociate.getInstance(ApplicationAssociate.java:171)
       at com.sun.faces.application.WebappLifecycleListener.handleAttributeEvent(WebappLifecycleListener.java:222)
       at com.sun.faces.application.WebappLifecycleListener.attributeReplaced(WebappLifecycleListener.java:212)
       at org.apache.catalina.core.ApplicationContext.setAttribute(ApplicationContext.java:866)
       at org.apache.catalina.core.ApplicationContextFacade.setAttribute(ApplicationContextFacade.java:357)
       at org.jboss.seam.contexts.WebApplicationContext.set(WebApplicationContext.java:51)
       at org.jboss.seam.init.Initialization.addComponent(Initialization.java:381)
       at org.jboss.seam.init.Initialization.addComponents(Initialization.java:343)
       at org.jboss.seam.init.Initialization.init(Initialization.java:195)
       at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:32)
       at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4236)
       at org.apache.catalina.core.StandardContext.start(StandardContext.java:4760)
       at com.sun.enterprise.web.WebModule.start(WebModule.java:292)
       at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:833)
       at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:817)
       at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:659)
       at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1495)
       at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1160)
       at com.sun.enterprise.web.WebContainer.loadJ2EEApplicationWebModules(WebContainer.java:1085)
       at com.sun.enterprise.server.TomcatApplicationLoader.load(TomcatApplicationLoader.java:128)
       at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:322)
       at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:196)
       at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:633)
       at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeApplicationDeployEventListener(AdminEventMulticaster.java:908)
       at com.sun.enterprise.admin.event.AdminEventMulticaster.handleApplicationDeployEvent(AdminEventMulticaster.java:892)
       at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:445)
       at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:160)
       at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:296)
       at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:203)
       at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:285)
       at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:119)
       at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
       at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
       at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:541)
       at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:585)
       at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:719)
       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 com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:353)
       at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:336)
       at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:448)
       at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
       at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
       at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
       at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
       at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:77)
       at $Proxy1.invoke(Unknown Source)
       at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297)
       at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:56)
       at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:142)
       at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:109)
       at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:180)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
       at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
       at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:246)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
       at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
       at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
       at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
       at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:619)
       at com.sun.enterprise.web.connector.grizzly.blocking.ProcessorBlockingTask.processBlocked(ProcessorBlockingTask.java:210)
       at com.sun.enterprise.web.connector.grizzly.blocking.ProcessorBlockingTask.process(ProcessorBlockingTask.java:173)
       at com.sun.enterprise.web.connector.grizzly.blocking.ProcessorBlockingTask.doTask(ProcessorBlockingTask.java:126)
       at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
       at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:103)
      |#]
      
      [#|2006-08-14T19:37:54.330+0300|INFO|sun-appserver-ee9.1|javax.enterprise.resource.webcontainer.jsf.config|_ThreadID=12;_ThreadName=httpWorkerThread-4848-0;/edentity-web;|Initializing Sun's JavaServer Faces implementation (1.2_01-b04-FCS) for context '/edentity-web'|#]
      
      [#|2006-08-14T19:37:55.201+0300|INFO|sun-appserver-ee9.1|javax.enterprise.resource.webcontainer.jsf.config|_ThreadID=12;_ThreadName=httpWorkerThread-4848-0;/edentity-web;|Completed initializing Sun's JavaServer Faces implementation (1.2_01-b04-FCS) for context '/edentity-web'|#]
      
      [#|2006-08-14T19:37:55.228+0300|INFO|sun-appserver-ee9.1|javax.enterprise.system.stream.out|_ThreadID=12;_ThreadName=httpWorkerThread-4848-0;|hadbRootDirString=/usr/local/glassfish/hadb/4.5.0-9|#]
      
      [#|2006-08-14T19:38:47.190+0300|SEVERE|sun-appserver-ee9.1|javax.enterprise.system.container.web|_ThreadID=13;_ThreadName=httpWorkerThread-8080-0;_RequestID=7ad3305e-25d5-47a5-a3b2-becdac62cc86;|StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
      java.lang.UnsupportedOperationException
       at javax.faces.application.Application.getELResolver(Application.java:443)
       at com.sun.faces.context.FacesContextImpl.getELContext(FacesContextImpl.java:175)
       at javax.faces.component.UIViewRoot.setLocale(UIViewRoot.java:919)
       at com.sun.faces.application.ViewHandlerImpl.createView(ViewHandlerImpl.java:332)
       at org.jboss.seam.jsf.SeamViewHandler.createView(SeamViewHandler.java:43)
       at com.sun.facelets.FaceletViewHandler.createView(FaceletViewHandler.java:782)
       at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:144)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
       at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
       at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
       at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:246)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
       at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
       at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
       at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
       at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:619)
       at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.processNonBlocked(DefaultProcessorTask.java:550)
       at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:780)
       at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)
       at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:251)
       at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:205)
       at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
       at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:103)
      |#]
      
      




      Thanks,

      Asaf

        • 1. Re: Glassfish and Seam - NullPointerException...
          Stan Silvert Master

          This appears to be a JSF RI bug. The WebappLifecycleListener is used for JEE5 dependency injection on managed beans that get added to different scopes. The problem in your case is that Seam is adding attributes to the applicaiton scope before JSF is initialized.

          JSF should be ignoring added attributes until it is fully initialized. I'll work on a fix for this in JSF.

          In the mean time, you can try to find out where Glassfish is adding the WebappLifecycleListener. As long as you are not doing dependency injection on your managed beans you can safely disable this listener.

          I'm not talking about the injection that Seam does. Info on the injection I am talking about is in section 5.4 of the JSF 1.2 spec. You can also read about it here: http://java.sun.com/developer/technicalArticles/J2EE/injection/

          Stan

          • 2. Re: Glassfish and Seam - NullPointerException...
            asaf sh Expert

            Hey,

            Definitely, well, since I remembered that a little older GF build worked fine, I overided jsf-impl.jar file which is the JSF implementation coming with Gf,

            Seems like the problem does not occure in the older version of the overided JSF implementation, but I still get the following error, no matter which web request I'm trying to execute;


            [#|2006-08-14T22:01:22.564+0300|SEVERE|sun-appserver-ee9.1|javax.enterprise.system.container.web|_ThreadID=14;_ThreadName=httpWorkerThread-8080-0;_RequestID=efbc721f-e2a0-44f9-b893-9c041905c874;|StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
            java.lang.UnsupportedOperationException
             at javax.faces.application.Application.getELResolver(Application.java:443)
             at com.sun.faces.context.FacesContextImpl.getELContext(FacesContextImpl.java:172)
             at javax.faces.component.UIViewRoot.setLocale(UIViewRoot.java:919)
             at com.sun.faces.application.ViewHandlerImpl.createView(ViewHandlerImpl.java:370)
             at org.jboss.seam.jsf.SeamViewHandler.createView(SeamViewHandler.java:43)
             at com.sun.facelets.FaceletViewHandler.createView(FaceletViewHandler.java:782)
             at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:144)
             at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
             at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
             at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
             at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
             at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
             at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
             at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
             at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:246)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
             at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
             at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
             at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
             at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
             at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
             at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
             at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
             at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
             at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
             at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:619)
             at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.processNonBlocked(DefaultProcessorTask.java:550)
             at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:780)
             at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)
             at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:251)
             at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:205)
             at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
             at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:103)
            |#]
            


            I assume this is not related for the first problem, although I posted them together one after another.

            Thanks a lot,

            Cheers.

            • 3. Re: Glassfish and Seam - NullPointerException...
              Stan Silvert Master

              Yea, WebappLifecycleListener wasn't included in the older version.

              That other stack trace looks like it is using an JSF 1.1 version of the ApplicationFactory. I'm not completely sure of that though.

              Did you override both the JSF jars? Is there anywhere that that ApplicationFactory is being set in a faces-config.xml file?

              Stan

              • 4. Re: Glassfish and Seam - NullPointerException...
                asaf sh Expert

                Hey,

                I overided only jsf-impl.jar,

                regarding faces-config.xml file, it's almost empty,
                I only have the 'com.sun.facelets.FaceletViewHandler' for the facelets viewer handler and 'org.jboss.seam.jsf.SeamPhaseListener' which is the seam listener, thats all.


                Anyway, if the previous error stopped showing (due to the use of the old jsf-impl.jar) then there's no reason to stop the WebappLifecycleListener, correct? if so, what's there's left to do? :-/

                Thanks pal.

                • 5. Re: Glassfish and Seam - NullPointerException...
                  asaf sh Expert

                  Eh, I mixed myfaces JSF implementation with Sun's which is coming with Gf,

                  Somehow it worked fine in older versions of GF,


                  Anyway removing Apache's JSF implementation fixed the problem,



                  Stan, thanks for your help, at least we know JSF needs a fix here :)


                  cheers.