8 Replies Latest reply on Mar 10, 2011 10:25 PM by Sandy Noa

    Servlet conflict in war deployment  (Seam and GWT)

    thierry accart Newbie

      Hi


      We're trying to include in a SEAM EAR project a part of google web toolkit (I think this problem would append on any servlet included in war part of ear)
      The war deployment fails, raising a java.lang.ClassCastException: org.jboss.seam.servlet.SeamFilter (see stacktrace hereafter).


      I think we've a conflict in url-patterns between the GWTServlet and the SeamFilter : in the web.xml they are defined as


      <servlet>
           <servlet-name>GWTServlet</servlet-name>
           <servlet-class>
                org.myCompany.calendarApp.gwt.server.ServiceImpl
           </servlet-class>
      </servlet>
      
      <servlet-mapping>
           <servlet-name>GWTServlet</servlet-name>
           <url-pattern>
                /Calendar/org.myCompany.calendarApp.gwt.CalendarApp/GWTServlet
           </url-pattern>
      </servlet-mapping>
      
      
      <filter>
          <filter-name>Seam Filter</filter-name>
          <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
      </filter>
      
      <filter-mapping>
          <filter-name>Seam Filter</filter-name>
          <url-pattern>/*</url-pattern>
      </filter-mapping>




      Has anyone ever encountered similar problem (and found a solution) ?


      I guess we could have a workaround by externalizing the GWT servlet in its own war, but it's not elegant, and I'd prefer to find a cleaner solution... all ideas are welcomed :)


      Rgds
      Thierry



      The stacktrace :


      11:15:28 ERROR (main:) [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/myapp/agendaviewer]] Exception starting filter Seam Filter
      java.lang.ClassCastException: org.jboss.seam.servlet.SeamFilter
           at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:255)
           at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
           at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
           at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3722)
           at org.apache.catalina.core.StandardContext.start(StandardContext.java:4367)
           at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:790)
           at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:770)
           at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
           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.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
           at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.apache.catalina.core.StandardContext.init(StandardContext.java:5312)
           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.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
           at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
           at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
           at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
           at org.jboss.web.WebModule.startModule(WebModule.java:83)
           at org.jboss.web.WebModule.startService(WebModule.java:61)
           at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
           at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
           at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
           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.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
           at $Proxy0.start(Unknown Source)
           at org.jboss.system.ServiceController.start(ServiceController.java:417)
           at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
           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.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           at $Proxy44.start(Unknown Source)
           at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
           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.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
           at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
           at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
           at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
           at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
           at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           at $Proxy45.start(Unknown Source)
           at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
           at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
           at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
           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.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           at $Proxy9.deploy(Unknown Source)
           at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
           at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
           at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
           at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
           at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
           at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
           at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
           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.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
           at $Proxy0.start(Unknown Source)
           at org.jboss.system.ServiceController.start(ServiceController.java:417)
           at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
           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.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           at $Proxy4.start(Unknown Source)
           at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
           at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
           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.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           at $Proxy5.deploy(Unknown Source)
           at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
           at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
           at org.jboss.Main.boot(Main.java:200)
           at org.jboss.Main$1.run(Main.java:508)
           at java.lang.Thread.run(Thread.java:595)
      11:15:28 ERROR (main:) [org.apache.catalina.core.StandardContext] Error filterStart



        • 1. Re: Servlet conflict in war deployment  (Seam and GWT)
          blabno Master

          This is class loading problem. Show your ear structure (in which directories each library resides). I bet you have two jboss-seam.jar archives packaged one in ear and one in war.

          • 2. Re: Servlet conflict in war deployment  (Seam and GWT)
            thierry accart Newbie

            Hi Bernard


            unfortunately, the war contains only jboss-seam- debug, ioc, mail, pdf, remoting and ui jars, and the ear contains only one jboss-seam.jar :)


            by the way, here's the debug log of catalina.core (if it can help)


            [ContainerBase] Add child StandardWrapper[Seam Resource Servlet] StandardEngine[jboss.web].StandardHost[localhost].StandardContext[/myapp/agendaviewer]
            [ContainerBase] Add child StandardWrapper[Faces Servlet] StandardEngine[jboss.web].StandardHost[localhost].StandardContext[/myapp/agendaviewer]
            [StandardContext] Configuring application event listeners
            [ContainerBase.[jboss.web].[localhost].[/myapp/agendaviewer]]  Configuring event listener class 'org.jboss.web.tomcat.security.SecurityFlushSessionListener'
            [ContainerBase.[jboss.web].[localhost].[/myapp/agendaviewer]]  Configuring event listener class 'org.jboss.web.jsf.integration.config.JBossJSFConfigureListener'
            [ContainerBase.[jboss.web].[localhost].[/myapp/agendaviewer]]  Configuring event listener class 'com.sun.faces.application.WebappLifecycleListener'
            [ContainerBase.[jboss.web].[localhost].[/myapp/agendaviewer]]  Configuring event listener class 'org.jboss.seam.servlet.SeamListener'
            [ContainerBase.[jboss.web].[localhost].[/myapp/agendaviewer]] Sending application start events
            [ContainerBase.[jboss.web].[localhost].[/myapp/agendaviewer]] Starting filters
            [ContainerBase.[jboss.web].[localhost].[/myapp/agendaviewer]]  Starting filter 'CommonHeadersFilter'
            [ContainerBase.[jboss.web].[localhost].[/myapp/agendaviewer]]  Starting filter 'Seam Filter'
            [ContainerBase.[jboss.web].[localhost].[/myapp/agendaviewer]] Exception starting filter Seam Filter


            • 3. Re: Servlet conflict in war deployment  (Seam and GWT)
              blabno Master

              The problem is that SeamFilter is loaded with different classloader then one of Catalina classes that loads that filter. javax.servlet.Filter resides in servlet-api.jar. Isn't it by any chance in your ear ? It may also appear in two locations in your server and gets loaded by different classloaders.

              • 4. Re: Servlet conflict in war deployment  (Seam and GWT)
                blabno Master

                Similar problem (SEAMAlfrescoAndWebDav) was solved. It was caused by presence of some jar containing javax.* classes in WEB-INF/lib. Show us the full list of libs included in your archive.

                • 5. Re: Servlet conflict in war deployment  (Seam and GWT)
                  thierry accart Newbie

                  Hi


                  I'm going to investigate on the javax.* in war, but to answer you request,
                  the war  contains  the folling jars in WEB-INF/lib :
                  commons-beanutils.jar
                  commons-digester.jar
                  commons-fileupload-1.2.jar
                  gwt-dnd-2.0.7.jar
                  gwt-user.jar
                  ical4j-1.0-beta4.jar
                  jboss-seam-debug.jar
                  jboss-seam-ioc.jar
                  jboss-seam-mail.jar
                  jboss-seam-pdf.jar
                  jboss-seam-remoting.jar
                  jboss-seam-ui.jar
                  jsf-facelets.jar
                  richfaces-impl.jar
                  richfaces-ui.jar


                  The ear contains
                  antlr-runtime.jar
                  drools-compiler.ja
                  drools-core.jar
                  jboss-el.jar
                  jboss-seam.jar
                  jbpm-jpdl.jar
                  mvel14.jar
                  richfaces-api.jar


                  The ejb contains only 2 jars :
                  gwt-servlet.jar
                  ical4j-1.0-beta4.jar


                  In addition, we have sources in EJB project and in WAR(gwt stuff)


                  I've a similar project that does not include gwt-servlet.jar
                  ical4j-1.0-beta4.jar
                  nor any custom servlet (GWTServlet) or custom classes in the war, that's working fine.



                  I'll post the solution... if I find any:-/

                  • 6. Re: Servlet conflict in war deployment  (Seam and GWT)
                    thierry accart Newbie

                    Bernard : you're great ! :-)


                    having a look in gwt-user.jar, guess what I found  ? 
                    javax.servlet.*  !!!


                    It's strange how better the deployment works after I removed those classes from gwt-user.jar :-)


                    Thanks for your help :)

                    • 7. Re: Servlet conflict in war deployment  (Seam and GWT)
                      ha kra Newbie

                      Thank you for explaining this problem so detailed!


                      I was very irritated when a new gwt-user.jar broke my seam app and this thread helped me fix it in like 5 minutes :)


                      • 8. Re: Servlet conflict in war deployment  (Seam and GWT)
                        Sandy Noa Newbie

                        Hi everybody, please expose your ideas right here:
                        http://gwtseam.blogspot.com/


                        forget the spanish.