错误:无法阅读课程[行动类]

时间:2013-07-23 15:17:48

标签: maven struts2 struts tomcat7 struts2-convention-plugin

我一直试图解决我的Struts 2项目的问题,这似乎与我正在使用的库版本有些相关。这个项目包括Struts 2 + Spring + Hibernate,并扩展了Struts" Struts 2 Convention Plugin"的插件。所以只使用Struts.xml文件进行拦截器定义和结果类型没什么用。其余的工作是通过使用注释完成的。但是,每当我启动我的tomcat时,它都会给我以下异常:

2013-07-23 20:06:36,350 ERROR com.opensymphony.xwork2.util.finder.ClassFinder.error:38 - Unable to read class [com.abc.lab.actions.HomeAction]
java.lang.NoSuchMethodError: org.objectweb.asm.ClassReader.accept(Lorg/objectweb/asm/ClassVisitor;I)V
.....
2013-07-23 20:06:36,546 ERROR com.opensymphony.xwork2.util.finder.ClassFinder.error:38 - Unable to read class [com.kiosk.lab.actions.LoginAction]
java.lang.NoSuchMethodError: org.objectweb.asm.ClassReader.accept(Lorg/objectweb/asm/ClassVisitor;I)V
....
    2013-07-23 20:06:36,823 DEBUG org.apache.struts2.dispatcher.Dispatcher.debug:72 - Cleaning up resources used to init Dispatcher
    PUBLIC Filter Started.

所以从日志中可以清楚地看到我刚刚创建的公共过滤器实例化正常。但是,它无法正确阅读操作。

这些是我在pom.xml中提到的依赖项:       

           <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-core</artifactId>
       <version>2.3.15</version>
        </dependency>

         <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.2.1</version>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>

    <!-- Struts 2 + Spring plugins -->
    <dependency>
            <groupId>org.apache.struts</groupId>
        <artifactId>struts2-spring-plugin</artifactId>
        <version>2.1.8</version>
        </dependency>
          <!-- MySQL database driver -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.9</version>
    </dependency>
    <!-- Spring framework --> 
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring</artifactId>
        <version>2.5.6</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>2.5.6</version>
    </dependency>
    <!-- Hibernate core -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate</artifactId>
        <version>3.2.7.ga</version>
    </dependency>

    <!-- Hibernate core library dependency start -->
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.6.1</version>
    </dependency>

    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
    </dependency>
 <dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.1</version>
</dependency>

    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.1</version>
    </dependency>
     <dependency>
    <groupId>org.apache.struts.xwork</groupId>
    <artifactId>xwork-core</artifactId>
    <version>2.3.15</version>
</dependency>

     <dependency>
        <groupId>org.freemarker</groupId>
        <artifactId>freemarker</artifactId>
        <version>2.3.15</version>
    </dependency>

    <!-- Hibernate core library dependency end -->

    <!-- Hibernate query library dependency start -->
    <dependency>
        <groupId>antlr</groupId>
        <artifactId>antlr</artifactId>
        <version>2.7.7</version>
    </dependency>
      <dependency>
          <groupId>org.apache.struts</groupId>
      <artifactId>struts2-convention-plugin</artifactId>
      <version>2.3.15</version>
    </dependency>
          <dependency>
    <groupId>asm</groupId>
    <artifactId>asm-all</artifactId>
    <version>3.3.1</version>
</dependency>
            <dependency>
      <groupId>asm</groupId>
      <artifactId>asm-commons</artifactId>
      <version>3.3</version>
    </dependency>
    <dependency>
      <groupId>asm</groupId>
      <artifactId>asm-tree</artifactId>
      <version>3.3</version>
    </dependency>
    <dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.15</version>
</dependency>
<dependency>
     <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
  <version>3.0.1</version>
    <scope>provided</scope>
</dependency>

使用Apache tomcat版本apache-tomcat-7.0.40 for Windows 7 64 Bit ...

修改

