User: schulze 
  Date: 00/11/07 12:49:37

  Modified:    .        getting_startedJB2.htm
  Added:       .        J2eeDeployment_howto.html
  Log:
  added j2ee deployment howto
  
  Revision  Changes    Path
  1.12      +1 -0      jbossweb/getting_startedJB2.htm
  
  Index: getting_startedJB2.htm
  ===================================================================
  RCS file: /products/cvs/ejboss/jbossweb/getting_startedJB2.htm,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- getting_startedJB2.htm    2000/10/25 05:16:25     1.11
  +++ getting_startedJB2.htm    2000/11/07 20:49:37     1.12
  @@ -75,6 +75,7 @@
   -->
                                                                                       
                         <p><a href="JMX.Connector.Howto.html"><font face="Myriad 
Web,Arial">JMX Connector&nbsp;Howto</font></a></p>
                                                                                       
                         <p><a href="EJX.HowTo.Getting-Started.html"><font 
face="Myriad Web,Arial">EJX HowTo: Introduction</font></a></p>
  +                                                                                    
                         <p><a href="J2eeDeployment_howto.html"><font face="Myriad 
Web,Arial">J2eeDeployment HowTo: Introduction</font></a></p>
                                                                                       
                         <p></p>
                                                                                       
                         <p><font face="Myriad Web,Arial"><b>Container developer 
documentation</b></font></p>
                                                                                       
                         <p><a href="container.html"><font face="Myriad 
Web,Arial">jboss container architecture.</font></a></p>
  
  
  
  1.1                  jbossweb/J2eeDeployment_howto.html
  
  Index: J2eeDeployment_howto.html
  ===================================================================
  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  <html>
  <head>
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
     <meta name="GENERATOR" content="Mozilla/4.72 [en] (X11; U; Linux 2.2.14-5.0 i686) 
[Netscape]">
  </head>
  <body>
  
  <h1>Deployment on jBoss</h1>
  <p align="right"><font size="-2">written by <a 
href="mailto:[EMAIL PROTECTED]">Daniel Schulze</a></font></p>
  <hr width=100%>
  
  <p>The application deployment on jBoss is managed by the J2eeDeployer MBean.
  The J2eeDeployer is able to deploy ejb.jar packages, webapplication.war
  packages and j2ee application.ear packages. Furthermore he is able to deploy
  unpacked ejb.jar files for development purposes.</p>
  <p>The deployment is url based, so it is possible to deploy from whatever source as 
