簡體   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

我正在使用weblogic 10.3.6,Java EE 6和Maven。 我正在嘗試運行一些junit測試,並且看到此錯誤

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

這是我的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>

我正在使用Java 1.6進行編譯。 如果我切換到1.7,而javax.javaee-api切換到7.0,而不是6.0,則不會收到這些錯誤。 有任何想法嗎? 我幾乎可以確定這是依賴關系之間的兼容性問題,但是我無法指出確切的錯誤。

謝謝!

好,修復它。 我刪除了這個

<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>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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM