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

时间:2021-04-05 15:40:06

struts版本 2.3.4.1 jdk 1.6 tomcat 7.0

按教程,使用Convention插件进行配置

教程中说只要加入struts2-convention-plugin-2.3.4.1.jar这个jar包就可以使用。

按照这种方法部署后,启动tomcat报错

严重: 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

 

应该还是缺少jar包

后加入asm的jar包后就好了

struts的lib目录下有三个asm包

试了下

加入

asm-commons-3.3.jar

asm-3.3.jar

这两个就可以跑了

 

还有个

asm-tree-3.3.jar 好像不用加入也不会报错

 

asm是一个轻量级字节码处理和分析框架

 

具体这三个包是干啥的。。。明天查