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

问题描述 投票:0回答:1

我是maven的新手,我正在尝试使用struts2,Hibernate和spring3构建一个应用程序。

当我尝试在tomcat服务器上部署我的应用程序时,我得到以下错误。

SEVERE: Exception starting filter struts2
Unable to load configuration. - action - file:/C:/Prashant/WorkSpace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/EmployeeManagementSystem/WEB-INF/classes/struts.xml:17:64
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:48)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4461)
    at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5133)
    at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5128)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: Action class [dispEmployeeAction] not found - action - file:/C:/Prashant/WorkSpace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/EmployeeManagementSystem/WEB-INF/classes/struts.xml:17:64
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:405)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:355)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:460)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:265)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:189)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    ... 16 more
14 Apr, 2013 1:58:28 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
14 Apr, 2013 1:58:28 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/EmployeeManagementSystem] startup failed due to previous errors
14 Apr, 2013 1:58:28 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext

此错误消息表示未找到Action类[dispEmployeeAction] - action - file:/ C:/Prashant/WorkSpace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/EmployeeManagementSystem/WEB-INF /classes/struts.xml:17:64但是在我的struts.xml中,我有这个映射的动作如下。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>

    <constant name="struts.enable.DynamicMethodInvocation" value="flase"></constant>
    <constant name="struts.devMode" value="true"></constant>

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

        <interceptors>
            <interceptor name="myInterceptor" class="action.MyInterceptor"></interceptor>
        </interceptors>

        <!-- For Employee Action mapping -->
        <action name="dispEmployeeAction" class="dispEmployeeAction">
            <result name="success">/employee_add.jsp</result>
        </action>

        <action name="employeeAction" class="employeeAction">
            <result name="input">/employee_add.jsp</result>
            <result name="list">/employee_list.jsp</result>
        </action>

        <action name="dispEmployeeListAction" class="dispEmployeeListAction">
            <result name="success">/employee_list.jsp</result>
        </action>

        <action name="employeeListAction" class="employeeListAction">
            <result name="success">/employee_list.jsp</result>
            <result name="new">/employee_add.jsp</result>
        </action>

    </package>
</struts>

和pom.xml如下

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>EmployeeManagementSystem</groupId>
    <artifactId>EmployeeManagementSystem</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>EmployeeManagementSystem</name>
    <description>EmployeeManagementSystem</description>
    <dependencies>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.5.4-Final</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>2.1.6</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-dojo-plugin</artifactId>
            <version>2.3.8</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>3.2.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>3.2.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>3.2.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>3.2.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>3.2.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>3.2.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>3.2.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>3.2.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-hibernate3</artifactId>
            <version>2.0.7</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>           
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.24</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.5.8</version>
        </dependency>
        <dependency>
            <groupId>javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>3.12.1.GA</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-tiles-plugin</artifactId>
            <version>2.3.8</version>
        </dependency>
    </dependencies>
</project>
java spring hibernate maven struts2
1个回答
0
投票

您已将Struts 2 jar放在Tomcat库目录中:

引起:bean类型类com.opensymphony.xwork2.ObjectFactory的名称为xwork已经被bean加载 - jar:file:/ C:/apache-tomcat-7.0.25-windows-x86/apache-tomcat-7.0。 25 / lib目录/ Struts2的核心 - 2.3.4.1.jar /struts-default.xml:29:72

从servlet容器中删除与Struts相关的库;仅使用您的应用部署它们。

© www.soinside.com 2019 - 2024. All rights reserved.