User: salborini
  Date: 00/10/23 19:36:27

  Modified:    .        tomcat.htm
  Log:
  Documentation about the tomcat's inVM integration
  
  Revision  Changes    Path
  1.6       +131 -79   jbossweb/tomcat.htm
  
  Index: tomcat.htm
  ===================================================================
  RCS file: /products/cvs/ejboss/jbossweb/tomcat.htm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- tomcat.htm        2000/09/07 16:51:31     1.5
  +++ tomcat.htm        2000/10/24 02:36:26     1.6
  @@ -121,7 +121,7 @@
                  get dramatically improved performance because the calls will
                  be intra-VM (no network access).</p>
                <p><font face="Myriad Web,Arial"><b><u><em>WARNING</em></u><br>
  -                   THIS VERSION IS FOR DEVELOPMENT AND EVALUATION ONLY.  Currently 
you can run Tomcat in the same VM as JBoss, but the performance will not be as fast as 
you would expect from in memory invocations the reason being that we serialize the 
method invocations.  We are working on an accelarated version, due out soon, that 
works with in memory objects, non-serialized.  A factor of 30 increase in performance 
is expected with this optimization (class loader integration).  Stay tuned for the 
first beta version.  We appreciate your understanding and patience on this integration 
work in progress.  </b></font></p>
  +                   THIS IS STILL A BETA VERSION.  </b></font></p>
              </td>
              <td valign="top" width="10"></td>
              <td align="right" valign="top" width="11">&nbsp;</td>
  @@ -167,9 +167,9 @@
            <tr>
              <td valign="top" width="672"><br>
                <ul>
  -                  <li>Tomcat Version 3.1.  You can get the <a 
href="http://jakarta.apache.org/builds/tomcat/release/v3.1/bin/jakarta-tomcat.tar.gz">Unix/Linux</a>
 version or the <a 
href="http://jakarta.apache.org/builds/tomcat/release/v3.1/bin/jakarta-tomcat.zip">Windows</a>
 version.</li>
  -<p><font size="2"><strong>NOTE:</strong>  It is also known to work with Tomcat 
Version 3.2b3 as of 09/01/2000</font>
  -                  <li>JBoss 2.0.</li>
  +                  <li>JBoss 2.0. BETA-PROD 03</li>
  +                  <li>Tomcat Version 3.2b4.  You can get the latest release of 
tomcat from the <a href="http://jakarta.apache.org/builds/tomcat/release/">jakarta 
website</a>.<br>
  +<p><strong>NOTE:</strong>  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.</li>
              </td>
              <td valign="top" width="10"></td>
              <td align="right" valign="top" width="11">&nbsp;</td>
  @@ -196,7 +196,7 @@
               <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tbody>
          <tr bgcolor="#99cc66">
  -         <td width="100%"><font color="white" face="Myriad Web,Arial" 
size="3"><b>How-To</b></font></td>
  +         <td width="100%"><font color="white" face="Myriad Web,Arial" 
size="3"><b>How-to setup jboss for tomcat</b></font></td>
          </tr>
        </tbody>
       </table>
  @@ -228,97 +228,49 @@
                            that load the necessary JARs onto the classpath.</td></tr>
                   </table>
                  </li>
  -               <li><strong>Edit server.xml in Tomcat config directory.</strong>.
  -                   <FONT COLOR="RED"><I>(Tomcat 3.2+ Only!)</I></FONT>
  -                    It is located in the conf directory under your base Tomcat 
directory
  -                 (jakarta-tomcat for the binary).  There are a number of lines
  -                 that deal with RequestInterceptors, the last of which are currently
  -                 the Realms (SimpleRealm, JDBCRealm, etc.). <B>After</B> the other
  -                 RequestInterceptors, add the following:
  -<pre>
  -        &lt;RequestInterceptor
  -            className="org.apache.tomcat.request.Jdk12Interceptor"
  -            debug="0" /&gt;
  -</pre>
  -               </li>
             <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>
  -&lt;!--
  -  --  Uncomment this to add Tomcat support.  Be sure to set your 'TOMCAT_HOME'
  -  -- environment variable before starting JBoss.
  -  -- MLET CODE = "org.jboss.tomcat.TomcatService" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/"&gt;
  +&lt;!-- 
  +  --  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/"&gt;
  +  -- ARG TYPE="int" VALUE=8080&gt;
     -- /MLET&gt;
     --&gt;
   </pre>
                        You need to uncomment these lines so they read as follows (note
  -                     you must add the &lt; signs at the beginning of the two 
relevant
  +                     you must add the &lt; signs at the beginning of the three 
relevant
                        lines!):
   <pre>
  -&lt;!--
  -  -- Comment this to remove Tomcat support.  Be sure to set your 'TOMCAT_HOME'
  -  -- environment variable before starting JBoss.
  -  --&gt;
  -  &lt;MLET CODE = "org.jboss.tomcat.TomcatService" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/"&gt;
  -  &lt;/MLET&gt;
  + &lt;MLET CODE = "org.jboss.tomcat.EmbeddedTomcatService" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/"&gt;
  +   &lt;ARG TYPE="int" VALUE=8080&gt;
  + &lt;/MLET&gt;
   </pre></li>
  -          <li><strong>Add your EJBs</strong>.
  -            Put your EJB's <I>Home and Remote Interfaces</I> in the
  -            <b>WEB-INF/classes</b> directory under your Tomcat web app directory
  -            (for example, jakarta-tomcat/webapps/myapp/WEB-INF/classes).</li>
  -          <li><strong>Add JBoss client Jars</strong>.
  -            Put the JBoss client files <i>jboss-client.jar</i>, 
