boyce_zy23
boyce_zy23
2009-06-13 21:52
浏览 292
已采纳

Exception starting filter struts2问题

严重: Exception starting filter struts 2
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.struts2.dispatcher.FilterDispatcher.(FilterDispatcher.java:149)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:255)
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)
2009-6-13 21:22:35 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2009-6-13 21:22:35 org.apache.catalina.core.StandardContext start
严重: Context [/struts2_userlogin] startup failed due to previous errors
2009-6-13 21:22:35 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2009-6-13 21:22:35 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2009-6-13 21:22:35 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/16 config=null
2009-6-13 21:22:35 org.apache.catalina.startup.Catalina start
信息: Server startup in 1793 ms

web.xml配置
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<display-name>Struts Blank</display-name>

<filter>
    <filter-name>struts 2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>

<filter-mapping>
    <filter-name>struts 2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

struts.xml

<include file="struts-default.xml"/>    

<!-- Add packages here-->
<package name="default" extends="struts-default">
    <action name="hello" class="com.boyce.controller.HelloAction">
        <result name="success">success.html</result>
    </action>
</package>

6个jar包:freemarker 、ognl 、struts2-core 、 xwork 、commons-fileupload 、commons-logging我都加了,试了好长时间无法解决,希望大家帮忙看看问题出处,小弟先谢了~

[b]问题补充:[/b]
为什么会出现这个警告:
Could not parse struts.locale setting, substituting default VM locale

以下两种解答都试了,没有解决~我是按照书上的实例在练习,所以用的不是最新的jar包~另外我的6个包都加在Referenced-Libraries中,lib中并无显示~

[b]问题补充:[/b]
照做了还是不行,应该是差jar包吧,org.apache.catalina是哪个包下的啊?
[b]问题补充:[/b]
没有解决,不过分还是给lovewhzlq同志了~

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

4条回答 默认 最新

  • wanghaolovezlq
    wanghaolovezlq 2009-06-13 22:51
    已采纳

    org.apache.catalina这个包都是tomcat自身的jar包,

    你还是去网上下全jar包,

    点赞 评论
  • laitaogood
    laitaogood 2009-06-13 21:57

    java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    你是不是找个新版本的commons-logging.jar包,然后要重新部署一下

    加上commons-logging-api-1.1.jar这个包试试

    点赞 评论
  • wanghaolovezlq
    wanghaolovezlq 2009-06-13 22:01

    你确定下WEB-INF/lib下有没commons-logging这个jar包,
    有时eclispe没有更新过去,

    点赞 评论
  • wanghaolovezlq
    wanghaolovezlq 2009-06-13 22:28

    我劝你把这些jar包放到lib目录下,更新工程,应该就不会有这个问题了,
    别这么依赖IDE的功能

    点赞 评论

相关推荐