Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TomEE :- Caused by: java.lang.RuntimeException at org.apache.xbean.asm5.MethodVisitor.visitTypeAnnotation(Unknown Source)

I have a spring mvc web application (maven). It runs on JDK 1.7 perfectly , but the error occurred when i try with 1.8.

Similar question asked here. Where they moved back to 1.7.

But i want to run on 1.8. How can i do that ? i also hear ASM 5 can run it (Not sure). Where do i suppose to change dispatcher servlet or web.xml or spring version ?

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/gurusahakari]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1122)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
 Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/gurusahakari]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 6 more
 Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module gurusahakari: null
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2198)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1147)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5419)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
  Caused by: org.apache.openejb.OpenEJBException: Unable to create annotation scanner for web module gurusahakari: null
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:849)
at org.apache.openejb.config.DeploymentLoader.load(DeploymentLoader.java:221)
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2196)
... 13 more
 Caused by: java.lang.RuntimeException
at org.apache.xbean.asm5.MethodVisitor.visitTypeAnnotation(Unknown Source)
at org.apache.xbean.asm5.ClassReader.b(Unknown Source)
at org.apache.xbean.asm5.ClassReader.accept(Unknown Source)
at org.apache.xbean.asm5.ClassReader.accept(Unknown Source)
at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinder.java:1170)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:147)
at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java:160)
at org.apache.openejb.config.FinderFactory$OpenEJBAnnotationFinder.<init>(FinderFactory.java:514)
at org.apache.openejb.config.FinderFactory.newFinder(FinderFactory.java:259)
at org.apache.openejb.config.FinderFactory.create(FinderFactory.java:77)
at org.apache.openejb.config.FinderFactory.createFinder(FinderFactory.java:66)
at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:841)
... 15 more

Here is my dependency:tree result

[WARNING] Some problems were encountered while building the effective model for com.guru.gurusahakari:gurusahakari:war:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: junit:junit:jar -> duplicate declaration of version 3.8.1 @ line 246, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building gurusahakari 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ gurusahakari ---
[INFO] com.guru.gurusahakari:gurusahakari:war:0.0.1-SNAPSHOT
[INFO] +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.7:compile
[INFO] +- org.codehaus.jackson:jackson-core-asl:jar:1.9.7:compile
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] +- org.hibernate:hibernate-validator:jar:4.0.2.GA:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.5.6:compile
[INFO] |  +- javax.xml.bind:jaxb-api:jar:2.1:compile
[INFO] |  |  +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] |  |  \- javax.activation:activation:jar:1.1:compile
[INFO] |  \- com.sun.xml.bind:jaxb-impl:jar:2.1.3:compile
[INFO] +- org.apache.bval:bval-jsr303:jar:0.5:compile
[INFO] |  +- org.apache.bval:bval-core:jar:0.5:compile
[INFO] |  |  \- commons-beanutils:commons-beanutils-core:jar:1.8.3:compile
[INFO] |  \- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] +- org.springframework.session:spring-session:jar:1.0.0.RELEASE:compile 
[INFO] +- org.springframework:spring-context-support:jar:4.3.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:4.3.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:4.3.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-core:jar:4.3.7.RELEASE:compile
[INFO] +- net.sf.jasperreports:jasperreports:jar:6.1.0:compile
[INFO] |  +- commons-beanutils:commons-beanutils:jar:1.9.0:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  +- commons-digester:commons-digester:jar:2.1:compile
[INFO] |  +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  +- com.lowagie:itext:jar:2.1.7.js2:compile
[INFO] |  |  +- bouncycastle:bcmail-jdk14:jar:138:compile
[INFO] |  |  +- bouncycastle:bcprov-jdk14:jar:138:compile
[INFO] |  |  \- org.bouncycastle:bctsp-jdk14:jar:1.38:compile  
[INFO] |  |     +- org.bouncycastle:bcprov-jdk14:jar:1.38:compile
[INFO] |  |     \- org.bouncycastle:bcmail-jdk14:jar:1.38:compile
[INFO] |  +- jfree:jcommon:jar:1.0.15:compile 
[INFO] |  +- jfree:jfreechart:jar:1.0.12:compile
[INFO] |  +- xml-apis:xml-apis:jar:1.3.02:compile
[INFO] |  +- org.eclipse.jdt.core.compiler:ecj:jar:4.3.1:compile
[INFO] |  +- org.codehaus.castor:castor-xml:jar:1.3.3:compile
[INFO] |  |  +- org.codehaus.castor:castor-core:jar:1.3.3:compile
[INFO] |  |  +- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  |  +- javax.inject:javax.inject:jar:1:compile
[INFO] |  |  \- stax:stax:jar:1.2.0:compile
[INFO] |  |     \- stax:stax-api:jar:1.0.1:compile
[INFO] |  +- org.apache.lucene:lucene-core:jar:4.5.1:compile
[INFO] |  +- org.apache.lucene:lucene-analyzers-common:jar:4.5.1:compile
[INFO] |  +- org.apache.lucene:lucene-queryparser:jar:4.5.1:compile
[INFO] |  |  +- org.apache.lucene:lucene-queries:jar:4.5.1:compile
[INFO] |  |  \- org.apache.lucene:lucene-sandbox:jar:4.5.1:compile
  [INFO] |  |     \- jakarta-regexp:jakarta-regexp:jar:1.4:compile
 [INFO] |  +- org.olap4j:olap4j:jar:0.9.7.309-JS-3:compile