long
  as there is a url handler for that source available in your environment.<br>(ie.
  http://somehost/applications/app.ear or file:///home/user/development/myapp.ear)</p>
  
  <h2>The J2eeDeployer in general</h2>
  <p>The J2eeDeployer currently provides 3 methods:
  <ul>
  <li>
  <font face="Courier New,Courier">void <b>deploy</b> (URL)<br>
  </font>this method starts the deployment process for the application this
  URL&nbsp;points to. The URL can be a file: or a http:// or any other type
  of url your environment is capable to handle. In case of deploying a unpacked
  ejb.jar package the URL type is currently limited to file.<br>
  The deployment of an already deployed application (the name of the app
  is significant) will result in an undeployment of this app followed by
  a redeployment.</li>
  
  <li>
  <font face="Courier New,Courier">void <b>undeploy</b> (URL or Application
  name)<br>
  </font>use this to undeploy an application. the parameter can be the URL
  that was used to deploy this application or just the name (application name = file
  name of the app package or directory name in case of unpacked) of the 
application.</li>
  
  <li>
  <font face="Courier New,Courier">boolean <b>isDeployed</b> (URL&nbsp;or
  Application name)<br>
  </font>use this method to ask for the state of an application. The argument
  follows the same rules as for the undeploy method.</li>
  </ul>
  </p>
  <p>
  These 3 methods can be used via the web interface of jBoss at port 8082
  at the host jBoss is running on.</p>
  
  <h2>The AutoDeployer as helper</h2>
  <p>The AutoDeployer MBean is a helper for the J2eeDeployer to allow doing
  administration smoothly via drag and drop or to automate the redeployment
  in case of development. He observes the given directories for changes and
  calls the appropriate methods on the J2eeDeployer.
  <br>The AutoDeployer observes the timestamps of the application packages
  or the timestamp of the META-INF/ejb-jar.xml file in case of unpacked ejb.jar
  files.</p>
  <p>The AutoDeployer is configured whether static by the MLET configuration or
  dynamic by adding urls to watch for in its web interface (port 8082 at the host
  jBoss is running on).</p>
  <p>In its current version the AutoDeployer supports only local directories to 
observe.</p>
  <p>To deploy an ejb, web or ear package simply drop it in one of the observed 
directories.
  To autodeploy an unpacked ejb application, add the base directory of that application
  (base directory = the directory which containes the META-INF directory) to the 
AutoDeployers
  observed urls.</p>
  
  <p><i>Note: There is still a misbehavior when the autodeployer thread wins
  the race against the copy thread which modifies a package!</i>
  <br>
  
  <hr WIDTH="100%">
  
  <h2>Creating J2EE applications</h2>
  <p> j2ee applications or .ear files are jar archives containing a collection of ejb,
  web, client, connector and/or other library packages. Currently jBoss only supports 
ejb, web
  and other library packages (client and connector packages are ignored if 
present).<br>
  Other Library packages are class packages that are needed by your application and 
are not
  provided by the j2ee runtime environment (ie: some xml tools)</p>
  <p>This document will only describe the jBoss relevant stuff in creating j2ee 
packages
  for a detailed description of how to build such applications see the <a 
href="http://java.sun.com/j2ee/download.html#platformspec">
  J2EE specification under chapter 8</a>!</p>
  <p>First create all ejb, war and library archives you want to put together to make 
up your
  application. Make sure that all dependencies are solved, means: all classes that are 
needed
  by your application must be contained in your application (besides the classes that 
made up the
  J2EE platform (java core, javax.transaction, javax.sql, javax.servlet ...). Its up 
to you
  to create an arbitrary directory structure for your application to make it easier to 
maintain.
  Once you ve created your structure and moved all files on their place you have to 
create a
  deployment descriptor. This file must reside in the 
<code>&lt;your_app_dir&gt;/META-INF</code>
  directory and must be named <code>application.xml</code>.
  </p>
  <table bgcolor="#eeeeee">
  <tr><td>example:</td></tr>
  <tr><td>
  <p>the content of a simple <code>application.xml</code> file:
  <pre>
     &lt;application&gt;
  
        &lt;display-name&gt;My Application&lt;/display-name&gt;
  
        &lt;module&gt;
           &lt;web&gt;
              &lt;web-uri&gt;web-app.war&lt;/web-uri&gt;
              &lt;context-root&gt;/myapp&lt;/context-root&gt;
           &lt;/web&gt;
        &lt;/module&gt;
  
        &lt;module&gt;
           &lt;ejb&gt;ejb-app.jar&lt;/ejb&gt;
        &lt;/module&gt;
  
     &lt;/application&gt;
  </pre></p>
  </td></tr>
  </table>
  
  <p>This descriptor describes an application that contains a web application package
  (JSPs/Servlets/HTML) and an ejb application (EJBs).<br>
  The web applications war package is located at the root of the .ear file and is 
named <code>
  web-app.war</code>. It will be deployed under the webcontext <i>/myapp</i>.<br> The 
ejb package
  also resides in the applications root directory and is called 
<code>ejb-app.jar</code>.</p>
  
  <p><strong>understanding the shared classloader architecture in jBoss</strong></p>
  <p>When an application in jBoss gets deployed, every module will get deployed by a 
separate
  container.<br>
  Every container will get its own classloader - this means that a call from one 
module to
  an other must be an remote call and all parameters must be serialized, because the 
classes
  (even if they are loaded from the same physical file) are not compatible across 
container
  boundaries.
  To allow optimized interaction across container boundaries (local calls with 
parameter ... per
  reference) the classes that are involved in this communication must be loaded by the 
same classloader.</p>
  <p>In jBoss we achieve this issue with the following classloader architecture:
  <ul>
  <li>On deployment one - <i>common</i> - classloader is created. This classloader 
will get all archives in its
  classpath that are referenced (<code>MANIFEST.MF/Class-Path</code>)by any module 
contained in this
  application.</li>
  <li>When afterwards all modules become deployed in their containers, the 
classloaders created by these
  containers are all children of the <i>common</i> classloader. </li>
  <li>Now on runtime the communication between modules across container boundaries can 
be optimized when
  the classes used for the communication are loaded by the <i>common</i> 
classloader.</li>
  </ul></p>
  
  <table bgcolor="#eeeeee">
  <tr><td>example (continued):</td></tr>
  <tr><td>
  <p>To allow our previous mentioned simple example to make use of the optimization, 
we must provide the
  classes the web module needs to communicate with the ejb module in an separate third 
package, lets call
  it <code>ejb-client.jar</code>. This ejb-client.jar archive contains the remote 
interfaces of the ejbs
  and special method parameter types that are needed for the communication (if any). 
Now we put this
  package in the directory <code>/lib</code> of our application.</p>
  <p>To make sure that this package is now loaded by the common classloader, we 
reference it from within
  the web package by adding a <code>Class-Path:</code> entry to the web packages 
MANIFEST.MF file that
  it looks something like that:
  <pre>
     Manifest-Version: 1.0
     Class-Path: ./lib/ejb-client.jar
  </pre>
  </p>
  <p>Now you just jar your applications directory, name it &lt;anyhow&gt;.ear, and 
drop it in one of
  jBoss' autodeploy directories...
  </p>
  <p>the content of our simple applications archive:
  <pre>
     META-INF/
     META-INF/MANIFEST.MF
     META-INF/application.xml
     ejb-app.jar
     web-app.war
     lib/
     lib/ejb-client.jar
  </pre>
  </p>
  </td></tr>
  </table>
  
  </body>
  </html>
  
  
  

Reply via email to