tomcat报严重: Exception starting filter struts2

时间:2022-12-01 18:27:26
Unable to load configuration. - [unknown location]
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:502)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3696)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: Unable to load configuration. - [unknown location]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
... 19 more
Caused by: Parent package is not defined: jasperreports-default - [unknown location]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildPackageContext(XmlConfigurationProvider.java:670)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:519)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:292)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:250)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 21 more

5 个解决方案

#1


把配置文件贴出来看看

#2


<!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,jasperreports-default">
<action name="PDF" class="com.sterning.JasperAction">
<result name="success" type="jasper">
<param name="location">
/jasper/compiled_jasper_template.jasper
</param>
<param name="dataSource">myList</param>
<param name="format">PDF</param>
</result>
</action>
<action name="HTML" class="com.sterning.JasperAction">
<result name="success" type="jasper">
<param name="location">
/jasper/compiled_jasper_template.jasper
</param>
<param name="dataSource">myList</param>
<param name="format">HTML</param>
</result>
</action>
<action name="XML" class="com.sterning.JasperAction">
<result name="success" type="jasper">
<param name="location">
/jasper/compiled_jasper_template.jasper
</param>
<param name="dataSource">myList</param>
<param name="format">XML</param>
</result>
</action>
<action name="CSV" class="com.sterning.JasperAction">
<result name="success" type="jasper">
<param name="location">
/jasper/compiled_jasper_template.jasper
</param>
<param name="dataSource">myList</param>
<param name="format">CSV</param>
</result>
</action>
<action name="XLS" class="com.sterning.JasperAction">
<result name="success" type="jasper">
<param name="location">
/jasper/compiled_jasper_template.jasper
</param>
<param name="dataSource">myList</param>
<param name="format">XLS</param>
</result>
</action>
</package>
</struts>

#3


引用 1 楼 shixitong 的回复:
把配置文件贴出来看看

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

<!-- The Welcome File List -->
  <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>
</web-app>

#4


jasperreports对应的jar包都有吧?

#1


把配置文件贴出来看看

#2


<!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,jasperreports-default">
<action name="PDF" class="com.sterning.JasperAction">
<result name="success" type="jasper">
<param name="location">
/jasper/compiled_jasper_template.jasper
</param>
<param name="dataSource">myList</param>
<param name="format">PDF</param>
</result>
</action>
<action name="HTML" class="com.sterning.JasperAction">
<result name="success" type="jasper">
<param name="location">
/jasper/compiled_jasper_template.jasper
</param>
<param name="dataSource">myList</param>
<param name="format">HTML</param>
</result>
</action>
<action name="XML" class="com.sterning.JasperAction">
<result name="success" type="jasper">
<param name="location">
/jasper/compiled_jasper_template.jasper
</param>
<param name="dataSource">myList</param>
<param name="format">XML</param>
</result>
</action>
<action name="CSV" class="com.sterning.JasperAction">
<result name="success" type="jasper">
<param name="location">
/jasper/compiled_jasper_template.jasper
</param>
<param name="dataSource">myList</param>
<param name="format">CSV</param>
</result>
</action>
<action name="XLS" class="com.sterning.JasperAction">
<result name="success" type="jasper">
<param name="location">
/jasper/compiled_jasper_template.jasper
</param>
<param name="dataSource">myList</param>
<param name="format">XLS</param>
</result>
</action>
</package>
</struts>

#3


引用 1 楼 shixitong 的回复:
把配置文件贴出来看看

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

<!-- The Welcome File List -->
  <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>
</web-app>

#4


jasperreports对应的jar包都有吧?

#5