[INFO] |  \- com.google.zxing:core:jar:2.3.0:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.3.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.3.7.RELEASE:compile
 [INFO] |  +- org.springframework:spring-expression:jar:4.3.7.RELEASE:compile
 [INFO] |  \- org.springframework:spring-web:jar:4.3.7.RELEASE:compile
   [INFO] +- javax.servlet:javax.servlet-api:jar:4.0.1:provided
   [INFO] +- commons-codec:commons-codec:jar:1.9:compile
    [INFO] +- com.sun.xml.messaging.saaj:saaj-impl:jar:1.3.18:compile
[INFO] |  \- org.jvnet.mimepull:mimepull:jar:1.7:compile
  [INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.11:compile
 [INFO] +- log4j:log4j:jar:1.2.17:compile
      [INFO] +- javax.servlet:jstl:jar:1.2:compile
    [INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.5.0:compile
  [INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.5.0:compile
     [INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.5.0:compile
 [INFO] +- commons-fileupload:commons-fileupload:jar:1.3.1:compile
  [INFO] +- commons-io:commons-io:jar:2.4:compile
   [INFO] \- org.json:json:jar:20160810:compile
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
   [INFO] Total time: 7.668 s
    [INFO] Finished at: 2018-08-12T10:08:25+05:45
[INFO] Final Memory: 11M/158M
    [INFO] ------------------------------------------------------------------------

Here is my web.xml :

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>gurusahakari</display-name>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
    <servlet-name>default</servlet-name>
    <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
</servlet>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring/applicationContext.xml</param-value>
</context-param>

<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/dispatcher-servlet.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

<context-param>
    <param-name>master.db</param-name>
    <param-value>master-db</param-value>
</context-param>

<context-param>
    <param-name>upload.image.path</param-name>
    <param-value>/Software Backup/Images</param-value>
</context-param>

here is my pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc.abcd</groupId>
<artifactId>abcd</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<url>http://maven.apache.org</url>



<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <tomee.version>2.0.0-SNAPSHOT</tomee.version>
    <version.shrinkwrap.resolver>2.0.0</version.shrinkwrap.resolver>
    <javaassist.version>3.21.0-GA</javaassist.version>
</properties>

<repositories>
    <repository>
        <id>apache-m2-snapshot</id>
        <name>Apache Snapshot Repository</name>
        <url>https://repository.apache.org/content/groups/snapshots</url>
    </repository>
</repositories>


<build>
    <sourceDirectory>src</sourceDirectory>
    <!-- <finalName>gurusahakari</finalName> -->
    <defaultGoal>install</defaultGoal>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <id>copy-test-libs</id>
                    <phase>process-test-resources</phase>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>javax.servlet</groupId>
                                <artifactId>jstl</artifactId>
                                <version>1.2</version>
                            </artifactItem>
                            <artifactItem>
                                <groupId>taglibs</groupId>
                                <artifactId>standard</artifactId>
                                <version>1.1.2</version>
                            </artifactItem>
                        </artifactItems>
                        <outputDirectory>
                            ${project.build.directory}/test-libs
                        </outputDirectory>
                        <stripVersion>true</stripVersion>
                    </configuration>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.17</version>
            <configuration>
                <reuseForks>false</reuseForks> <!-- otherwise openejb embedded and tomee embedded shares the same context 
                    and EJBContainer is broken -->
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.9</version>
            <configuration>
                <configuration>
                    <wtpapplicationxml>true</wtpapplicationxml>
                    <wtpversion>2.0</wtpversion>
                </configuration>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.aries.blueprint</groupId>
            <artifactId>blueprint-maven-plugin</artifactId>
            <version>1.4.0</version>
            <configuration>
                <scanPaths>
                    <scanPath>org.opendaylight</scanPath>
                </scanPaths>
            </configuration>
            <dependencies>
                <dependency>
                    <!-- https://stackoverflow.com/questions/38825386/blueprint-maven-plugin-runtimeexception -->
                    <groupId>org.apache.xbean</groupId>
                    <artifactId>xbean-finder-shaded</artifactId>
                    <version>4.5</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <goals>
                        <goal>blueprint-generate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.openejb.maven</groupId>
            <artifactId>tomee-maven-plugin</artifactId>
            <version>2.0.0-SNAPSHOT</version>
            <configuration>
                <tomeeClassifier>plus</tomeeClassifier>
                <args>-Xmx512m -XX:PermSize=256m</args>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.7</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-core-asl</artifactId>
        <version>1.9.7</version>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>


    <!-- validation jar -->
    <!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>2.0.1.Final</version>
    </dependency>


    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.0.2.GA</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.bval/bval-jsr303 -->
    <dependency>
        <groupId>org.apache.bval</groupId>
        <artifactId>bval-jsr303</artifactId>
        <version>0.5</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/org.springframework.session/spring-session -->
    <dependency>
        <groupId>org.springframework.session</groupId>
        <artifactId>spring-session</artifactId>
        <version>1.0.0.RELEASE</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>4.3.8.RELEASE</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports -->
    <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>6.1.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.3.8.RELEASE</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>4.3.8.RELEASE</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>4.0.1</version>
        <scope>provided</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.9</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.sun.xml.messaging.saaj/saaj-impl -->
    <dependency>
        <groupId>com.sun.xml.messaging.saaj</groupId>
        <artifactId>saaj-impl</artifactId>
        <version>1.3.18</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.11</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <!-- jackson data biending -->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.5.0</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.5.0</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.5.0</version>
    </dependency>

    <!-- Apache Commons FileUpload -->
    <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.3.1</version>
    </dependency>

    <!-- Apache Commons IO -->
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>


    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.json/json -->
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20160810</version>
    </dependency>
</dependencies>

I used tomee 1.7.4 under tomcat 7.

like image 926
parlad Avatar asked Aug 05 '18 07:08

parlad


2 Answers

i also hear ASM 5 can run it (Not sure).

And it is the case according to the Java 8 support (upgrade to xbean asm 5 shade) issue that was fixed from the 1.7.0 TomEE version.

The root cause of your error is :

Caused by: java.lang.RuntimeException

at org.apache.xbean.asm5.MethodVisitor.visitTypeAnnotation(Unknown Source)

As the exception (type and message) is rather broad, in order to understand the issue, looking in the source code is the first thing to do.
But according to the stacktrace you don't have the source code for this class : Unknown Source.
I also note that the maven dependency:tree doesn't display this dependency. So this is not provided by your component but provided at runtime, very probably by the TomEE server that you use to deploy your component.
TomEE appears using a shaded version of xbean and asm : xbean-asm5-shaded-4.5.
We could so retrieve the source code of MethodVisitor.visitTypeAnnotation() from the asm jar :

public AnnotationVisitor visitTypeAnnotation(int typeRef,
        TypePath typePath, String desc, boolean visible) {
    if (api < Opcodes.ASM5) {  
        throw new RuntimeException(); // your problem is there
    }
    if (mv != null) {
        return mv.visitTypeAnnotation(typeRef, typePath, desc, visible);
    }
    return null;
}

The issue occurs because of the asm API version used by the Visitor class that is below asm-5 and the MethodVisitor instanced used at runtime needs at at least asm-5.

In the asm library, MethodVisitor is implemented by MethodWriter that specifies the asm API version to use.
And if you encounter this error it means that Opcodes.ASM4 was passed in the constructor argument of MethodWriter.

asm-4 org.objectweb.asm.MethodWriter constructor snippet :

MethodWriter(final ClassWriter cw, final int access, final String name,
        final String desc, final String signature,
        final String[] exceptions, final boolean computeMaxs,
        final boolean computeFrames) {
    super(Opcodes.ASM4);  // <-- pass ASM4 as parameter
 ...
}

asm-5 org.objectweb.asm.MethodWriter constructor snippet :

MethodWriter(final ClassWriter cw, final int access, final String name,
        final String desc, final String signature,
        final String[] exceptions, final boolean computeMaxs,
        final boolean computeFrames) {
    super(Opcodes.ASM5);  // <-- pass ASM5 as parameter
 ...
}

It looks like a version conflict where asm-5 classes are present at runtime but visitor concrete classes of asm were compiled in a way where they pass asm-4 version as argument.
Important : I illustrated the API version valuing with MethodWriter provided by asm but be aware that the problem could be MethodWriter provided by asm-4 or any subclass of MethodVisitor that could be implemented by a third library that specifies the asm-4 api in the call to the super constructor.

To solve your issue, you should probably check that no asm-4 and no library designed to work with asm-4 classes be available at runtime and compile time :

  • check the content of all JARs available at runtime: these provided by TomEE, these added in the classpath, these included in your WAR and make sure that they don't contain any Visitor implementations relying on asm-4, any asm-4 JAR and any JAR that could shade asm-4.
  • you should do the same checks for the compilation time (maven dependencies).

To help in you task you could run TomEE with the -verbose:class JVM flag that outputs loaded classes. It could help you to discover the culprit.

If you really don't manage to find the dependency that cause this issue, I advise you to start from scratch.
Use a fresh version of TomEE, configure a minimal pom.xml to deploy a minimal application that uses Java 8 as source/target compilation flags, it should work without any issue.
Then merge progressively your real project to this skinny project, do some tests and go on merging progressively until you encounter the issue.
As it would happen you should easily find the exact cause.

like image 72
davidxxx Avatar answered Sep 30 '22 05:09

davidxxx


Are you properly setting the source and target when you switch to java 8 (https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html) as well as updating the asm version when you go from 7 to 8?

Can you please provide additional information about your project, e.g. what versions of libraries (spring, asm) are you using? What version of TomEE you are attempting to run on. What actions you are taking when you attempt to switch from 7 to 8.

I believe you are running into: https://issues.apache.org/jira/browse/XBEAN-276 which is also mentioned at Blueprint maven plugin RuntimeException. It appears you may need to update the version of xbeans being used in your application. Perhaps via a plugin (see plugin depenedencies via mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:resolve-plugins)

like image 45
Ben M Avatar answered Sep 30 '22 05:09

Ben M