简体   繁体   English

Java EE 6中类文件javax / mail / MessagingException中不是本机或抽象的方法中的缺少Code属性

[英]Absent Code attribute in method that is not native or abstract in class file javax/mail/MessagingException in Java EE 6

I'm using weblogic 10.3.6, Java EE 6 and maven. 我正在使用weblogic 10.3.6,Java EE 6和Maven。 I'm trying to run a few junit tests, and I'm seeing this error 我正在尝试运行一些junit测试,并且看到此错误

java.lang.ClassFormatException: Absent Code attribute in method that is not native or abstract in class file javax/mail/MessagingException

This is my pom: 这是我的pom:

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>ni-super-pom</artifactId>
        <groupId>com.ni.lib.maven</groupId>
        <version>5</version>
    </parent>

    <groupId>com.ni.engineering</groupId>
    <artifactId>CertificationAPIRestful</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>CertificationAPIRestful</name>    

    <dependencies>       
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>            
        <!-- Jackson -->
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-core-lgpl</artifactId>
            <version>1.9.3</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-jaxrs</artifactId>
            <version>1.9.3</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-lgpl</artifactId>
            <version>1.9.3</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-xc</artifactId>
            <version>1.9.3</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-servlet</artifactId>
            <version>${jersey-version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
            <version>${jersey-version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-server</artifactId>
            <version>${jersey-version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-json</artifactId>
            <version>${jersey-version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey.jersey-test-framework</groupId>
            <artifactId>jersey-test-framework-grizzly2</artifactId>
            <version>${jersey-version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.9</version>
            <scope>test</scope>
        </dependency>           
        <dependency>
            <groupId>com.ni.apps.rest</groupId>
            <artifactId>NiRestWSLib</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.ni.apps.wd</groupId>
            <artifactId>wd-core</artifactId>
            <version>3.0</version>
        </dependency> 
         <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>6.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.11</version>
                <configuration>
                    <additionalClasspathElements>
                        <additionalClasspathElement>src/test/java</additionalClasspathElement>
                        <additionalClasspathElement>src/test/resources</additionalClasspathElement>
                    </additionalClasspathElements>
                </configuration>
            </plugin>

            <!-- Generate JAXB Java source files from an XSD file -->
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <!-- Changes the default schema directory -->
                            <generatePackage>com.ni.apps.engineering.certification.plugin</generatePackage>
                            <generateDirectory>${project.build.directory}/generated-source/</generateDirectory>
                            <schemaDirectory>src/main/resources</schemaDirectory>
                            <bindingDirectory>src/main/resources</bindingDirectory>
                            <extension>true</extension>
                            <args>
                                <arg>-Xannotate</arg>
                            </args>
                            <plugins>
                                <plugin>
                                    <groupId>org.jvnet.jaxb2_commons</groupId>
                                    <artifactId>jaxb2-basics</artifactId>
                                    <version>0.6.0</version>
                                </plugin>
                                <plugin>
                                    <groupId>org.jvnet.jaxb2_commons</groupId>
                                    <artifactId>jaxb2-basics-annotate</artifactId>
                                    <version>0.6.0</version>
                                </plugin>
                            </plugins>

                        </configuration>

                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.jackson</groupId>
                        <artifactId>jackson-core-asl</artifactId>
                        <version>1.9.7</version>
                    </dependency>
                </dependencies>
            </plugin>
            <!-- Build helper plugin adds the sources generated by the JAXB to the 
            compile path -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/</source>
                                <source>${project.build.directory}/generated-source/</source>
                            </sources>
                        </configuration>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <properties>
        <jersey-version>1.17</jersey-version>
    </properties>
</project>

I'm compiling using java 1.6. 我正在使用Java 1.6进行编译。 If I switch to 1.7 and the javax.javaee-api to 7.0 instead of 6.0, I don't get those errors. 如果我切换到1.7,而javax.javaee-api切换到7.0,而不是6.0,则不会收到这些错误。 Any ideas? 有任何想法吗? I'm almost sure it's a compatibility issue between the dependencies, but I can't pin point the exact error. 我几乎可以确定这是依赖关系之间的兼容性问题,但是我无法指出确切的错误。

Thanks! 谢谢!

Ok, fixed it. 好,修复它。 I removed this 我删除了这个

<dependency>
            <groupId>com.sun.jersey.jersey-test-framework</groupId>
            <artifactId>jersey-test-framework-grizzly2</artifactId>
            <version>${jersey-version}</version>
            <scope>test</scope>
        </dependency>

and replaced it with this 并替换成这个

<dependency>
   <groupId>com.sun.jersey</groupId>
   <artifactId>jersey-test-framework</artifactId>
   <version>1.1.5.1</version>
   <scope>test</scope>
</dependency>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.lang.ClassFormatError:在类文件 javax/mail/MessagingException 中非本机或抽象的方法中缺少代码属性 - java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/mail/MessagingException ClassFormatError:在类文件 javax/mail/MessagingException 中非本机或抽象的方法中缺少代码属性 - ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/mail/MessagingException java.lang.ClassFormatError:类文件javax / mail / internet / ParseException中不是本机或抽象的方法中的缺少Code属性 - java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/mail/internet/ParseException java.lang.ClassFormatError:类文件javax / faces / FacesException中不是本机或抽象的方法中的缺少Code属性 - java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/FacesException 在类文件javax / faces / webapp / FacesServlet中的非本机或抽象方法中的Absent Code属性 - Absent Code attribute in method that is not native or abstract in class file javax/faces/webapp/FacesServlet 方法中的Absent Code属性在类文件javax / servlet / ServletException中不是本机的或抽象的 - Absent Code attribute in method that is not native or abstract in class file javax/servlet/ServletException class 文件 javax/validation/ConstraintViolationException 中非本机或抽象方法中的缺失代码属性 - Absent Code attribute in method that is not native or abstract in class file javax/validation/ConstraintViolationException 类文件javax / transaction / SystemException中不是本机或抽象的方法中的缺少Code属性 - Absent Code attribute in method that is not native or abstract in class file javax/transaction/SystemException 类文件javax / servlet / ServletException中不是本机或抽象的方法中的Embedded Jetty Absent Code属性 - Embedded Jetty Absent Code attribute in method that is not native or abstract in class file javax/servlet/ServletException JPA ClassFormat 错误“类文件 javax/persistence/Persistence 中非本机或抽象的方法中缺少代码属性” - JPA ClassFormat Error "Absent Code attribute in method that is not native or abstract in class file javax/persistence/Persistence"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM