gpt4 book ai didi

java - 异常启动过滤器 Struts 2

转载 作者:行者123 更新时间:2023-11-28 22:20:24 24 4
gpt4 key购买 nike

我正在尝试使用注释和 Maven 设置我的第一个 struts 2 应用程序。我正在关注这个例子 struts2 annotations example

当我尝试在 tomcat 服务器 7 上运行该应用程序时出现此异常

    Grave: Exception startin filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter. StrutsPrepareAndExecuteFilter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:529)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:511)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:139)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

avr. 14, 2014 10:40:05 AM org.apache.catalina.core.StandardContext startInternal
Grave: Error filterStart
avr. 14, 2014 10:40:05 AM org.apache.catalina.core.StandardContext startInternal
Grave: Erreur de démarrage du contexte [/StrutsAnnotationsExample] suite aux erreurs précédentes
avr. 14, 2014 10:40:05 AM org.apache.coyote.AbstractProtocol start
Infos: Starting ProtocolHandler ["http-bio-8080"]
avr. 14, 2014 10:40:05 AM org.apache.coyote.AbstractProtocol start
Infos: Starting ProtocolHandler ["ajp-bio-8009"]
avr. 14, 2014 10:40:05 AM org.apache.catalina.startup.Catalina start
Infos: Server startup in 991 ms

任何人都可以帮助或告诉我我错过了什么吗?

最佳答案

教程中的代码看起来像是一个拼写错误。在 web.xml 中使用以下内容

<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

关于java - 异常启动过滤器 Struts 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23057096/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com