Struts2:ConfigurationManager 和/或 Configuration 不应为空

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

我正在从 struts1 迁移到 struts2,并收到以下错误。我没有任何解决方案从哪里开始以及如何解决它。构建成功,用tomcat启动webapp后,出现此错误,部署失败:

SCHWERWIEGEND [http-nio-8184-exec-6] org.apache.catalina.core.StandardContext.filterStart Ausnahme beim Starten des Filters [struts2]
    ConfigurationManager and/or Configuration should not be null - Class: org.apache.struts2.dispatcher.Dispatcher
File: Dispatcher.java
Method: getContainer
Line: 1162 - org/apache/struts2/dispatcher/Dispatcher.java:1162:-1

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
         version="2.4">

    <display-name>xxx</display-name>
    
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>WEB-INF/struts.xml</param-value>
        </init-param>
        <init-param>
            <param-name>log4j-init-file</param-name>
            <param-value>WEB-INF/classes/log4j2.xml</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
  

    <servlet>
        <servlet-name>InitActionServlet</servlet-name>
        <servlet-class>Utilities.InitActionServlet</servlet-class>
        <init-param>
            <param-name>mailhost</param-name>
            <param-value>localhost</param-value>
        </init-param>
        <init-param>
            <param-name>mailhost-port</param-name>
            <param-value>2525</param-value>
        </init-param>
        <init-param>
        <init-param>
            <param-name>CommonSecret</param-name>
            <param-value>xxx</param-value>
        </init-param>     
        <init-param>
            <param-name>
                xxx
            </param-name>
            <param-value>
                http://localhost:8084/xxx
            </param-value>
        </init-param>
        <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>InitActionServlet</servlet-name>
        <url-pattern>/initAction</url-pattern>
    </servlet-mapping>
         
    <welcome-file-list>
        <welcome-file>
            index.jsp
        </welcome-file>
    </welcome-file-list>
    
    <security-constraint>
        <display-name>xxx</display-name>
        <web-resource-collection>
            <web-resource-name>xxx</web-resource-name>
            <description>protected resources</description>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>xxx</role-name>
            <role-name>xxx</role-name>
        </auth-constraint>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>

    <login-config>
        <auth-method>BASIC</auth-method>
    </login-config>

    <security-role>
        <description>xxx</description>
        <role-name>xxx</role-name>
    </security-role>
    <security-role>
        <description>xxx</description>
        <role-name>xxx</role-name>
    </security-role>

    <distributable/>
</web-app>

提前致谢!

如何修复此错误的解决方案和解释。

java struts2 struts struts-1
1个回答
0
投票

config
不是
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
的有效初始化参数。找不到适合您的应用程序的配置。您应该阅读更多有关
suruts.xml
的信息:

框架的核心配置文件是默认 (

struts.xml
) 文件,应驻留在 Web 应用程序的类路径上(通常是
/WEB-INF/classes
)。

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