Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-5110

java.lang.ClassCastException: org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter cannot be cast to jakarta.servlet.Filter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.5.26
    • 2.6.1
    • Integration
    • None

    Description

       StrutsPrepareAndExecuteFilter  is not compatible with jakarta servlet package

      in Web.xml

      <filter>   
         <filter-name>struts2</filter-name>   
       <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class> 
       </filter>
       <filter-mapping>}}
       <filter-name>struts2</filter-name>
       <url-pattern>/*</url-pattern> 
       </filter-mapping>

       

      starting TOMCAT 10.0.0:

      java.lang.ClassCastException: org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter cannot be cast to jakarta.servlet.Filter 

      27-Dec-2020 12:27:01.005 [main] org.apache.catalina.core.StandardContext.filterStart Exception starting filter [struts2]
      java.lang.ClassCastException: org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter cannot be cast to jakarta.servlet.Filter
      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:250)
      at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
      at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4515)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5152)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:706)
      at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:631)
      at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1830)
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
      at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
      at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:526)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:425)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1576)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
      at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
      at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
      at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:936)
      at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:843)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
      at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
      at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
      at org.apache.catalina.core.StandardService.startInternal(StandardService.java:434)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
      at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:795)
      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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:342)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
      27-Dec-2020 12:27:01.767 INFORMAZIONI [main] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
      27-Dec-2020 12:27:01.767 INFORMAZIONI [main] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
      27-Dec-2020 12:27:01.768 INFORMAZIONI [main] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('StockTicker', 'async.Stockticker@28a16598')

      Attachments

        Activity

          People

            Unassigned Unassigned
            rsorrt Rsorrt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: