java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/validation/Validation

北慕城南 提交于 2021-02-10 05:15:28

问题


Using maven to add activemq, there is a problem about conflicting jar when I unit-test in IDE, the exception message is:

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/validation/Validation

i have excluded the validation from javaee, as following:

   <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>6.0</version>
        <scope>provided</scope>
        <exclusions>
            <exclusion>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-jms_1.1_spec</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

and dependency for activemq is

  <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-all</artifactId>
        <version>${activemq_version}</version>

        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
            </exclusion>

            <exclusion>
                <groupId>org.fusesource.fuse-extra</groupId>
                <artifactId>fusemq-leveldb</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

this is an annoying problem.

anyone would like to give some point? Help much appreciated!


回答1:


The dependency javax::javaee-api contains stripped classes which contain no method implementations as described here. You can use the API JAR provided by JBoss instead:

<dependency>
    <groupId>org.jboss.spec</groupId>
    <artifactId>jboss-javaee-6.0</artifactId>
    <version>1.0.0.Final</version>
    <type>pom</type>
    <scope>provided</scope>
</dependency>


来源:https://stackoverflow.com/questions/12384232/java-lang-classformaterror-absent-code-attribute-in-method-that-is-not-native-o

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!