1 Reply Latest reply on Jun 20, 2008 12:52 PM by Laurent 4x

    Sun extension jar presence cause crash "There should only be one Seam phase listener per application"

    Laurent 4x Newbie

      Hi,
      I got a serious issue ..





      Here is the fact :
      I’m trying to build a app where I can cohabit with JBOSS Seam and Netbeans/SUN’ s VisualWebPack (Woodstock)
      I’m working on Glassfish as usual I got    <listener-class>org.jboss.seam.servlet.SeamListener</listener-class> in the  faces-config.xml.


      Well everything seems Ok BUT trouble is this nice features of NB’s visual JSF plugin impose a sun’s library which includes
      jsf-extensions-dynamic-faces-0.1.jar
      When this is not present Woodstock throws exceptions.
      But when it is in the ear it causes Seam to be unable to load. (error on the Phase Listener)


      And I’m stuck because all my idea was to mix the two so we can port our code smoothly.



      -When I let the jsf-extensions-dynamic-faces (I even tried with the latest rc found on https://jsf-extensions.dev.java.net/) I crashed with this :
      <SeamPhaseListener:94 - There should only be one Seam phase listener per application>
      In fact I traced it a little bit and found that SeamPhaseListener is indeed instanced twice on application deployment ONLY if jsf-extensions-dynamic-faces is in the ear.



      What I had done is :



      -downloaded the seam source ; modified SeamPhaseListener to print a stack trace when constructor is called.



      -Make two .ear one with the jsf-extensions  .jar one without
      -deploy and examine the trace



      (PS I’m working with Glassfish-v2 latest)



      Here is the result of my trace on Glassfish :
      On deployment the log show that classloaders are on duty : in this order



      loadClass(com.sun.faces.lifecycle.LifecycleFactoryImpl)
      loadClass(org.ajax4jsf.application.DebugLifecycleFactory)
      loadClass(com.sun.faces.lifecycle.ELResolverInitPhaseListener)
      loadClass(org.jboss.seam.debug.jsf.SeamDebugPhaseListener)
      loadClass(org.jboss.seam.jsf.SeamPhaseListener) followed by the stack trace of the constructor
      loadClass(org.ajax4jsf.event.AjaxPhaseListener)
      loadClass(org.ajax4jsf.event.InitPhaseListener)
      loadClass(com.sun.faces.application.ApplicationFactoryImpl)
      loadClass(org.jboss.seam.jsf.SeamApplicationFactory)
      loadClass(com.sun.faces.vendor.GlassFishInjectionProvider)


      And when I deploy the other .ear (the one with jsf-extensions  included)


      (com.sun.faces.lifecycle.LifecycleFactoryImpl)
      com.sun.faces.extensions.avatar.lifecycle.ExtensionsLifecycleFactoryImpl)
      org.ajax4jsf.application.DebugLifecycleFactory)
      loadClass(org.apache.log4j.Logger)
      loadClass(org.apache.commons.logging.impl.Log4JLogger)
      loadClass(com.sun.faces.lifecycle.ELResolverInitPhaseListener)
      loadClass(org.jboss.seam.debug.jsf.SeamDebugPhaseListener)
      loadClass(org.jboss.seam.jsf.SeamPhaseListener) followed by the stack trace of the constructor
      loadClass(org.ajax4jsf.event.AjaxPhaseListener)
      loadClass(org.ajax4jsf.event.InitPhaseListener)
      >> HERE(case  jsf-extensions  is there) I see a try a second call to constructor of SeamPhaseListener <<
      loadClass(com.sun.faces.application.ApplicationFactoryImpl)
      loadClass(org.jboss.seam.jsf.SeamApplicationFactory)
      loadClass(com.sun.faces.vendor.GlassFishInjectionProvider)





      That’s all the info I can give you.
      I’m really in trouble because if I put Jsf-extension out the Woodstock part of the application is dead !!
      I don’t know what is the problem source but the symptom is that this very one jar is causing something wrong :
      We can have multiple phase listener , right ?
      why is the presence of jsf-extension causing a second call on SeamPhaseListener ??


      Is it a problem on seam side or on jsf-extension side or maybe in org.ajax4jsf.event.InitPhaseListener)??? (as  glassfish logs shows).


      Thanks if you can help.


      Regards,



      For info here is the call chain of the moment constructor is called (the stack call is EXACTLY the SAME on 1st and 2nd call)
      (I obtain this by including a try/catch in the constructor of  SeamPhaseListener; throwing a dumb exception for capturing the stack trace and build the jar.)



      at org.jboss.seam.jsf.SeamPhaseListener.\<init\>(SeamPhaseListener.java:104)
                      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
                      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
                      at java.lang.Class.newInstance0(Class.java:355)
                      at java.lang.Class.newInstance(Class.java:308)
                      at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:825)
                      at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:486)
                      at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:381)
                      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4523)
                      at org.apache.catalina.core.StandardContext.start(StandardContext.java:5184)
                      at com.sun.enterprise.web.WebModule.start(WebModule.java:326)
                      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:973)
                      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:957)
                      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:688)
                      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1584)
                      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1222)
                      at com.sun.enterprise.web.WebContainer.loadJ2EEApplicationWebModules(WebContainer.java:1147)
                      at com.sun.enterprise.server.TomcatApplicationLoader.doLoad(TomcatApplicationLoader.java:141)
                      at com.sun.enterprise.server.AbstractLoader.load(AbstractLoader.java:244)
                      at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:336)
                      at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:230)
                      at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:203)
                      at com.sun.enterprise.server.ApplicationManager.applicationEnabled(ApplicationManager.java:763)
                      at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeApplicationDeployEventListener(AdminEventMulticaster.java:934)
                      at com.sun.enterprise.admin.event.AdminEventMulticaster.handleApplicationDeployEvent(AdminEventMulticaster.java:912)
                      at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:461)
                      at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:176)
                      at com.sun.enterprise.admin.server.core.AdminNotificationHelper.sendNotification(AdminNotificationHelper.java:141)
                      at com.sun.enterprise.admin.server.core.ConfigInterceptor.postInvoke(ConfigInterceptor.java:122)
                      at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:110)
                      at $Proxy1.setAttribute(Unknown Source)
                      at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.setAttribute(SunoneInterceptor.java:329)
                      at com.sun.enterprise.interceptor.DynamicInterceptor.setAttribute(DynamicInterceptor.java:212)
                      at com.sun.enterprise.management.support.DelegateToMBeanDelegate.setAttribute(DelegateToMBeanDelegate.java:149)
                      at com.sun.enterprise.management.support.MappedDelegate.setAttribute(MappedDelegate.java:264)
                      at com.sun.enterprise.management.support.AMXImplBase.setAttributeInternal(AMXImplBase.java:1342)
                      at com.sun.enterprise.management.support.AMXImplBase.setAttribute(AMXImplBase.java:1280)
                      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.setAttribute(DefaultMBeanServerInterceptor.java:762)
                      at com.sun.jmx.mbeanserver.JmxMBeanServer.setAttribute(JmxMBeanServer.java:699)
                      at com.sun.enterprise.interceptor.DynamicInterceptor.setAttribute(DynamicInterceptor.java:216)
                      at com.sun.appserv.management.util.jmx.MBeanProxyHandler.setAttribute(MBeanProxyHandler.java:475)
                      at com.sun.appserv.management.util.jmx.MBeanProxyHandler.invoke(MBeanProxyHandler.java:609)
                      at com.sun.appserv.management.client.handler.AMXProxyHandler._invoke(AMXProxyHandler.java:1113)
                      at com.sun.appserv.management.client.handler.AMXProxyHandler.invoke(AMXProxyHandler.java:1024)
                      at $Proxy57.setEnabled(Unknown Source)
                      at com.sun.enterprise.tools.admingui.util.TargetUtil.setApplicationEnabled(TargetUtil.java:253)
                      at com.sun.enterprise.tools.admingui.util.TargetUtil.setApplicationEnabled(TargetUtil.java:235)
                      at com.sun.enterprise.tools.admingui.handlers.ApplicationHandlers.changeAppStatus(ApplicationHandlers.java:937)
                      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:597)
                      at com.sun.jsftemplating.layout.descriptors.handler.Handler.invoke(Handler.java:421)
                      at com.sun.jsftemplating.layout.descriptors.LayoutElementBase.dispatchHandlers(LayoutElementBase.java:343)
                      at com.sun.jsftemplating.layout.descriptors.LayoutElementBase.dispatchHandlers(LayoutElementBase.java:317)
                      at com.sun.jsftemplating.layout.event.CommandActionListener.invokeCommandHandlers(CommandActionListener.java:133)
                      at com.sun.jsftemplating.layout.event.CommandActionListener.processAction(CommandActionListener.java:81)
                      at javax.faces.event.ActionEvent.processListener(ActionEvent.java:77)
                      at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:746)
                      at javax.faces.component.UICommand.broadcast(UICommand.java:368)
                      at com.sun.webui.jsf.component.WebuiCommand.broadcast(WebuiCommand.java:160)
                      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
                      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
                      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
                      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                      at com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.execute(PartialTraversalLifecycle.java:80)
                      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                      at com.sun.enterprise.tools.admingui.servlet.DelayedInitFacesServlet.service(DelayedInitFacesServlet.java:89)
                      at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
                      at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:240)
                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
                      at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
                      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
                      at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
                      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
                      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
                      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
                      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
                      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
                      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
                      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
                      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
                      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
                      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
                      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
                      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
                      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
                      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
                      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
                      at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
                      at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
                      at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
                      at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
                      at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
                      at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
                      at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
                      at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:116)

      _