![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]()
![]() ![]() |
Notes Before we start Installing Everything ![]() ![]() ![]() Example Servlet NotesThese are my notes from writing the Tomcat/OpenEJB integration. These are the minimum steps for integrating OpenEJB into Tomcat. The commands in this document are specifically for a bash shell in either Linux, Unix, Mac OS X or Windows with Cygwin. The steps will be the same for the Windows Command Prompt, but the syntax of the commands themselves will obviously be different. Aside from that, there isn't a whole lot of information on what is going on behind the sences. So, I encourage *anyone* to feel completely welcome (perhaps obligated) to rewrite this document. Anyone...anyone...Bueller...Bueller.... Regardless, this should help people get started. So here goes. 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
Installing EverythingInstall TomcatIf you don't already have Tomcat on your machine, download the Tomcat version of your choice from Apache we recommend the latest version as it has the most up-to-date libraries) In our example, we'll be using version 4.1.12. http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/ Unpack Tomcat
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 Unpack OpenEJB
Hook them togetherGo to the Tomcat Dir
Pass the OPENEJB_HOME dir into Tomcat using the CATALINA_OPTS environment variable
Add the OpenEJB Loader to Tomcat
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 CATALINA_OPTS variable, so no other JNDI options are needed 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 you can start Tomcat...
Now, pop open your browser and go to the following URL.
Should say "Hello World!!!" on the screen | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |