![]() | ![]() | ![]() | ![]() | ![]() | ![]() | |||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | |||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | |||||||||||||||||||||||||||||||||||||||||||
![]() | ![]()
![]() ![]() |
Notes Before we start Installing Everything ![]() ![]() ![]() ![]() Example Servlet What if it Didn't Work? NotesThis is a rough draft of how to set up Tomcat with OpenEJB on Window's 2000. These are the minimum steps for integrating OpenEJB into Tomcat. The commands in this document are specifically for a Window's DOS prompt and Window's environment. Please feel free to add to this document or email the openejb-user mailing list with your suggetions. Your suggestions are always welcome! Before we startWe always tell users to send us info on their OS and what version of OpenEJB, Java, or any other programs they are using when they submit support requests. So, I guess it's only fair I do the same. Here is some information about my setup
Here's the version of Window's and Java that I'm using:
Installing EverythingInstall TomcatIf you don't already have Tomcat on your machine, download the Tomcat version of your choice from Apache.
http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/
Install Tomcat
Go to the directory you downloaded and double click jakarta-tomcat-xxx.exe. An install
shield will pop up and ask you for several options. You may wish to click the check box that
installs Tomcat as an NT service.
Once Tomcat is finished installing, it will automatically start up and you can test it by visiting this link: http://localhost:8080. If there are any problems, consult the Tomcat documentation on their website. Install OpenEJBYou need OpenEJB 0.9.0 or higher, any older versions of OpenEJB will not work. You can get that here: http://openejb.sf.net/download.html - download the zip version of OpenEJB. If you do not have a zip utility, you can get WinZip here: http://download.com.com/3000-2250-10161502.html Unpack OpenEJB Open your zip utility and unpack OpenEJB into the C:\ folder, or one that makes sense to you. For our examples, we'll unpack it into c:\openejb-0.9.0 Hook them togetherGo to the Tomcat Dir. In our case it should be: C:\Program Files\Apache Group\Tomcat 4.1 Add the OpenEJB Loader to Tomcat We'll want to copy openejb_loader-0.9.0.war from the OpenEJB dist directory to the Tomcat webapps directory. ![]() ![]() If you add openejb_loader-0.9.0.war to the webapps directory while Tomcat is running, it should automatically unpack the file and create a openejb_loader-0.9.0 folder. If it doesn't automatically extract, check the server.xml file that comes with Tomcat. Now, let the OpenEJB Loader webapp know where to find your OpenEJB distribution by setting the openejb.home init-param. Open the web.xml file in the directory webapps\openejb_loader-0.9.0\WEB-INF. Uncomment the openejb.home init-param then change the value from the default value to the actual path of your OpenEJB home directory. ![]() Restart TomcatNow, stop Tomcat and then start it again. ![]() 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
The openejb.home is taken care of for us with the OpenEJB Loader webapp , so no other JNDI options are needed by your servlets to get an InitialContext from OpenEJB Example ServletYou 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 Once deployed, the myHelloEjb.jar should be in the beans directory.
You can use the HelloOpenEJB servlet below as an example of a servlet that looks up beans from 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
Now, pop open your browser and go to the following URL.
Should say "Hello World!!!" on the screen What if it Didn't Work?
1. Try re-starting Tomcat. The war file that was copied or the environment
variable that we set may not have gotten picked up by Tomcat. | ![]() | |||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | |||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | |||||||||||||||||||||||||||||||||||||||||||||||
![]() |