<i>jnp-client.jar</i>,
  -            <i>jta-spec1_0_1.jar</i>, and (for 1.2.2 but not 1.3) <i>jndi.jar</i> 
in the
  -            <b>WEB-INF/lib</b> directory under your Tomcat web app directory
  -            (for example, jakarta-tomcat/webapps/myapp/WEB-INF/lib).  These
  -            files can be found in the <B>client</B> directory under your JBoss
  -            binary install (or <b>dist/client</b> for source builds).</li>
  -          <li><strong>Add support for JNDI</strong>.
  -            Put the JNDI configuration file <i>jndi.properties</i> in the
  -            <b>WEB-INF/classes</b> directory under your Tomcat web app directory
  -            (for example, jakarta-tomcat/webapps/myapp/WEB-INF/classes).
  -            This file can be found in the <b>conf</b> directory under you JBoss
  -            binary install (or <b>dist/conf</b> for source builds).</li>
             <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>
  -   ...
  -[Tomcat] Initializing
  -[Tomcat] Initialized
  -   ...
  -[Tomcat] Starting
  -[Tomcat] Started
  -   ...
  -[Tomcat] Testing if Tomcat is present....
      ...
  -[Tomcat] OK
  +[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
      ...
  -Context log: path="/examples" Adding context path="/examples"  
docBase="webapps/examples"
  -Context log: path="" Adding context path=""  docBase="webapps/ROOT"
  -Context log: path="/test" Adding context path="/test"  docBase="webapps/test"
  -Starting tomcat install="/home/workspace/tomcat" home="/home/workspace/tomcat"
  -classPath=".:/home/workspace/development/languages/jdk1.3/lib/tools.jar:
  -           run.jar:/home/workspace/tomcat/lib:
  -           /home/workspace/tomcat/lib/servlet.jar:
  -           /home/workspace/tomcat/lib/webserver.jar:
  -           /home/workspace/tomcat/lib/xml.jar:
  -           /home/workspace/tomcat/lib/jasper.jar:
  -           /home/workspace/development/languages/jdk1.3/lib/tools.jar:
  -           /home/workspace/spydermq/lib/jnpserver.jar:/home/workspace/jboss/conf"
  -[Default] Starting tomcat. Check logs/tomcat.log for error messages
  -Context log: path="/admin" Automatic context load
  -             docBase="/home/workspace/tomcat/webapps/admin"
  -Context log: path="/admin" Adding context path="/admin"
  -             docBase="/home/workspace/tomcat/webapps/admin"
   </pre>
   <p>
  -You should only see the lines after <strong>[Tomcat] OK</strong> if you have 
installed the examples that come with Tomcat.  Nonetheless, you should see the same 
sort of log messages you would see if you had deployed Tomcat in standalone mode.  
Also, the "tomcat install", classpath, etc will also vary from installation to 
installation.</li>
                </ol>
  -          <p>If you later want to move JBoss and Tomcat to separate
  -            machines, you will need to change the hostname in jndi.properties
  -            and alter jboss.properties in the JBoss server configuration.</p>
            <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... </p>
  @@ -334,7 +286,106 @@
     </tr>
     </tbody>
     </table>
  +    <table border="0" cellpadding="0" cellspacing="0" width="100%">
  +      <tbody>
  +        <tr>
  +          <td bgcolor="white" valign="bottom" width="11"><img 
src="picture/corner-sw-small.gif" width="11" height="11"></td>
  +          <td bgcolor="white" width="100%"></td>
  +          <td bgcolor="white" width="21"></td>
  +          <td width="4"></td>
  +        </tr>
  +        <tr>
  +          <td bgcolor="#99cc66" width="11"><img alt="o" height="1" src="binary.htm" 
width="1"></td>
  +          <td bgcolor="#99cc66" width="100%">
  +            <table border="0" cellpadding="0" cellspacing="0" width="100%">
  +     <tbody>
  +       <tr bgcolor="#99cc66">
  +         <td width="100%"><font color="white" face="Myriad Web,Arial" 
size="3"><b>How-to build web applications for jboss and tomcat</b></font></td>
  +       </tr>
  +     </tbody>
  +    </table>
     </td>
  +    <td bgcolor="#FFFFFF" width="21"><img src="picture/corner-e.gif" width="22" 
height="22"></td>
  +    <td width="4"></td>
  +  </tr>
  +    <tr height="56">
  +      <td bgcolor="white" valign="top" width="11"><img 
src="picture/corner-nw-small.gif" width="11" height="11"></td>
  +      <td align="right" width="100%">
  +     <table border="0" cellpadding="0" cellspacing="0" width="100%" height="89">
  +       <tbody>
  +         <tr>
  +           <td valign="top" width="672">
  +                             <p><br>
  +                               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>
  +                             <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:<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="manual/developing.html">manual</a> 
for details on how to package beans for jboss.<br>&nbsp;
  +                               <li><b>Write your servlets/JSPs</b> and package them 
in a war file. 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>
  +                                     <b>Notes</b>:<ul>
  +                                       <li>We don't support lookups in the "java:" 
namespace from the servlets yet, but work is in progress.
  +                                       <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 any of your beans 
interfaces, and you don't need the usual jboss-client.jar, jnp-client.jar...
  +                                     </ul><br>
  +                               <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>
  +&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  +
  +&lt;application&gt;
  +    &lt;display-name&gt;My application&lt;/display-name&gt;
  +
  +    &lt;module&gt;
  +        &lt;web&gt;
  +            &lt;web-uri&gt;webmodule.war&lt;/web-uri&gt;
  +            &lt;context-root&gt;/servlets&lt;/context-root&gt;
  +        &lt;/web&gt;
  +    &lt;/module&gt;
  +
  +    &lt;module&gt;
  +        &lt;ejb&gt;beans.jar&lt;/ejb&gt;
  +    &lt;/module&gt;
  +
  +&lt;/application&gt;
  +</pre>See also the <a 
href="http://java.sun.com/j2ee/dtds/application_1_2.dtd">DTD</a> for application.xml 
on Javasoft's website. </ul>&nbsp;
  +                               <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>&nbsp;
  +                               <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>
  +                             <p>
  +                               For a full example including a servlet and an EJB, 
see the <a href="zip_archives/contrib-cvs-sources.zip">contrib</a> module
  +                             </p>
  +
  +      </td>
  +      <td valign="top" width="10"></td>
  +      <td align="right" valign="top" width="11">&nbsp;</td>
  +    </tr>
  +  </tbody>
  +  </table>
  +  </td>
  +    <td width="21"><img alt="o" height="1" src="binary.htm" width="1"></td>
  +    <td width="4"></td>
  +  </tr>
  +  </tbody>
  +  </table>
  +  </td>
  +
  +
  +
   
       <td bgcolor="white" valign="top" width="170" height="718">
         <table border="0" cellpadding="0" cellspacing="0" width="100%">
  @@ -428,9 +479,10 @@
                                                                                       
                                                                 <tbody>
                                                                                       
                                                                         <tr 
height="249">
   
  -                            <td height="209">The invocation of EJBs by Tomcat's
  -                              servlets or JSPs goes through serialization.  We are 
working on a non-serializing version that will significantly speed up the integrated 
invocations.  Some integration of classloaders needs to be worked out.  <b> This 
version is for development evaluation only</b> Do not use this version to produce 
benchmarks of Tomcat/jboss, an optimized version will come out soon.
  -</td>
  +                            <td height="209"><p>Normal calls from a client to EJBs 
go through RMI, which means serialization. The overhead of the RMI layer
  +                            is typically 2-3ms.  </p>
  +                            <p>But if Tomcat is launched in the same VM as jboss, 
calls from Tomcat's servlets or JSPs don't need to be serialized: they can 
  +                            talk to the EJBs faster than any other client!</p></td>
                                                                                       
                                                                         </tr>
                                                                                       
                                                                 </tbody>
                                                                                       
                                                         </table>
  
  
  

Reply via email to