Struts2配置异常:Exception starting filter struts2

开发环境:JDK6+tomcat6+struts-2.1.6(最新)
(tomcat一定是5.5以上,jdk为1.5以上)
struts2下载地址:http://struts.apache.org/

最基本的小程序用到jar包,struts2-core.jar,commons-logging.jar,freemarker.jar,ognl.jar,xwork.jar
(注意了:struts2-core-2.1.6.jar时要附加上两个包,commons-fileupload.jar 和 commons-io.jar )
还有了在配置web.xml文件时记得不要在用这个过滤器了,

<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>,
新版本中都是过时的了,采取该过滤器,
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>。

安装实例配置好以后,开始运行,可是出现一下错误:

严重: Exception starting filter struts2

Unable to load configuration. - bean - jar:file:/E:/struts2/struts2/WebRoot/WEB-INF/lib/struts2-core-2.1.6.jar!/struts-default.xml:46:178

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.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: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 load bean: type:org.apache.struts2.dispatcher.multipart.MultiPartRequest class:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean - jar:file:/E:/struts2/struts2/WebRoot/WEB-INF/lib/struts2-core-2.1.6.jar!/struts-default.xml:46:178

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:222)

at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)

at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:165)

at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)

... 21 more

Caused by: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException

at java.lang.Class.getDeclaredConstructors0(Native Method)

at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)

at java.lang.Class.getDeclaredConstructors(Class.java:1836)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:212)

... 24 more

Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

... 28 more

2009-2-16 15:07:42 org.apache.catalina.core.StandardContext start

严重: Error filterStart

2009-2-16 15:07:42 org.apache.catalina.core.StandardContext start

严重: Context [/struts2] startup failed due to previous errors
错误中指明struts-default.xml:46:178,struts2-core.jar包中的struts-default文件的46行有问题,于是我打开struts-default.xml,46行为:
<bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="struts" class="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest" scope="default"/>
发现要加载org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest。查看这个类的源文件

其中前面有这样几句 :
package org.apache.struts2.dispatcher.multipart;
import java.io.File;

import java.io.IOException;

import java.io.InputStream;

import java.util.ArrayList;

import java.util.Collections;

import java.util.Enumeration;

import java.util.HashMap;

import java.util.List;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.fileupload.FileItem;

import org.apache.commons.fileupload.FileUploadException;

import org.apache.commons.fileupload.RequestContext;

import org.apache.commons.fileupload.disk.DiskFileItem;

import org.apache.commons.fileupload.disk.DiskFileItemFactory;

import org.apache.commons.fileupload.servlet.ServletFileUpload;

import org.apache.struts2.StrutsConstants;

import com.opensymphony.xwork2.inject.Inject;

import com.opensymphony.xwork2.util.logging.Logger;

import com.opensymphony.xwork2.util.logging.LoggerFactory;

public class JakartaMultiPartRequest implements MultiPartRequest {

//下面略

在这个类中必须引入org.apache.commons.fileupload.*;

而错误也许没有加载这个文件上传包所以找不到类 。

于是我就把commons-fileupload-1.2.1.jar 和 commons-io-1.3.2.jar 导入,结果错误解决了。

 

还有一点,是要将commons-fileupload-1.2.1.jar中的fileupload修改为fileUpdate

这个报错要怎么解决?严重: Exception starting filter jranuan

07-05
项目运行时候报错信息 ![图片说明](https://img-ask.csdn.net/upload/201707/05/1499218285_692386.png) 严重: Exception starting filter jranuan java.lang.ClassCastException: com.jranuan.core.JRanuanFilter cannot be cast to javax.servlet.Filter at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748) 七月 05, 2017 9:11:04 上午 org.apache.catalina.core.StandardContext startInternal 严重: Error filterStart 七月 05, 2017 9:11:04 上午 org.apache.catalina.core.StandardContext startInternal 严重: Context [/drqSys] startup failed due to previous errors 七月 05, 2017 9:11:04 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc 严重: The web application [/drqSys] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 七月 05, 2017 9:11:04 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc 严重: The web application [/drqSys] registered the JDBC driver [com.alibaba.druid.mock.MockDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 七月 05, 2017 9:11:04 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc 严重: The web application [/drqSys] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 七月 05, 2017 9:11:04 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc 严重: The web application [/drqSys] registered the JDBC driver [com.mysql.fabric.jdbc.FabricMySQLDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 七月 05, 2017 9:11:04 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/drqSys] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. 七月 05, 2017 9:11:04 上午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-bio-8080"]

严重: Exception starting filter struts2 怎么解决?

12-01
启动Struts2项目时,报的这个错误。不过效果能够正常显示。可是,控制台为什么报了这个错误呢??不明白,看了好几个博主的解决方法也都不行,所以,有没有经历过这个问题的大神们,求解~ 严重: Exception starting filter struts2 Unable to load configuration. - action - file:/C:/Development/Tomcat-7.0/apache-tomcat-7.0.65/webapps/test-struts2-login/WEB-INF/classes/struts.xml:14:71 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:504) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4841) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5535) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1978) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: Unable to load configuration. - action - file:/C:/Development/Tomcat-7.0/apache-tomcat-7.0.65/webapps/test-struts2-login/WEB-INF/classes/struts.xml:14:71 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70) at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:978) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490) ... 18 more Caused by: Action class [com.aaa.action.ShowAction] not found - action - file:/C:/Development/Tomcat-7.0/apache-tomcat-7.0.65/webapps/test-struts2-login/WEB-INF/classes/struts.xml:14:71 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:486) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:429) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:556) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:295) at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:264) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) ... 21 more
©️2020 CSDN 皮肤主题: 大白 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值