You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Drew Rampulla <ar...@beaumaris.net> on 2009/08/26 14:32:42 UTC

ClassFormatError when using javaee:javaee-api

I receive "java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/resource/spi/ResourceAdapterInternalException" when I try to use OpenEJB as a container for my unit tests.  I believe this has something to do with including the dependency javaee:javaee-api:5 instead of using the javaee-api that is included in OpenEJB.  Does anyone know why I can't use javaee:javaee-api:5 in my Maven pom file?

I'll cut/past the pom file to illustrate my point.


<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.example</groupId>
    <artifactId>ejbwithunittests-ejb</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>ejb</packaging>

    <name>EJB With Unit Tests - EJB</name>

    <properties>
        <jboss.home>${env.JBOSS_HOME}</jboss.home>
        <jboss.servername>default</jboss.servername>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.6</version>
        </dependency>

<!--When I leave this in it fails, but when I comment it out and put the openejb version back in, it works -->
        <dependency>
            <groupId>javaee</groupId>
            <artifactId>javaee-api</artifactId>
            <version>5</version>
            <scope>provided</scope>
        </dependency>
<!--
    <dependency>
      <groupId>org.apache.openejb</groupId>
      <artifactId>javaee-api</artifactId>
      <version>5.0-2</version>
      <scope>provided</scope>
    </dependency>
-->
        <dependency>
            <groupId>org.apache.openejb</groupId>
            <artifactId>openejb-core</artifactId>
            <version>3.1.1</version>
        </dependency>

    </dependencies>

    <build>
        <pluginManagement>
            <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-ejb-plugin</artifactId>
                    <!--
                            This is insane that I need to specify this, you would think that
                            the stupid thing would assume that all dependecies should be
                            included in the package, but whatever... POS
                    -->
                    <configuration>
                        <archive>
                            <manifest>
                                <addClasspath>true</addClasspath>
                            </manifest>
                        </archive>
                        <ejbVersion>3.0</ejbVersion>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>jboss-maven-plugin</artifactId>
                    <version>1.3.2</version>
                    <configuration>
                        <jbossHome>${jboss.home}</jbossHome>
                        <serverName>${jboss.servername}</serverName>
                        <hostName>localhost</hostName>
                        <port>8080</port>
                        <!-- I have no idea why this won't work with deploy, but i need to use harddeploy for now -->
                        <deployUrlPath><![CDATA[/jmx-console/HtmlAdaptor?action=invokeOpByName&name=jboss.system:service%3DMainDeployer&methodName=deploy&argType=java.net.URL&arg0=]]>
                        </deployUrlPath>
                        <undeployUrlPath><![CDATA[/jmx-console/HtmlAdaptor?action=invokeOpByName&name=jboss.system:service%3DMainDeployer&methodName=undeploy&argType=java.net.URL&arg0=]]>
                        </undeployUrlPath>
                    </configuration>

                </plugin>

            </plugins>

        </pluginManagement>
    </build>


    <repositories>
        <repository>
            <id>java.net1</id>
            <name>Java.Net Maven1 Repository, hosts the javaee-api dependency</name>
            <url>http://download.java.net/maven/1</url>
            <layout>legacy</layout>
        </repository>

        <repository>
            <url>http://download.java.net/maven/2</url>
            <id>restlib</id>
            <layout>default</layout>
            <name>Repository for library Library[restlib]</name>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>maven2-repository.dev.java.net</id>
            <url>http://download.java.net/maven/2</url>
            <layout>default</layout>
        </pluginRepository>
    </pluginRepositories>

</project>

Andrew Rampulla

________________________________
The information contained in this message is legally privileged and confidential, and is intended for the individual or entity to whom it is addressed (or their designee). If this message is read by anyone other than the intended recipient, please be advised that distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please notify the sender immediately and delete or destroy all copies of this message.

Re: ClassFormatError when using javaee:javaee-api

Posted by David Blevins <da...@visi.com>.
On Aug 26, 2009, at 5:32 AM, Drew Rampulla wrote:

> I receive "java.lang.ClassFormatError: Absent Code attribute in  
> method that is not native or abstract in class file javax/resource/ 
> spi/ResourceAdapterInternalException" when I try to use OpenEJB as a  
> container for my unit tests.  I believe this has something to do  
> with including the dependency javaee:javaee-api:5 instead of using  
> the javaee-api that is included in OpenEJB.  Does anyone know why I  
> can't use javaee:javaee-api:5 in my Maven pom file?

It should work fine if you use org.apache.openejb:javaee:5.0-2 in your  
pom.xml.  This is the spec library we create and is fully certified.

