Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Open source Java projects: TomEE

Scale to enterprise with the Java EE 6 Web container built on Tomcat

  • Print
  • Feedback

Page 2 of 6

If your application only requires those technologies, then you can take advantage of TomEE's lightweight, low-overhead container. Projects that need a little more might consider using TomEE+, which is currently not Java EE 6 Certified. TomEE+ includes support for SOAP and RESTful web services, as well as JMS and the Java EE Connector Architecture. See the OpenEJB homepage for an up-to-date matrix comparing features available in Tomcat, TomEE, TomEE Plus, and OpenEJB.

You can download TomEE or TomEE+ from the TomEE homepage. Note that I used TomEE+ for the sample application, though you should be able to follow along with either version.

TomEE in your development environment

After you've downloaded TomEE or TomEE+, decompress it to a directory on your computer. Just like Tomcat, TomEE requires that you install a JDK and configure a JAVA_HOME environment variable. The JAVA_HOME environment variable should point to the root of the directory in which you installed the JDK and you should add the JAVA_HOME/bin directory to your PATH environment variable.

You can set the JAVA_HOME on Windows with the following command (assuming that you installed your JDK in C:\Program Files\Java):

set JAVA_HOME="C:\Program Files\Java"
set PATH=%PATH$;%JAVA_HOME%\bin

Note that if you are using Windows and do not want to run this command for each new command prompt, you can configure a system- and user-level environment variable through the System configuration in your control panel.

Likewise, on Linux or Mac you can use the following command:

export JAVA_HOME=/home/user/Java
export PATH=$PATH:$JAVA_HOME/bin

Once you have TomEE installed and decompressed locally and you have your JAVA_HOME set, then you can start up TomEE by executing the startup.bat or startup.sh file from TomEE's bin directory. Like Tomcat, TomEE writes its default logs to logs/catalina.out. If everything starts up correctly you should see something like the following in your log file:

May 24, 2012 10:35:10 PM org.apache.catalina.core.AprLifecycleListener init
May 24, 2012 10:35:13 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
May 24, 2012 10:35:14 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
May 24, 2012 10:35:18 PM org.apache.openejb.server.ServiceLogger <clinit>
INFO: can't find log4j MDC class
May 24, 2012 10:35:18 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: ********************************************************************************

...

May 24, 2012 10:35:43 PM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
WARNING: No mappings of FacesServlet found. Abort initializing MyFaces.
May 24, 2012 10:35:43 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
May 24, 2012 10:35:43 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
May 24, 2012 10:35:43 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 15197 ms

The TomEE log file is much larger than a traditional Tomcat log file because TomEE is starting far more services than Tomcat. An informational message that states "Server startup in xxx ms" indicates that the server started successfully. To validate that TomEE is running, open a web browser to the "tomee" web context on the machine on which TomEE is running, for example:

  • Print
  • Feedback

Resources

More about deployment servers, containers, and platforms on JavaWorld

From Apache's OpenEJB/TomEE homepage

More from JavaWorld