Mvn依赖:树输出

 +- org.apache.struts:struts2-core:jar:2.3.8:compile
 |  +- ognl:ognl:jar:3.0.6:compile
 |  |  \- javassist:javassist:jar:3.11.0.GA:compile
 |  \- com.sun:tools:jar:1.5.0:system
 +- commons-fileupload:commons-fileupload:jar:1.2.1:compile
 +- commons-io:commons-io:jar:1.3.2:compile
 +- org.apache.struts:struts2-spring-plugin:jar:2.1.8:compile
 |  +- org.springframework:spring-beans:jar:2.5.6:compile
 |  +- org.springframework:spring-core:jar:2.5.6:compile
 |  \- org.springframework:spring-context:jar:2.5.6:compile
 |     \- aopalliance:aopalliance:jar:1.0:compile
 +- mysql:mysql-connector-java:jar:5.1.9:compile
 +- org.springframework:spring:jar:2.5.6:compile
 +- org.springframework:spring-web:jar:2.5.6:compile
 +- org.hibernate:hibernate:jar:3.2.7.ga:compile
 |  +- net.sf.ehcache:ehcache:jar:1.2.3:compile
 |  +- javax.transaction:jta:jar:1.0.1B:compile
 |  +- asm:asm-attrs:jar:1.5.3:compile
 |  +- cglib:cglib:jar:2.1_3:compile
 |  \- asm:asm:jar:1.5.3:compile
 +- dom4j:dom4j:jar:1.6.1:compile
 |  \- xml-apis:xml-apis:jar:1.0.b2:compile
 +- commons-logging:commons-logging:jar:1.1.1:compile
 +- org.apache.commons:commons-lang3:jar:3.1:compile
 +- commons-collections:commons-collections:jar:3.2.1:compile
 +- org.apache.struts.xwork:xwork-core:jar:2.3.8:compile
 +- org.freemarker:freemarker:jar:2.3.15:compile
 +- antlr:antlr:jar:2.7.7:compile
 +- org.apache.struts:struts2-convention-plugin:jar:2.3.8:compile
 +- asm:asm-all:jar:3.3.1:compile
 +- asm:asm-commons:jar:3.3:compile
 +- asm:asm-tree:jar:3.3:compile
 +- log4j:log4j:jar:1.2.15:compile
 |  +- javax.mail:mail:jar:1.4:compile
 |  |  \- javax.activation:activation:jar:1.1:compile
 |  +- javax.jms:jms:jar:1.1:compile
 |  +- com.sun.jdmk:jmxtools:jar:1.2.1:compile
 |  \- com.sun.jmx:jmxri:jar:1.2.1:compile
 \- javax.servlet:javax.servlet-api:jar:3.0.1:provided
编辑#2:编辑#2: 现在我已经删除了所有先前的依赖关系,并试图只留下那些可能是必要的,但仍然是相同的结果,但异常有点改变,因为现在它给出了另一个异常

2013-07-23 23:12:00,225 ERROR com.opensymphony.xwork2.util.finder.ClassFinder.error:38 - Unable to read class [com.abc.lab.actions.LoginAction]
java.lang.NoClassDefFoundError: com/opensymphony/xwork2/util/finder/ClassFinder$InfoBuildingVisitor
编辑#3:现在Dependencies更新为Maven中Struts2和Spring的单个人工制品 现在例外是:

2013-07-24 00:39:57,190 ERROR com.opensymphony.xwork2.util.finder.ClassFinder.error:38 - Unable to read class [com.kiosk.lab.actions.LoginAction]
java.lang.NoClassDefFoundError: com/opensymphony/xwork2/util/finder/ClassFinder$InfoBuildingVisitor


    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-core</artifactId>
       <version>2.3.8</version>
        </dependency>

    <!-- Struts 2 + Spring plugins -->
<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-spring-plugin</artifactId>
    <version>2.3.8</version>
</dependency>

          <!-- MySQL database driver -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.9</version>
    </dependency>
    <!-- Spring framework --> 
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring</artifactId>
        <version>2.5.6</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>2.5.6</version>
    </dependency>
    <!-- Hibernate core -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate</artifactId>
        <version>3.2.7.ga</version>
    </dependency>

    <!-- Hibernate core library dependency start -->
     <dependency>
    <groupId>org.apache.struts.xwork</groupId>
    <artifactId>xwork-core</artifactId>
    <version>2.3.8</version>
</dependency>
    <!-- Hibernate core library dependency end -->

    <!-- Hibernate query library dependency start -->
      <dependency>
          <groupId>org.apache.struts</groupId>
      <artifactId>struts2-convention-plugin</artifactId>
      <version>2.3.8</version>
    </dependency>
          <dependency>
     <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
  <version>3.0.1</version>
    <scope>provided</scope>
</dependency>
          <dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.15</version>
</dependency>

0 个答案:

没有答案