严重: Exception starting filter struts2
Unable to load configuration. - [unknown location]
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.FilterDispatcher.init(FilterDispatcher.java:190)
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:3709)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
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:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: Unable to locate parent package [default] - [unknown location]
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.getPackageConfig(PackageBasedActionConfigBuilder.java:766)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:447)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:278)
at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:52)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:200)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
... 30 more
2010-7-7 10:31:37 org.apache.catalina.core.StandardContext start
严重: Error filterStart
web。xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>JspSupportServlet</servlet-name>
<servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<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>
</web-app>
13 个解决方案
#1
经我测试和排除错误,在web.xml中,如果去掉如下就没报错。
<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>
<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>
#2
你的struts版本和filter 配置的一致吗?
#3
我用的是struts2.1.6
#4
是过滤器的问题
#5
过滤器哪里有问题?如何修改呢?请指导,谢谢!
#6
你可以让你写的filter继承struts2的核心包然后在web.xml中配置上自己的代替struts2本身的过滤器
#7
我直接用struts2的包做过滤器也没问题吧,我看到很多资料都是这样配struts2的
#8
错误说是无法找到父包, 是不是你struts.xml中配置有误?
#9
struts.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<include file="struts-default.xml" />
</struts>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<include file="struts-default.xml" />
</struts>
#10
struts.xml我只配了<include file="struts-default.xml" />
#11
2.1.x不用引入这个文件了.!
#12
问题解决了,多谢各位热心朋友的相助和指导!
这个问题我花了一整天的时间去解决,浪费了不少时间。经过不断的测试和排除问题,我终于找到了原因,问是我个人太粗心了,在action中返回jsp页面时附加了一个type=“jsp”,jsp可以省去这个的。
这个问题我花了一整天的时间去解决,浪费了不少时间。经过不断的测试和排除问题,我终于找到了原因,问是我个人太粗心了,在action中返回jsp页面时附加了一个type=“jsp”,jsp可以省去这个的。
#13
@Action(value = "/getBookInfo", results = { @Result(name = "bookInfoIndex", type="jsp",location = "/indiv/bookInfo.jsp") })
这是我在action中写的action返回注解。
正确应该是:@Action(value = "/getBookInfo", results = { @Result(name = "bookInfoIndex", location = "/indiv/bookInfo.jsp") })
改好后就没错了
这是我在action中写的action返回注解。
正确应该是:@Action(value = "/getBookInfo", results = { @Result(name = "bookInfoIndex", location = "/indiv/bookInfo.jsp") })
改好后就没错了
#1
经我测试和排除错误,在web.xml中,如果去掉如下就没报错。
<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>
<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>
#2
你的struts版本和filter 配置的一致吗?
#3
我用的是struts2.1.6
#4
是过滤器的问题
#5
过滤器哪里有问题?如何修改呢?请指导,谢谢!
#6
你可以让你写的filter继承struts2的核心包然后在web.xml中配置上自己的代替struts2本身的过滤器
#7
我直接用struts2的包做过滤器也没问题吧,我看到很多资料都是这样配struts2的
#8
错误说是无法找到父包, 是不是你struts.xml中配置有误?
#9
struts.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<include file="struts-default.xml" />
</struts>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<include file="struts-default.xml" />
</struts>
#10
struts.xml我只配了<include file="struts-default.xml" />
#11
2.1.x不用引入这个文件了.!
#12
问题解决了,多谢各位热心朋友的相助和指导!
这个问题我花了一整天的时间去解决,浪费了不少时间。经过不断的测试和排除问题,我终于找到了原因,问是我个人太粗心了,在action中返回jsp页面时附加了一个type=“jsp”,jsp可以省去这个的。
这个问题我花了一整天的时间去解决,浪费了不少时间。经过不断的测试和排除问题,我终于找到了原因,问是我个人太粗心了,在action中返回jsp页面时附加了一个type=“jsp”,jsp可以省去这个的。
#13
@Action(value = "/getBookInfo", results = { @Result(name = "bookInfoIndex", type="jsp",location = "/indiv/bookInfo.jsp") })
这是我在action中写的action返回注解。
正确应该是:@Action(value = "/getBookInfo", results = { @Result(name = "bookInfoIndex", location = "/indiv/bookInfo.jsp") })
改好后就没错了
这是我在action中写的action返回注解。
正确应该是:@Action(value = "/getBookInfo", results = { @Result(name = "bookInfoIndex", location = "/indiv/bookInfo.jsp") })
改好后就没错了