struts2中,在tomcat启动时候总是出现严重: “严重: Exception starting filter str”错误,求高手帮忙解答下是怎么原因?
信息: Parsing configuration file [struts.xml]2011-12-29 20:12:21 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
严重: Dispatcher initialization failed
Unable to load configuration. - action - file:/C:/Program%20Files/Apache%20Software%20Foundation/apache-tomcat-6.0.33/webapps/Tongxunlu/WEB-INF/classes/struts.xml:5:65
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(严重: Exception starting filter struts2
Unable to load configuration. - action - file:/C:/Program%20Files/Apache%20Software%20Foundation/apache-tomcat-6.0.33/webapps/Tongxunlu/WEB-INF/classes/struts.xml:5:65
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1385)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1389)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642)
at java.lang.Thread.run(Thread.java:619)
Caused by: Unable to load configuration. - action - file:/C:/Program%20Files/Apache%20Software%20Foundation/apache-tomcat-6.0.33/webapps/Tongxunlu/WEB-INF/classes/struts.xml:5:65
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
... 21 more
Caused by: Action class [com.addressbook.Action.UserAction] not found - action - file:/C:/Program%20Files/Apache%20Software%20Foundation/apache-tomcat-6.0.33/webapps/Tongxunlu/WEB-INF/classes/struts.xml:5:65
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:409)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:354)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:468)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:264)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
... 23 more
2011-12-29 20:12:21 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2011-12-29 20:12:21 org.apache.catalina.core.StandardContext start
严重: Context [/Tongxunlu] startup failed due to previous errors
过滤结束2011-12-29 20:12:21 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
严重: The web application [/Tongxunlu] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@1689e12]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@161b9b2]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
2011-12-29 20:12:21 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
严重: The web application [/Tongxunlu] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@16a6597]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@33a25b]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
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>
<package name="struts" extends="struts-default">
<action name="regist" class="com.addressbook.Action.UserAction">
<result name="success">/UserServlet</result>
<result name="input">/regist.jsp</result>
</action>
</package>
</struts>
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">
<filter>
<filter-name>Filter</filter-name>
<filter-class>com.addressbook.filter.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<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>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>CheckUser</servlet-name>
<servlet-class>com.addressbook.servlet.CheckUser</servlet-class>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>UserServlet</servlet-name>
<servlet-class>com.addressbook.servlet.UserServlet</servlet-class>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>AdminLoginServlet</servlet-name>
<servlet-class>com.addressbook.servlet.AdminLoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CheckUser</servlet-name>
<url-pattern>/CheckUser</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>UserServlet</servlet-name>
<url-pattern>/UserServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AdminLoginServlet</servlet-name>
<url-pattern>/AdminLoginServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
--------------------编程问答-------------------- WEB-INF/classes/struts.xml:5:65
这行是啥,配置文件里的类加载失败~ --------------------编程问答-------------------- Caused by: Action class [com.addressbook.Action.UserAction] not found
文件路径最好不要包含中文......你现在的路径有中文,改掉路径试试! --------------------编程问答-------------------- Unable to load configuration. - action - file:/C:/Program%20Files/Apache%20Software%20Foundation/apache-tomcat-6.0.33/webapps/Tongxunlu/WEB-INF/classes/struts.xml:5:65
这个路径不对吧 --------------------编程问答-------------------- Unable to load configuration. - action - file:/C:/Program%20Files/Apache%20Software%20Foundation/apache-tomcat-6.0.33/webapps/Tongxunlu/WEB-INF/classes/struts.xml:5:65
楼主看看 --------------------编程问答-------------------- 应该是struts.xml里的这<action name="regist" class="com.addressbook.Action.UserAction">路径不对吧,里面怎么出现两个大写字母,包名应该都是小写,是不是多写了个Action或是写错了 --------------------编程问答-------------------- 换个tomcat版本看看 --------------------编程问答-------------------- Caused by: Action class [com.addressbook.Action.UserAction] not found
找不到这个类com.addressbook.Action.UserAction 是不是写错了 --------------------编程问答--------------------
补充:Java , Java EE