I'm not familiar with javaee:javaee-api:5 artifact.  Maybe someone  
else has an idea where it comes from or who makes it.


-David

>
> I'll cut/past the pom file to illustrate my point.
>
>
> <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.example</groupId>
>    <artifactId>ejbwithunittests-ejb</artifactId>
>    <version>1.0-SNAPSHOT</version>
>    <packaging>ejb</packaging>
>
>    <name>EJB With Unit Tests - EJB</name>
>
>    <properties>
>        <jboss.home>${env.JBOSS_HOME}</jboss.home>
>        <jboss.servername>default</jboss.servername>
>        <project.build.sourceEncoding>UTF-8</ 
> project.build.sourceEncoding>
>    </properties>
>
>    <dependencies>
>        <dependency>
>            <groupId>junit</groupId>
>            <artifactId>junit</artifactId>
>            <version>4.6</version>
>        </dependency>
>
> <!--When I leave this in it fails, but when I comment it out and put  
> the openejb version back in, it works -->
>        <dependency>
>            <groupId>javaee</groupId>
>            <artifactId>javaee-api</artifactId>
>            <version>5</version>
>            <scope>provided</scope>
>        </dependency>
> <!--
>    <dependency>
>      <groupId>org.apache.openejb</groupId>
>      <artifactId>javaee-api</artifactId>
>      <version>5.0-2</version>
>      <scope>provided</scope>
>    </dependency>
> -->
>        <dependency>
>            <groupId>org.apache.openejb</groupId>
>            <artifactId>openejb-core</artifactId>
>            <version>3.1.1</version>
>        </dependency>
>
>    </dependencies>
>
>    <build>
>        <pluginManagement>
>            <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-ejb-plugin</artifactId>
>                    <!--
>                            This is insane that I need to specify  
> this, you would think that
>                            the stupid thing would assume that all  
> dependecies should be
>                            included in the package, but whatever...  
> POS
>                    -->
>                    <configuration>
>                        <archive>
>                            <manifest>
>                                <addClasspath>true</addClasspath>
>                            </manifest>
>                        </archive>
>                        <ejbVersion>3.0</ejbVersion>
>                    </configuration>
>                </plugin>
>
>                <plugin>
>                    <groupId>org.codehaus.mojo</groupId>
>                    <artifactId>jboss-maven-plugin</artifactId>
>                    <version>1.3.2</version>
>                    <configuration>
>                        <jbossHome>${jboss.home}</jbossHome>
>                        <serverName>${jboss.servername}</serverName>
>                        <hostName>localhost</hostName>
>                        <port>8080</port>
>                        <!-- I have no idea why this won't work with  
> deploy, but i need to use harddeploy for now -->
>                        <deployUrlPath><![CDATA[/jmx-console/ 
> HtmlAdaptor?action=invokeOpByName&name=jboss.system:service 
> %3DMainDeployer&methodName=deploy&argType=java.net.URL&arg0=]]>
>                        </deployUrlPath>
>                        <undeployUrlPath><![CDATA[/jmx-console/ 
> HtmlAdaptor?action=invokeOpByName&name=jboss.system:service 
> %3DMainDeployer&methodName=undeploy&argType=java.net.URL&arg0=]]>
>                        </undeployUrlPath>
>                    </configuration>
>
>                </plugin>
>
>            </plugins>
>
>        </pluginManagement>
>    </build>
>
>
>    <repositories>
>        <repository>
>            <id>java.net1</id>
>            <name>Java.Net Maven1 Repository, hosts the javaee-api  
> dependency</name>
>            <url>http://download.java.net/maven/1</url>
>            <layout>legacy</layout>
>        </repository>
>
>        <repository>
>            <url>http://download.java.net/maven/2</url>
>            <id>restlib</id>
>            <layout>default</layout>
>            <name>Repository for library Library[restlib]</name>
>        </repository>
>    </repositories>
>
>    <pluginRepositories>
>        <pluginRepository>
>            <id>maven2-repository.dev.java.net</id>
>            <url>http://download.java.net/maven/2</url>
>            <layout>default</layout>
>        </pluginRepository>
>    </pluginRepositories>
>
> </project>
>
> Andrew Rampulla
>
> ________________________________
> The information contained in this message is legally privileged and  
> confidential, and is intended for the individual or entity to whom  
> it is addressed (or their designee). If this message is read by  
> anyone other than the intended recipient, please be advised that  
> distribution of this message, in any form, is strictly prohibited.  
> If you have received this message in error, please notify the sender  
> immediately and delete or destroy all copies of this message.