User: dewayne
Date: 01/02/09 22:09:58
Modified: business jboss-tomcat.html
Log:
Updated to contain information about the new EmbeddedTomcat service
Revision Changes Path
1.5 +206 -163 newsite/business/jboss-tomcat.html
Index: jboss-tomcat.html
===================================================================
RCS file: /products/cvs/ejboss/newsite/business/jboss-tomcat.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- jboss-tomcat.html 2001/02/08 05:31:21 1.4
+++ jboss-tomcat.html 2001/02/10 06:09:58 1.5
@@ -1,162 +1,192 @@
<html>
- <head>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
- <meta name="generator" content="Adobe GoLive 4">
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta name="generator" content="Adobe GoLive 4">
<link rel="stylesheet" type="text/css" href="main.css" >
- </head>
+ </head>
- <body marginwidth="0" marginheight="0" onload="">
- <table border="0" cellpadding="0" cellspacing="3">
- <tr>
- <td width="600" valign="top">
- <table border="0" cellpadding="2"
cellspacing="0">
- <tr>
-
- <td class="pageheader"><b>JBoss/Apache</b></td>
- </tr>
- <tr>
- <td class="newsheader"><b>A
Full J2EE Stack</b></td>
- </tr>
- <tr>
- <td class="newsbody"><img
height="71" width="100" src="../pictures/tomcat_3.gif" align="left">The JBoss
organization wants to deliver a complete J2EE based product to the market. The JBoss
organization decided to integrate the Tomcat engine stack with a running version of
JBoss in a single VM. Now you can serve all your servlet and JSP needs with 2 simple
downloads and a couple of configuration files. Check out the Tomcat <a
href="http://jakarta.apache.org" target="_top">homepage</a> for information related to
Tomcat.
- <p>The goal of this
page is to explain how to make JBoss automatically start Tomcat, so that it runs in
the same VM.</p>
- <p>We now run<b>
optimized stacks </b>the JSP/Servlet engine talks natively with the EJB engine
resulting in dramatic speed increases. Without the optimization the invocation is
through the network layer. With the optimized layers the invocation<b> is
native, inVM</b>, within the same stack of APIs</td>
- </tr>
- <tr>
- <td
class="newsheader"><b>Features</b></td>
- </tr>
- <tr>
- <td class="newsbody">
- <ul>
- <li><font
face="Myriad Web,Arial">Support for Tomcat 3.2 and up</font>
- <li><font
face="Myriad Web,Arial">Coming support for Catalina</font>
- <li><font
face="Myriad Web,Arial">Full j2ee integration in JMX</font>
- <li><font
face="Myriad Web,Arial">single startup/shutdown script</font>
- <li><font
face="Myriad Web,Arial">Separated stacks inVM</font>
- <li><font
face="Myriad Web,Arial">Integrated stacks inVM</font>
- <li><font
face="Myriad Web,Arial">J2EE deployer for JBoss/Tomcat</font>
- <li><font
face="Myriad Web,Arial">Full EAR support</font>
- <li><font
face="Myriad Web,Arial">JBoss Auto-Deploy for EAR</font>
- <li><font
face="Myriad Web,Arial">JNDI shared visibility</font>
- <li><font
face="Myriad Web,Arial">Integrated Security Model</font>
- </ul>
- </td>
- </tr>
- <tr>
- <td
class="newsheader"><b>Mailing lists</b></td>
- </tr>
- <tr>
- <td class="newsbody"><font
face="Myriad Web,Arial">Refer to Tomcat's </font><a href="http://jakarta.apache.org"
target="_top">homepage</a> for questions specific to Tomcat deployment.
- <p>Questions about the
J2EE deployer and the integration should be posted to <a href="lists.html">our
lists</a> (jboss)</td>
- </tr>
- <tr>
- <td
class="newsheader"><b>Distribution and CVS</b></td>
- </tr>
- <tr>
- <td class="newsbody"><font
face="Myriad Web,Arial">JBoss tomcat is shipped as part of the <a
href="binary.html">standard JBoss/Server package</a></font>
- <p><font face="Myriad
Web,Arial">CVS module is <a href="cvs.html">contrib</a></font></td>
- </tr>
- <tr>
- <td
class="newsheader"><b>How-to install</b></td>
- </tr>
- <tr>
- <td class="newsbody"><font
face="Myriad Web,Arial">You will need</font>
- <ul>
- <li><font
face="Myriad Web,Arial">JBoss 2.0. BETA-PROD 03 or higher</font>
- <li><font
face="Myriad Web,Arial">Tomcat Version 3.2b4. </font>
- </ul>
- <p>You can get the
latest release of tomcat from the jakarta website. NOTE: This has been tested with
tomcat up to 3.2b6, and should work with the forthcoming final 3.2 version. However it
won't run on tomcat 3.1, and tomcat 3.3 is not suppported yet.</p>
- <ol>
-
<li><strong>Setup environment variables.</strong>In whatever batch or shell script you
use to launch JBoss and Tomcat, add entries for the following environment variables:
- <table
border="1">
- <tr>
-
<th>variable</th>
-
<th>value</th>
- </tr>
- <tr>
-
<td align="right" valign="top">TOMCAT_HOME</td>
-
<td>The base directory of Tomcat's binaries. With the binary distribution, this would
be jakarta-tomcat under your installation root.</td>
- </tr>
- <tr>
-
<td align="right" valign="top">JAVA_HOME</td>
-
<td>The base directory of your JDK 1.2.2 or 1.3 installation</td>
- </tr>
- <tr>
-
<td align="right" valign="top">CLASSPATH</td>
-
<td>This should <i>not include anything</i> (unless you really know what you're
doing!). Both Tomcat and JBoss have startup scripts that load the necessary JARs onto
the classpath.</td>
- </tr>
- </table>
-
<li><strong>Edit jboss.conf.</strong> It is located in the conf directory under the
base of your JBoss binary distribution, or the dist/conf directory if you built from
the JBoss source. There are some commented-out lines near the end of the file that
deal with Tomcat:
- <pre><!--
- -- Uncomment this to add Tomcat support.
- -- This service allows you to add and remove Tomcat contexts dynamically
- -- through JMX. Note that tomcat's server.xml file will not be processed:
- -- you can only use JMX to add contexts.
- -- Be sure to set your 'TOMCAT_HOME' environment variable before starting
- -- JBoss.
- -- The ARG tag is the port to run tomcat on.
- -- MLET CODE = "org.jboss.tomcat.EmbeddedTomcatService"
- -- ARCHIVE="jboss.jar" CODEBASE="../lib/ext/">
- -- ARG TYPE="int" VALUE=8080>
- -- /MLET>
- --></pre>
- <p>You need to
uncomment these lines so they read as follows (note you must add the < signs at the
beginning of three relevant lines!):</p>
- <pre> <MLET
CODE = "org.jboss.tomcat.EmbeddedTomcatService"
- ARCHIVE="jboss.jar" CODEBASE="../lib/ext/">
- <ARG TYPE="int" VALUE=8080>
- </MLET></pre>
-
<li><strong>Start JBoss.</strong> If you start JBoss now by typing <code>run.sh</code>
(or <code>run.bat</code> for Windows) you should see the following Tomcat related
output in your log messages:
- <pre> ...
-[EmbeddedTomcat] Initializing
-[EmbeddedTomcat] Initialized
-[EmbeddedTomcat] Starting
-[EmbeddedTomcat] Testing if Tomcat is present....
-[EmbeddedTomcat] OK
-[EmbeddedTomcat] ContextManager: Adding context Ctx( )
-[EmbeddedTomcat] path="" :jsp: init
-[EmbeddedTomcat] PoolTcpConnector: Starting HttpConnectionHandler on 8080
-[EmbeddedTomcat] Started
- ...</ol>
-
+ <body marginwidth="0" marginheight="0" onload="">
+ <table border="0" cellpadding="0" cellspacing="3">
+ <tr>
+ <td width="600" valign="top">
+ <table border="0" cellpadding="2" cellspacing="0">
+ <tr>
+
+ <td class="pageheader"><b>JBoss/Tomcat/Apache</b></td>
+ </tr>
+ <tr>
+ <td class="newsheader"><b>A Full J2EE Stack</b></td>
+ </tr>
+ <tr>
+ <td class="newsbody"><img height="71" width="100"
src="../pictures/tomcat_3.gif" align="left">The JBoss organization wants to deliver a
complete J2EE based product to the market. The JBoss organization decided to integrate
the Tomcat engine stack with a running version of JBoss in a single VM. Now you can
serve all your servlet and JSP needs with 2 simple downloads and a couple of
configuration files. Check out the Tomcat <a href="http://jakarta.apache.org"
target="_top">homepage</a> for information related to Tomcat.
+ <p>The goal of this page is to explain how to make
JBoss automatically start Tomcat, so that it runs in the same VM.</p>
+ <p>We now run<b> optimized stacks </b>the
JSP/Servlet engine talks natively with the EJB engine resulting in dramatic speed
increases. Without the optimization the invocation is through the network layer.
With the optimized layers the invocation<b> is native, inVM</b>, within the same
stack of APIs</td>
+ </tr>
+ <tr>
+ <td class="newsheader"><b>Features</b></td>
+ </tr>
+ <tr>
+ <td class="newsbody">
+ <ul>
+ <li><font face="Myriad Web,Arial">Parsing of
server.xml for full Tomcat configuration support</font>
+ <li><font face="Myriad Web,Arial">Support for
Tomcat 3.2 and up</font>
+ <li><font face="Myriad Web,Arial">Coming
support for Catalina</font>
+ <li><font face="Myriad Web,Arial">Full j2ee
integration in JMX</font>
+ <li><font face="Myriad Web,Arial">single
startup/shutdown script</font>
+ <li><font face="Myriad Web,Arial">Separated
stacks inVM</font>
+ <li><font face="Myriad Web,Arial">Integrated
stacks inVM</font>
+ <li><font face="Myriad
Web,Arial">J2EE deployer for JBoss/Tomcat</font>
+ <li><font face="Myriad Web,Arial">Full
EAR support</font>
+ <li><font face="Myriad Web,Arial">JBoss
Auto-Deploy for EAR</font>
+ <li><font face="Myriad
Web,Arial">JNDI shared visibility</font>
+ <li><font face="Myriad Web,Arial">Integrated
Security Model</font>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td class="newsheader"><b>Mailing lists</b></td>
+ </tr>
+ <tr>
+ <td class="newsbody"><font face="Myriad
Web,Arial">Refer to Tomcat's </font><a href="http://jakarta.apache.org"
target="_top">homepage</a> for questions specific to Tomcat deployment.
+ <p>Questions about the J2EE deployer and the
integration should be posted to <a href="lists.html">our lists</a> (jboss)</td>
+ </tr>
+ <tr>
+ <td class="newsheader"><b>Distribution and CVS</b></td>
+ </tr>
+ <tr>
+ <td class="newsbody"><font face="Myriad
Web,Arial">JBoss Tomcat is shipped as part of the <a href="binary.html">standard
JBoss/Server package</a></font>
+ <p><font face="Myriad Web,Arial">CVS module is <a
href="cvs.html">contrib</a></font></td>
+ </tr>
+ <tr>
+ <td class="newsheader"><b>How-to install</b></td>
+ </tr>
+ <tr>
+ <td class="newsbody"><font face="Myriad Web,Arial">You
will need</font>
+ <ul>
+ <li><font face="Myriad Web,Arial">JBoss
Pre-2.1</font>
+ <li><font face="Myriad Web,Arial">Tomcat
Version 3.2. </font>
+ </ul>
+ <p>You can get the latest release of tomcat from
the jakarta website. NOTE: This has been tested with tomcat 3.2. However it won't run
on tomcat 3.1, and tomcat 3.3 is not suppported yet.</p>
+ <ol>
+ <li><strong>Setup start script.</strong>
+ <br>
+ In JBOSS_HOME/bin/run.sh (or run.bat), add the
following:
+ <br>
+<pre>
+TOMCAT_HOME= ... change this to be where Tomcat lives ...
+
+# Add all login modules for JAAS-based security
+# and all libraries that are used by them here
+
+if [ "${TOMCAT_HOME}X" != "X" ] ; then
+ if [ -x $TOMCAT_HOME ] ; then
+ echo "Adding jar files in ${TOMCAT_HOME}/lib to CLASSPATH"
+ CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib"
+ CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib/servlet.jar"
+ CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib/webserver.jar"
+ CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib/xml.jar"
+ CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib/jaxp.jar"
+ CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib/parser.jar"
+ CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib/jasper.jar"
+
+ # Add the tools.jar file so that Tomcat can find the Java compiler.
+ CLASSPATH="$CLASSPATH:$JAVA_HOME/lib/tools.jar"
+ else
+ echo "TOMCAT_HOME is set, but is an invalid directory"
+ fi
+fi
+</pre>
+and change
+<pre>
+java -server -classpath $CLASSPATH org.jboss.Main $@
+to
+java -server -classpath $CLASSPATH -Dtomcat.home=$TOMCAT_HOME org.jboss.Main $@
+</pre>
+ <li><strong>Edit jboss.jcml.</strong><br>
+ It is located in the conf/default directory
under the base of your JBoss binary distribution,
+ or the dist/conf/default directory if you
built from the JBoss source.
+ There are some commented-out lines that deal
with Tomcat:
+<pre>
+ <!--
+ Uncomment to add embedded tomcat service
+ <mbean code="org.jboss.tomcat.EmbeddedTomcatService"
name="DefaultDomain:service=EmbeddedTomcat" />
+ -->
+</pre>
+ <p>You need to uncomment the mbean line so it
reads as follows :</p>
+<pre>
+ <!--
+ Uncomment to add embedded tomcat service
+ -->
+ <mbean code="org.jboss.tomcat.EmbeddedTomcatService"
name="DefaultDomain:service=EmbeddedTomcat" />
+</pre>
+<p>
+Further down in the jboss.jcml file, make sure your J2eeDeployer is set as:
+</p>
+
+<pre>
+ <mbean code="org.jboss.deployment.J2eeDeployer"
name="J2EE:service=J2eeDeployer">
+ <attribute name="DeployerName">Default</attribute>
+ <attribute name="JarDeployerName">:service=ContainerFactory</attribute>
+ <attribute name="WarDeployerName">:service=EmbeddedTomcat</attribute>
+ <mbean>
+</pre>
+ <li><strong>Start JBoss.</strong> <br>
+ If you start JBoss now by typing
<code>run.sh</code> (or <code>run.bat</code> for Windows) you should see the following
Tomcat related output in your log messages:
+<pre>
+ ...
+[EmbeddedTomcat] Starting
+[EmbeddedTomcat] Starting EmbeddedTomcat....
+[EmbeddedTomcat] Starting tomcat. Check logs/tomcat.log for error messages
+[EmbeddedTomcat] No apps in webapps/
+2001-02-09 11:16:46 - PoolTcpConnector: Starting HttpConnectionHandler on 8080
+2001-02-09 11:16:46 - PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007
+[EmbeddedTomcat] OK
+2001-02-09 11:16:47 - PoolTcpConnector: Starting Ajp13ConnectionHandler on 8009
+[EmbeddedTomcat] Started
+ ...
</pre>
- <p>That's it !! You
just have to launch JBoss now and it will start Tomcat and you will have an
EJB/JSPs/Servlets server running in one VM...</td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td class="newsheader" width="600"><b>How-to package
and deploy an EAR file on JBoss/Tomcat</b></td>
- </tr>
- <tr>
- <td class="newsbody" width="600">In order to benefit
from the classloader integration, you have to deploy your application in an EAR file
as recommended by the <a
href="http://java.sun.com/j2ee/download.html#platformspec">J2EE specification</a>.
- <p><b>Tomcat's server.xml file will not be
processed!</b></p>
- <p>The reason is that we want to share the
classloader for your application between tomcat and jboss. Since this classloader must
be initialized at deployment time, your EJBs and your servlets/JSPs must be bundled
together for jboss to know who talks to whom!</p>
- <p>In case you don't want to read all the J2EE
spec, here is a brief summary of what you have to do:</p>
- <ol>
- <li><b>Write your beans</b> and
package them in an ejb-jar file. You don't have to do anything special here. See the
<a href="../../projects/jbossweb/manual/developing.html">manual</a> for details on how
to package beans for jboss.<br>
-
- <li><b>Write your servlets/JSPs</b>
and package them in a war file. Add a Class-Path attribute to your war files
MANIFEST.MF file
+
+ <p>That's it !! Note that the connection handlers
+ are configured from Tomcat's server.xml file.
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td class="newsheader" width="600"><b>How-to package and deploy an
EAR file on JBoss/Tomcat</b></td>
+ </tr>
+ <tr>
+ <td class="newsbody" width="600">In order to benefit from the
classloader integration, you have to deploy your application in an EAR file as
recommended by the <a href="http://java.sun.com/j2ee/download.html#platformspec">J2EE
specification</a>.
+
+ <p>In case you don't want to read all the J2EE spec, here is a
brief summary of what you have to do:</p>
+ <ol>
+ <li><b>Write your beans and package them in an ejb-jar
file.</b></br>
+ You don't have to do anything special here. See the <a
href="../../projects/jbossweb/manual/developing.html">manual</a> for details on how to
package beans for JBoss.<br>
+
+ <li><b>Write your servlets/JSPs and package them in a war
file.</b><br>
+ Add a Class-Path attribute to your war files MANIFEST.MF
file
to reference your beans package. for detailed information
on that see: <a href="../documentation/J2eeDeployment_howto.html">J2eeDeployment
Howto</a>.<br>
- Assuming you have a bean deployed under
the jndi name "myBean", the calls to this bean from your servlets will look
like that:
- <pre>MyBeanHome home = (MyBeanHome)new
InitialContext().lookup("myBean");
+ Assuming you have a bean deployed under the jndi name
"myBean", the calls to this bean from your servlets will look like that:
+ <pre>MyBeanHome home = (MyBeanHome)new
InitialContext().lookup("myBean");
MyBean bean = home.create();</pre>
- <p><b>Notes</b>:</p>
- <ul>
- <li>We don't support lookups
in the "java:" namespace from the servlets yet, but work is in progress
(MF FIXME: I think this is done).
- <li>Since jboss takes care of
the classloader stuff, you don't have to include much in the WEB-INF/lib directory:
you don't need any of your beans interfaces, and you don't need the old
jboss-client.jar, jnp-client.jar...
- </ul>
- <p><br>
- </p>
- <li><b>Package your application in an
ear file</b>. An ear file is a jar archive which contains:
- <ul>
- <li>Your jar files
- <li>Your war files
- <li>A deployment descriptor
for your application. This file must be named "application.xml", and must be
located in the META-INF directory in the ear archive. This file tells jboss which
modules are EJBs, which ones are web modules, and the context paths for the
web-modules. Here is a sample application.xml file:
- <pre><?xml
version="1.0" encoding="ISO-8859-1"?>
+ <p><b>Notes</b>:</p>
+ <ul>
+ <li>We don't support lookups in the "java:"
namespace from the servlets yet, but work is in progress (MF FIXME: I think
this is done).
+ <li>Since JBoss takes care of the classloader stuff,
you don't have to include much in the WEB-INF/lib directory: you don't need any of
your beans interfaces, and you don't need the old jboss-client.jar, jnp-client.jar...
+ </ul>
+ <br>
+ <li><b>Package your application in an ear file</b>.<br>
+ An ear file is a jar archive which contains:
+ <ul>
+ <li>Your jar files
+ <li>Your war files
+ <li>A deployment descriptor for your application. This
file must be named "application.xml", and must be located in the META-INF
directory in the ear archive. This file tells JBoss which modules are EJBs, which ones
are web modules, and the context paths for the web-modules. Here is a sample
application.xml file:
+ <pre><?xml version="1.0"
encoding="ISO-8859-1"?>
<application>
<display-name>My application</display-name>
@@ -173,19 +203,32 @@
</module>
</application></pre>
- <p>See also the <a
href="http://java.sun.com/j2ee/dtds/application_1_2.dtd">DTD</a> for application.xml
on Javasoft's website.</p>
- </ul>
- <p> </p>
- <li><b>Deploy your ear file</b>. Surf
to http://yourhost:8082, and find the J2eeDeployer service. Give it the URL of your
ear file (don't forget the protocol, be it http: or file:), and click on the deploy
button.<br>
-
- <li>That's it! The server console
should show your application being deployed on tomcat and jboss, and your web module
should be available on http://yourhost:8080/servlets (assuming the context-root was
"/servlets").
- </ol>
- <p>For a full example including a servlet and
an EJB, see the <a
href="../../projects/jbossweb/zip_archives/contrib-cvs-sources.zip">contrib</a>
module</td>
- </tr>
- <tr>
- <td width="600"></td>
- </tr>
- </table>
- </body>
+ <p>See also the <a
href="http://java.sun.com/j2ee/dtds/application_1_2.dtd">DTD</a> for application.xml
on Javasoft's website.</p>
+ </ul>
+ <li><b>Deploy your ear file</b>.<br>
+ Option 1: Copy your ear file to JBOSS_HOME/deploy (wow!)
+ <p></p>
+ Option 2: Surf to http://yourhost:8082, and find the
+ J2eeDeployer service. Give it the URL of your ear file
(don't forget the protocol, be it http: or file:), and click on the deploy button.<br>
+
+ <li><b>That's it!</b><br>
+ The server console should show your application being
deployed
+ on Tomcat and JBoss, and your web module should be
available
+ on http://yourhost:8080/servlets (assuming the
context-root was "/servlets").
+ <p>
+ <b>Note</b>: Even though JBoss and Tomcat are
+ cooperating to dynamically deploy your application,
Apache must
+ be configured manually. This means that for your
application
+ to be visible through Apache, you must setup the
appropriate
+ JkMount statements in mod_jk.conf.
+ </p>
+ </ol>
+ <p>For a full example including a servlet and an EJB, see the
<a href="../../projects/jbossweb/zip_archives/contrib-cvs-sources.zip">contrib</a>
module</td>
+ </tr>
+ <tr>
+ <td width="600"></td>
+ </tr>
+ </table>
+ </body>
</html>