`
lgsun592
  • 浏览: 54805 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

初次配置Struts2环境碰到的一系列问题汇总

阅读更多
开发环境
Eclipse:
       Eclipse Java EE IDE for Web Developers.
       Version: Helios Service Release 1
       Build id: 20100917-0705
Tomcat:
       apache-tomcat-6.0.16
Struts:
       struts-2.2.1.1

2011-1-6 0:04:30 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Struts2Demo' did not find a matching property.
2011-1-6 0:04:30 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_02\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk1.6.0_02/bin/../jre/bin/client;C:/Program Files/Java/jdk1.6.0_02/bin/../jre/bin;C:/Program Files/Java/jdk1.6.0_02/bin/../jre/lib/i386;C:\Program Files\PC Connectivity Solution\;C:\Program Files\Java\jdk1.6.0_02\bin;C:\Program Files\Java\jre1.6.0_02;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\EmEditor;C:\Program Files\TortoiseSVN\bin
2011-1-6 0:04:30 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2011-1-6 0:04:30 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 759 ms
2011-1-6 0:04:30 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2011-1-6 0:04:30 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.16
2011-1-6 0:04:30 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:249)
	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:4356)
	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)
2011-1-6 0:04:30 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2011-1-6 0:04:30 org.apache.catalina.core.StandardContext start
严重: Context [/Struts2Demo] startup failed due to previous errors
2011-1-6 0:04:30 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2011-1-6 0:04:30 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2011-1-6 0:04:30 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/31  config=null
2011-1-6 0:04:30 org.apache.catalina.startup.Catalina start
信息: Server startup in 622 ms


1.初次尝试产生以上这个问题,很明显,就是jar包没有导入完整,但是到底缺那些呢?这个可以将strtus自带的war放到tomcat下面去运行,看哪个可以

正常运行,就将那个包下面的jar全部拷贝过来就可以了,哈哈。只多不少,然后再尝试着删就可以了

网上的所谓攻略经常忽略javassist这个jar包,他不存在于lib下,而存在于app下的某个war中。

2.想要判断包名org.apache.struts2.dispatcher.FilterDispatcher是否拼写正确,可以在.java文件中import一下,

如果拼写正确自然不会报错,否则。。。

3.将struts的包引入工程的同时也要将所有的jar拷贝到WEB-INF/lib目录下,所以最好就是先copy然后将WEB-INF/lib下面的引入工程就好了。

下面两张图很好的说明了引入的jar是否存在WEB-INF/lib下面。

错误的引入,jar没有保存到WEB-INF/lib下面





正确的引入





4.如果以上问如果以上问题都解决完了,还是提示缺少某些jar包的话可以考虑查看Tomcat的classpath,那些缺少的jar包放到里面去:在Eclipes的servers view 中双击Tomcat-&gt;Open launch configuration 进入Edit configuration 界面,然后增加tomcat启动加载的jar包。这样tomcat每次启动都会自动加载这些jar,当然此方法利弊参半,请慎重考虑。
5.
严重: Dispatcher initialization failed
Unable to load configuration. - action - file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsDemo/WEB-INF/classes/struts.xml:8:69


看到此问题,我首先想到了Google,结果告诉我缺少包,可是我的包已经全了啊,感觉不对,回来继续看日志,往下一下,豁然开朗(见红色部分),原来配置文件拼写错误,唉。
2011-1-8 2:27:58 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:StrutsDemo' did not find a matching property.
2011-1-8 2:27:58 org.apache.catalina.core.AprLifecycleListener init
信息: Loaded APR based Apache Tomcat Native library 1.1.20.
2011-1-8 2:27:58 org.apache.catalina.core.AprLifecycleListener init
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2011-1-8 2:27:58 org.apache.coyote.http11.Http11AprProtocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2011-1-8 2:27:58 org.apache.coyote.ajp.AjpAprProtocol init
信息: Initializing Coyote AJP/1.3 on ajp-8009
2011-1-8 2:27:58 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 933 ms
2011-1-8 2:27:58 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2011-1-8 2:27:58 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.16
2011-1-8 2:27:59 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-default.xml]
2011-1-8 2:27:59 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Unable to locate configuration files of the name struts-plugin.xml, skipping
2011-1-8 2:27:59 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-plugin.xml]
2011-1-8 2:27:59 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts.xml]
2011-1-8 2:28:00 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
严重: Dispatcher initialization failed
Unable to load configuration. - action - file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsDemo/WEB-INF/classes/struts.xml:8:69
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
	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:4356)
	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)
[color=red]Caused by: Action class [com.home.lgsun.Action.TestActon] not found[/color] - action - file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsDemo/WEB-INF/classes/struts.xml:8:69
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:420)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:365)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:479)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:275)
	at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
	... 21 more
2011-1-8 2:28:00 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load configuration. - action - file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsDemo/WEB-INF/classes/struts.xml:8:69
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:428)
	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:4356)
	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 configuration. - action - file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsDemo/WEB-INF/classes/struts.xml:8:69
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
	... 19 more
Caused by: Action class [com.home.lgsun.Action.TestActon] not found - action - file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsDemo/WEB-INF/classes/struts.xml:8:69
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:420)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:365)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:479)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:275)
	at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
	... 21 more
2011-1-8 2:28:00 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2011-1-8 2:28:00 org.apache.catalina.core.StandardContext start
严重: Context [/StrutsDemo] startup failed due to previous errors
2011-1-8 2:28:00 org.apache.coyote.http11.Http11AprProtocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2011-1-8 2:28:00 org.apache.coyote.ajp.AjpAprProtocol start
信息: Starting Coyote AJP/1.3 on ajp-8009
2011-1-8 2:28:00 org.apache.catalina.startup.Catalina start
信息: Server startup in 2195 ms

三个晚上了,算是没白忙活,我的struts2Demo终于跑起来了,哈哈,感谢各位出主意的朋友们,辛苦了。凌晨2:30了,唉,时间过的真快。

就Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher问题,我发的求助帖,地址如下:
http://www.iteye.com/problems/56930
http://topic.csdn.net/u/20110107/09/de70e689-8af1-46fa-95b8-921232ff2829.html
最后,附上工程创建过程截图及源码,以做纪念
  • 大小: 33.9 KB
  • 大小: 37.1 KB
  • Struts2Demo.zip (5 MB)
  • 描述: 工程创建过程截图及源码
  • 下载次数: 19
0
0
分享到:
评论
1 楼 xiaoye4188 2011-01-08  
唉 楼主的认真精神值得学习

相关推荐

    struts tutorial.pdf

    综上所述,本教程通过一系列逐步推进的例子和详尽的解释,旨在帮助初学者快速掌握Struts框架的核心概念和技术要点。通过实践这些例子,读者不仅能够学会如何使用Struts开发Web应用,还能对其背后的原理有更深的理解...

    最新JasperReport3.7 iReport的java Web报表整合Struts2完整教程

    在Myeclipse中创建Java Web项目之前,需要先导入一系列JAR包以支持JasperReport的功能。这些JAR包包括但不限于JasperReport库本身以及其依赖项,如Apache Commons Collections、Apache Commons Digester等。 如果在...

    spring-framework-3.1.0.M1.jar包

    Spring的核心特性包括依赖注入(DI)、面向切面编程(AOP)以及一系列用于简化企业级开发的工具和服务。 二、3.1.0.M1版本亮点 1. **Groovy配置支持**:在3.1版本中,Spring引入了对Groovy配置的支持,允许开发者...

    JEECMS2012系统使用手册2012-07美化版(pdf格式)

    该系统利用Java语言的强大特性以及一系列成熟的开源框架,如Hibernate3、Struts2、Spring2和Freemarker等,来实现高性能和灵活性。 **特点:** 1. **强大的Java EE基础**:基于Java语言开发,具备稳定、安全、高效...

    java学习心得4000字.doc

    在学习Java的过程中,初学者往往会经历一系列心理变化,从最初的兴奋到中间的困惑甚至迷茫,再到最终的理解与掌握。这一过程可以被形象地概括为“三起三落”: - **初次接触的兴奋**:对新鲜事物的好奇和探索欲望。...

    java+servlet+ajax程序

    3. JavaScript库:jQuery、Prototype等库简化了Ajax的使用,提供了一系列方便的API。 四、Java + Servlet + Ajax 结合应用 1. 用户交互:Ajax允许用户在不离开当前页面的情况下发送请求,Servlet在后台处理请求并...

    JAVA学习好资源相关下载网站

    - **内容概述**:该网站提供了一系列与XML处理相关的工具,包括解析器、验证器等,对于想要提高XML处理效率的开发者非常有用。 - **Java & XML应用** - **网址**:http://download.chinaitlab.com/soft/6211.htm ...

    BeanUtils教程

    `BeanUtils` 是 Apache Commons Lang 项目中的一个重要组成部分,它提供了一系列强大的工具方法来简化 Java Bean 的操作。初次接触 `BeanUtils` 多是在使用 Struts 框架时,随着其功能的不断完善和增强,`BeanUtils`...

    大数据时代下自学考试报名管理信息系统的创新型探索与研究

    本文针对当前自学考试报名管理信息系统中存在的问题,提出了一系列创新性的探索与研究。 首先,我们必须认识到传统单机版自学考试报名软件在处理大数据方面的局限性。这些软件往往只能在本地进行数据操作,缺乏有效...

Global site tag (gtag.js) - Google Analytics