This below java.net javaee.jar solution is only contains the J2ee APIs, it does not contain any method bodies. It’s fine for compilation, but not for run or deploy your application, because it will caused ” Absent Code attribute in method that is not native or abstract in class” or other method not found errors. Due to policy, it’s not possible to include this javaee.jar in any public Maven repository.

The best practice is always get the original full version of javaee.jar from the http://www.oracle.com/technetwork/java/javaee/overview/index.html, and include it into your project manually.

The J2EE API library (javaee.jar or javaee-api.jar) is not available in the default Maven repository (http://repo1.maven.org/maven2/). You need to download it from Java.Net repository.

1. Add Java.Net reporitory

<repository>
 	<id>Java.Net</id>
  	<url>http://download.java.net/maven/2/</url>
</repository>

2. Add the J2EE dependency

<dependency>
   	<groupId>javax</groupId>
   	<artifactId>javaee-api</artifactId>
   	<version>6.0</version>
</dependency>

Full pom.xml example

<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.mkyong</groupId>
  <artifactId>SpringWebExample</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>SpringWebExample Maven Webapp</name>
  <url>http://maven.apache.org</url>
 
  <repositories>
  	<repository>
  		<id>Java.Net</id>
  		<url>http://download.java.net/maven/2/</url>
  	</repository>
  </repositories>
 
  <dependencies>
    <!-- Javaee API -->
	<dependency>
    	<groupId>javax</groupId>
    	<artifactId>javaee-api</artifactId>
    	<version>6.0</version>
	</dependency>
  </dependencies>
  <build>
    <finalName>SpringWebExample</finalName>
  </build>
</project>

Reference

  1. http://weblogs.java.net/blog/ludo/archive/2007/01/java_ee_5_apis.html
Tags :
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider making a donation to the charity, thanks.

Related Posts

Popular Posts