Struts2 错误锦集

Exception starting filter struts2 java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor

 

 

struts版本 2.3.4.1 jdk 1.6 tomcat 7.0

 

部署 web 工程时出现错误

 

严重: Exception starting filter struts2
java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
 at org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(PackageBasedActionConfigBuilder.java:386)
 at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:344)
 at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:245)
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)
 at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
 at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
 at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
 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$Sync.innerRun(FutureTask.java:303)
 at java.util.concurrent.FutureTask.run(FutureTask.java:138)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.ClassVisitor
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
 ... 23 more
2012-8-13 23:09:01 org.apache.catalina.core.StandardContext startInternal
严重: Error filterStart
2012-8-13 23:09:01 org.apache.catalina.core.StandardContext startInternal
严重: Context [/strutsTest] startup failed due to previous errors

 

 

原来是因为 struts.xml 中文件 配置路径出错,由于是直接拷贝的 class 的 路径

com/liwei/action/Helloword

编译时会发生 noclassdeffounderror异常

 

改成如下

 

<struts>
    <package name="helloword" extends="struts-default">
        <action name="welcome" class="com.liwei.action.Helloword">
            <result name="success">
                /jsp/helloword.jsp
            </result>
            <result name="fail">
                /jsp/namefrom.jsp
            </result>
        </action>
       
    </package>
</struts>

重新编译项目 启动成功,

 

 

你可能感兴趣的:(struts2)