These instructions are out of date and are currently being worked on. In the mean time, please use the installer servlet.
InstallOpenEJB">Install OpenEJB
Once Tomcat has been installed, the OpenEJB plugin for Tomcat can be installed. The commands in this example are executed within the Tomcat installation directory.
Unpack OpenEJB Tomcat plugin in Tomcat webapps directory
Change to the webapps directory:
apache-tomcat-6.0.14$ cd webapps
Unpack the openejb-tomcat-3.0.0-SNAPSHOT-bin.zip file.
apache-tomcat-6.0.14/webapps$ jar -xvf ../openejb-tomcat-3.0.0-SNAPSHOT-bin.zip created: openejb/ created: openejb/WEB-INF/ created: openejb/lib/ inflated: openejb/lib/geronimo-javamail_1.4_spec-1.1.jar inflated: openejb/lib/xbean-finder-3.1.jar ...snip...
The OpenEJB directory should contain the following files:
apache-tomcat-6.0.14/webapps$ ls openejb WEB-INF/ lib/ openejb.xml
Return to the Tomcat install directory
apache-tomcat-6.0.14/webapps$ cd ..
Add the OpenEJB listener to Tomcat
Tomcat listeners must be available in the Tomcat common class loader, so the openejb-loader jar must be copied into the Tomcat lib directory.
apache-tomcat-6.0.14$ cp webapps/openejb/lib/openejb-loader-3.0.0-SNAPSHOT.jar lib/
Add the following
highlighted lines
to your conf/server.xml file to load the OpenEJB listener:
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<!-- OpenEJB plugin for tomcat -->
<Listener className="org.apache.openejb.loader.OpenEJBListener" />
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
...snip...
Delete the Tomcat annotations-api.jar file
Tomcat contains an old non-compliant version of the javax.annotation classes and these invalid classes must be removed so OpenEJB can process annotations. Simply, rename the annotation-api.jar so it doesn't end with ".jar"
. For example:
apache-tomcat-6.0.14$ mv lib/annotations-api.jar lib/annotations-api.jar-INVALID
Add OpenEJB javaagent to Tomcat startup
OpenJPA, the Java Persistence implementation used by OpenEJB, currently must enhanced persistence classes to function properly, and this requires the installation of a javaagent into the Tomcat startup process.
Simply, add the following
highlighted lines
to the bin/catalina.sh file to enable the OpenEJB javaagent:
...snip...
# Set juli LogManager if it is present
if [ -r "$CATALINA_BASE"/conf/logging.properties ]; then
JAVA_OPTS="$JAVA_OPTS "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" "-Djava.util.logging.config.file="$CATALINA_BASE/conf/logging.properties"
fi
# Add OpenEJB javaagent
if [ -r "$CATALINA_BASE"/webapps/openejb/lib/openejb-javaagent-3.0.0-SNAPSHOT.jar ]; then
JAVA_OPTS=""-javaagent:$CATALINA_BASE/webapps/openejb/lib/openejb-javaagent-3.0.0-SNAPSHOT.jar" $JAVA_OPTS"
fi
# ----- Execute The Requested Command -----------------------------------------
# Bugzilla 37848: only output this if we have a TTY
if [ $have_tty -eq 1 ]; then
echo "Using CATALINA_BASE: $CATALINA_BASE"
...snip...
NOTE: The example above is an excerpt from the middle of the bin/catalina.sh file. Search for "Execute" in the file to locate the correct position in the file to add the new lines.