All,

Give the following instructions and tools a try for an easy Tomcat and
OpenEJB integration.  This will setup Tomcat to use the OpenEJB Local
Server.  Basically, you copy the attached openejb_loader-0.8.3.jar into
CATALINA_HOME/common/lib directory of a fresh Tomcat install.  Then you
set the JAVA_OPTS variable to "-Dopenejb.home=$OPENEJB_HOME".  

That's it.  Pretty much just two steps.

The instructions are with JDK 1.3.1, Tomcat 4.1.12, OpenEJB 0.8.3,
Windows 2000 with Cygwin 1.3.12.

Let us know how it goes.  I'd really like to workout any issues now so
we can release it with 0.8.4 and know that it works well for everyone
with all platforms, Tomcat versions, and JDKs.

-David
#------------------------------------------
# Here is some information about my setup
#------------------------------------------
    dblevins@Miles /dev/j2ee
    $ pwd
    /dev/j2ee
    
    dblevins@Miles /dev/j2ee
    $ uname -a
    CYGWIN_NT-5.0 Miles 1.3.12(0.54/3/2) 2002-07-06 02:16 i686 unknown

    dblevins@Miles /dev/j2ee
    $ java -version
    java version "1.3.1"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
    Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)


#------------------------------------------
# Unpack Tomcat
#------------------------------------------
    
    dblevins@Miles /dev/j2ee
    $ tar xzvf jakarta-tomcat-4.1.12.tar.gz

#------------------------------------------
# Unpack OpenEJB
#------------------------------------------

    dblevins@Miles /dev/j2ee
    $ tar xzvf openejb-0.8.3.tar.gz

#------------------------------------------
# Go to the Tomcat Dir
#------------------------------------------

    dblevins@Miles /dev/j2ee
    $ cd jakarta-tomcat-4.1.12

#------------------------------------------
# Pass the OPENEJB_HOME dir into Tomcat
# using the JAVA_OPTS environment variable
#------------------------------------------
    
    dblevins@Miles /dev/j2ee/jakarta-tomcat-4.1.12
    $ export JAVA_OPTS='-Dopenejb.home=../openejb-0.8.3'

#------------------------------------------
# Add the OpenEJB Loader to Tomcat
#------------------------------------------
    
    dblevins@Miles /dev/j2ee/jakarta-tomcat-4.1.12
    $ cp ../openejb-0.8.3/dist/openejb_loader-0.8.3.jar common/lib/

#------------------------------------------
# NOTE: The openejb_loader-0.8.3.jar is 
# attached to this email and not in the dist
# directory.  In future releases, it will be 
# in the dist directory
#------------------------------------------

#------------------------------------------
# At this point, you're actually finished.
# All the libraries you need are in place.
# Your servlets should use the following
# InitialContextFactory when creating
# an InitialContext to lookup beans
#------------------------------------------
org.openejb.client.LocalInitialContextFactory

#------------------------------------------
# The openejb.home is taken care of for us 
# with the JAVA_OPTS variable, so no other
# JNDI options are needed to get an
# InitialContext from OpenEJB
#------------------------------------------

#------------------------------------------
# You can use the OpenEJB Hello World as an
# example EJB to test things out. You won't
# need to do anything differently.  Deploy
# the myHelloEjb.jar just as described.
#------------------------------------------
http://openejb.sourceforge.net/hello-world.html

#------------------------------------------
# An already deployed myHelloEjb.jar is 
# attached to the email to save you the 
# trouble if you want to just skip right
# to the servlet part of the process.
# Just copy that right into the directory
#------------------------------------------
openejb-0.8.3/beans/myHelloEjb.jar
    
#------------------------------------------
# You can use the HelloOpenEJB servlet 
# attached to this email as an example of a
# servlet that looks up beans form OpenEJB
# It uses the HelloBean created in the 
# OpenEJB Hello World document, so you'll
# need to run through that first.
# You can put the servlet in the following 
# webapps directory
#------------------------------------------
    
    dblevins@Miles /dev/j2ee/jakarta-tomcat-4.1.12
    $ cp HelloOpenEJB* webapps/examples/WEB-INF/classes

#------------------------------------------
# Now you can start Tomcat...
#------------------------------------------

    dblevins@Miles /dev/j2ee/jakarta-tomcat-4.1.12
    $ ./bin/startup.sh
    Using CATALINA_BASE:   C:\dev\j2ee\jakarta-tomcat-4.1.12
    Using CATALINA_HOME:   C:\dev\j2ee\jakarta-tomcat-4.1.12
    Using CATALINA_TMPDIR: /dev/j2ee/jakarta-tomcat-4.1.12/temp
    Using JAVA_HOME:       C:\program_files\jdk1.3.1


#------------------------------------------
# Now, pop open your browser and go to the
# following URL.
#------------------------------------------
http://localhost:8080/examples/servlet/HelloOpenEJB

#------------------------------------------
# Should say "Hello World!!!" on the screen
#------------------------------------------

    

Attachment: myHelloEjb.jar
Description: Binary data

Attachment: HelloOpenEJB.java
Description: Binary data

Attachment: HelloOpenEJB.class
Description: Binary data

Attachment: openejb_loader-0.8.3.jar
Description: Binary data

Reply via email to