EJB
Download java_app_platform_sdk-5_02-windows-nojdk.exe
from the Sun web
site.
I installed to:
C:\tools\Sun\SDK\
User Name |
Password |
---|---|
|
|
JEE
Sample project: https://weezy/svn/development/sample/java/sample-maven-j2ee-simple
Creating a simple j2ee Project
See Maven - Getting Started - JEE, Getting Started.
Dependencies
For the JEE repositories:
<repositories>
<repository>
<id>java.net</id>
<url>http://download.java.net/maven/1</url>
<layout>legacy</layout>
</repository>
</repositories>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
<scope>provided</scope>
</dependency>
Maven
Using the Maven EJB Plugin.
Set the packaging
for the module to ejb
and the ejbVersion
to 3.0:
<packaging>ejb</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<ejbVersion>3.0</ejbVersion>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
…and using the Maven WAR Plugin
This is a useful note on creating a minimal web.xml
:
Creating minimal web.xml for your servlet.
Test
I managed to run my test servlet at: http://localhost:8080/j2ee-simple-servlet/HelloClientServlet
I found the URL by checking the log entry where the servlet was deployed:
Loading web module [j2ee-simple-ear-1:j2ee-simple-servlet-1.0.war] in virtual server [server] at [/j2ee-simple-servlet]
Dependency Injection
To get dependency injection working with the @EJB
attribute I had to update
the web.xml
version to 2.5
. Click here for more information,
Issues