当前位置: 首页 > 面试题库 >

异常启动过滤器struts2无法加载配置。\- 豆

上官培
2023-03-14
问题内容

嗨,我是Struts的新手,试图在Struts中打招呼,但我遇到了错误。我正在尝试将其修复,但无法执行。错误消息是

EVERE: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/home/sudarshan/Desktop/RestFullTuts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/struts2starter/WEB-INF/lib/struts2-portlet-plugin-2.3.28.jar!/struts-plugin.xml:31:133
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4574)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5193)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: Unable to load configuration. - bean - jar:file:/home/sudarshan/Desktop/RestFullTuts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/struts2starter/WEB-INF/lib/struts2-portlet-plugin-2.3.28.jar!/struts-plugin.xml:31:133
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
    at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:970)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:438)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:482)
    ... 14 more

我的struts.xml档案是

<!DOCTYPE struts PUBLIC  
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"  
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>

    <package name="default" extends="struts-default">

        <action name="getTutorial" class="com.sudarshan.action.TutorialAction">

            <result name="success">success.jsp</result>
            <result name="failure">error.jsp</result>
        </action>


    </package>
</struts>

Web.xml是

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
    id="WebApp_ID" version="3.1">
    <display-name>struts2starter</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <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>
</web-app>

那么该代码的解决方案是什么。


问题答案:

struts2-portlet-plugin-2.3.28.jar从类路径中删除。但是对于管理库的解决方案,您可以使用Maven。

请参阅使用Maven构建的教程:使用Maven 创建Struts 2
Web应用程序以管理工件和构建应用程序

随下载的最小依赖项

<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>2.3.28</version>
</dependency>


 类似资料:
  • 我正在尝试使用wicket创建一个web应用程序。以下是我遵循的步骤: > < li> 我使用以下命令创建了一个maven项目: mvn原型:generate-DarchetypeGroupId=org.apache。wicket-DarchetypeArtifactId=wicket原型快速启动-DarchetypeVersion=6.6.0-DgroupId=com。mycompany-Dar

  • 问题内容: 对于这个先前的问题,我将Selenium更新为2.0.1版,但是现在我又遇到了另一个错误,即使配置文件位于以下位置: 怎么了?我该如何解决这个问题? 问题答案: 更新: 硒团队已修复最新版本。对于几乎所有环境,修复程序都是: 点安装-U硒 尚不清楚它是在哪个版本上修复的(显然是r13122),但肯定是在2.26.0(更新时为最新)上已修复。 此错误意味着_wait_until_conn

  • 我在启动标准Eclipse Neon IDE时遇到问题。我正在使用Javajdk 1.8.0运行Eclipse Neon 1。重新启动我的计算机后,Eclipse将无法启动(上次使用期间没有安装新的插件/软件)。我尝试删除,但它仍然无法启动。请帮助。 附言。日志的日期似乎已关闭;我不确定为什么,但这是此日志文件中唯一的。 这是

  • 异常过滤器 With Nest you can move exception handling logic to special classes called Exception Filters. 你可以使用Nest将异常处理逻辑移动到异常过滤器的特殊类中。 How it works? 怎么运行呢? Let's take a look at the following code: 让我们来看看下面

  • 我正在使用Spring Boot版本2.1.9。带有Web、会话、安全、jdbc和jpa启动器的RELEASE。在我的应用程序中一切正常,直到我尝试覆盖默认会话超时值,application.properties中有以下行: 如果添加这一行,在启动Spring时,我会得到以下错误: 我还尝试了不同的格式,如180s或PT180S,但都不起作用。根据Spring文档或同一文档的其他变体,只有整数的版