ClassFormatError when using javaee:javaee-api
Posted
by Digambar Daund
on Stack Overflow
See other posts from Stack Overflow
or by Digambar Daund
Published on 2010-05-20T11:01:57Z
Indexed on
2010/05/20
11:10 UTC
Read the original article
Hit count: 1409
This is my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>dd</groupId>
<artifactId>jee6</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>dd</groupId>
<artifactId>business-tier-impl</artifactId>
<name>business-tier-impl</name>
<version>0.0.1-SNAPSHOT</version>
<packaging>ejb</packaging>
<description>business-tier-impl</description>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.11</version>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-core</artifactId>
<version>3.1.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<ejbVersion>3.1.2</ejbVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Below is the testcase setup methhod:
@BeforeClass
public void bootContainer() throws Exception {
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
LocalInitialContextFactory.class.getName());
Context context = new InitialContext(props);
service = (HelloService) context.lookup("HelloServiceLocal");
}
I get error at line where InitialContext() is created...
Apache OpenEJB 3.1 build: 20081009-03:31
http://openejb.apache.org/
INFO - openejb.home = C:\DD\WORKSPACES\jee6\business-tier-impl
INFO - openejb.base = C:\DD\WORKSPACES\jee6\business-tier-impl
FATAL - OpenEJB has encountered a fatal error and cannot be started: OpenEJB encountered an unexpected error while attempting to instantiate the assembler.
java.lang.ClassFormatError: Absent Code attribute in method that is not native or
abstract in class file javax/resource/spi/ResourceAdapterInternalException
.
.
.
FAILED CONFIGURATION: @BeforeClass bootContainer
javax.naming.NamingException: Attempted to load OpenEJB. OpenEJB has encountered a fatal error and cannot be started: OpenEJB encountered an unexpected error while attempting to instantiate the assembler.: Absent Code attribute in method that is not native or abstract in class file javax/resource/spi/ResourceAdapterInternalException [Root exception is org.apache.openejb.OpenEJBException: OpenEJB has encountered a fatal error and cannot be started: OpenEJB encountered an unexpected error while attempting to instantiate the assembler.: Absent Code attribute in method that is not native or abstract in class file javax/resource/spi/ResourceAdapterInternalException]
at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:54)
at org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:41)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at dd.jee6.app.HelloServiceTest.bootContainer(HelloServiceTest.java:26)
Caused by: org.apache.openejb.OpenEJBException: OpenEJB has encountered a fatal error and cannot be started: OpenEJB encountered an unexpected error while attempting to instantiate the assembler.: Absent Code attribute in method that is not native or abstract in class file javax/resource/spi/ResourceAdapterInternalException
at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:133)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:299)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:278)
at org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:69)
at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:52)
... 28 more
Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/resource/spi/ResourceAdapterInternalException
at java.lang.ClassLoader.defineClass1(Native Method)
© Stack Overflow or respective owner