Chinaunix首页 | 论坛 | 博客

acc

  • 博客访问: 802617
  • 博文数量: 170
  • 博客积分: 7011
  • 博客等级: 少将
  • 技术积分: 1660
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-31 12:02
文章分类

全部博文(170)

文章存档

2014年(7)

2010年(2)

2009年(62)

2008年(25)

2007年(67)

2006年(7)

我的朋友

分类: Java

2009-03-19 16:40:11

使用MyEclipse 7.0做了一个Struts HelloWorld ,过程虽简单,无奈老出问题,经过多次测试,终于找到问题症结。

 

1.类库包:

commons-logging-1.0.4.jar

freemarker-2.3.13.jar

ognl-2.6.11.jar

struts2-core-2.1.6.jar

xwork-2.1.2.jar

 

2web.xml

         first Struts 2 Project

   

        struts2

        org.apache.struts2.dispatcher.FilterDispatcher

   

   

        struts2

        /*

   

 

3index.jsp

<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib prefix="s" uri="/struts-tags" %>

HelloWorld

 

就以上几个文件,在启动Tomcat时老是报异常如下:

严重: Exception starting filter struts2

Unable to load configuration. - bean - jar:file:/D:/Tomcat6.0/webapps/ss/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.(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(Unknown Source)

         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

         at java.lang.reflect.Method.invoke(Unknown Source)

         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:/D:/Tomcat6.0/webapps/ss/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)

         ... 30 more

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

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

         at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)

         at java.lang.Class.getDeclaredConstructors(Unknown Source)

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

         ... 33 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(Unknown Source)

         ... 37 more

2009-3-19 16:28:14 org.apache.catalina.core.StandardContext start

严重: Error filterStart

 

 

解决方法:

由于类库中缺少:commons-fileupload-1.2.1.jar

只需加上,一切将变得正常。呵呵。

阅读(7780) | 评论(13) | 转发(0) |
0

上一篇:春江花月夜

下一篇:看人家的思维多发散

给主人留下些什么吧!~~

chinaunix网友2011-04-20 10:43:40

这个包我有,但还是报错。

chinaunix网友2010-07-23 16:56:43

非常感谢 ,确实如博主所说

chinaunix网友2010-06-03 13:51:30

但是这个问题还是没解决。 怎么办啊? 我用的是Tomcat6.0 + Struts2.1.8.1

chinaunix网友2010-04-14 20:20:48

非常感谢 ,确实如博主所说,今天也困扰我一天了哦

chinaunix网友2010-04-06 16:00:21

struts过滤器配置错误 org.apache.struts2.dispatcher.FilterDispatcher