geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Geronimo v2.1 > JBoss to Geronimo - EJB-Session Beans Migration
Date Tue, 21 Jul 2009 03:11:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=GMOxDOC21&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/GMOxDOC21/JBoss+to+Geronimo+-+EJB-Session+Beans+Migration">JBoss
to Geronimo - EJB-Session Beans Migration</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~sophia">Ying
Tang</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/GMOxDOC21/JBoss+to+Geronimo+-+EJB-BMP+Migration+%28Unverified+on+2.1%29"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/GMOxDOC21/JBoss+to+Geronimo+-+EJB-BMP+Migration+%28Unverified+on+2.1%29">JBoss
to Geronimo - EJB-BMP Migration (Unverified on 2.1)</a>&nbsp;</td><td width='33%'
class='ScrollbarParent'><sup><a href="/confluence/display/GMOxDOC21/Migrating+to+Apache+Geronimo"><img
border='0' align='middle' src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/GMOxDOC21/Migrating+to+Apache+Geronimo">Migrating to Apache Geronimo</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/GMOxDOC21/JBoss+to+Geronimo+-+Hibernate+Migration">JBoss
to Geronimo - Hibernate Migration</a></td><td class='ScrollbarNextIcon'><a
href="/confluence/display/GMOxDOC21/JBoss+to+Geronimo+-+Hibernate+Migration"><img border='0'
align='middle' src='/confluence/images/icons/forwd_16.gif' width='16' height='16'></a></td></tr></table></div>
<p><a name="JBosstoGeronimo-EJB-SessionBeansMigration-top"></a><br/>
A typical J2EE application may contain Enterprise JavaBeans or EJBs. These beans contain the
application's business logic and live business data. Although it is possible to use standard
Java objects to contain your business logic and business data, using EJBs addresses many of
the issues of using simple Java objects, such as scalability, lifecycle management and state
management.</p>

<p>This document discusses one type of EJBs, the Session EJB. This type of EJBs are
useful for mapping business process flow (or equivalent application concepts). There are two
types of Session EJBs, stateless and stateful. This article addresses both these Session Bean
types and shows how to use them in a practical scenario.</p>

<p>EJBs hold conversations with clients. A conversation is basically an interaction
between the EJB and the client and these interactions are composed of method calls by the
clients to the EJBs. Stateful session beans retain state on behalf of a client. This means
that if the state of the bean changes during a client's method call, this state is retained
for subsequent calls by the same client. A stateless session bean on the other hand retains
no conversational state from method to method. In other words, it is expected to hold its
conversational state for only a single method call.</p>

<p>This article is organized in the following sections:</p>
<ul>
	<li><a href="#JBosstoGeronimo-EJB-SessionBeansMigration-analysis">EJB implementation
analysis</a></li>
	<li><a href="#JBosstoGeronimo-EJB-SessionBeansMigration-sample">Sample application</a></li>
	<li><a href="#JBosstoGeronimo-EJB-SessionBeansMigration-jboss">The JBoss environment</a></li>
	<li><a href="#JBosstoGeronimo-EJB-SessionBeansMigration-geronimo">The Geronimo
environment</a></li>
	<li><a href="#JBosstoGeronimo-EJB-SessionBeansMigration-migration">Step-by-step
migration</a></li>
	<li><a href="#JBosstoGeronimo-EJB-SessionBeansMigration-summary">Summary</a></li>
</ul>


<h1><a name="JBosstoGeronimo-EJB-SessionBeansMigration-EJBimplementationanalysis"></a>EJB
implementation analysis <a name="JBosstoGeronimo-EJB-SessionBeansMigration-%23analysis"></a></h1>

<p>EJB implementation may vary from one vendor to another. The purpose of this section
is to provide a session bean specific feature-to-feature comparison between JBoss and Apache
Geronimo so you can clearly identify the differences and plan accordingly before migration.</p>

<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Feature</th>
<th class='confluenceTh'>JBoss v4.0.5</th>
<th class='confluenceTh'>Apache Geronimo 2.1 (OpenEJB)</th>
</tr>
<tr>
<td class='confluenceTd'>Stateful and stateless Session Beans</td>
<td class='confluenceTd'>supported</td>
<td class='confluenceTd'>supported</td>
</tr>
<tr>
<td class='confluenceTd'>BMP (Bean Managed Persistence) Entity Beans</td>
<td class='confluenceTd'>supported</td>
<td class='confluenceTd'>supported</td>
</tr>
<tr>
<td class='confluenceTd'>CMP (Container Managed Persistence) Entity Beans</td>
<td class='confluenceTd'>supported</td>
<td class='confluenceTd'>supported</td>
</tr>
<tr>
<td class='confluenceTd'>Message driven beans (MDBs)</td>
<td class='confluenceTd'>supported</td>
<td class='confluenceTd'>supported</td>
</tr>
<tr>
<td class='confluenceTd'>Interoperability using RMI-IIOP or JAXRPC</td>
<td class='confluenceTd'>supported</td>
<td class='confluenceTd'>supported</td>
</tr>
<tr>
<td class='confluenceTd'>Ability to expose stateless session beans and MDBs as Web Services</td>
<td class='confluenceTd'>supported</td>
<td class='confluenceTd'>supported</td>
</tr>
<tr>
<td class='confluenceTd'>Support for sending and receiving messages via Web Services</td>
<td class='confluenceTd'>supported</td>
<td class='confluenceTd'>supported</td>
</tr>
<tr>
<td class='confluenceTd'>Easy provisioning and hot deployment of EJB and JMX-based Web
Services</td>
<td class='confluenceTd'>supported</td>
<td class='confluenceTd'>supported</td>
</tr>
<tr>
<td class='confluenceTd'>Access to EJBs from external CORBA objects</td>
<td class='confluenceTd'>supported</td>
<td class='confluenceTd'>supported</td>
</tr>
</tbody></table>

<p><a href="#JBosstoGeronimo-EJB-SessionBeansMigration-top">Back to Top</a></p>

<h1><a name="JBosstoGeronimo-EJB-SessionBeansMigration-Sampleapplication"></a>Sample
application <a name="JBosstoGeronimo-EJB-SessionBeansMigration-%23sample"></a></h1>

<p>This is a simple eCommerce web site which sells computer related items in both retail
and wholesale markets. To get the whole sale prices of items, customer has to buy at least
given number of items. Otherwise he/she will get only retail prices of the item. End user
of the application can add those items to their shopping cart. A stateless session bean has
been used to manage the discount calculation business workflow activities while shopping cart
of the application has been implemented with the help of a stateful session bean. </p>

<p>The following figure illustrates the application flow:<br/>
<div align="center"><img src="/confluence/download/attachments/78092/computer_overview.gif"
border="0" /></div></p>

<p>A customer of this application directly login to the item list page. It will give
all the details of the items they have currently on their stock. To buy one of these items
in the stock, use the Buy link which comes with each item. It will forward customer in to
the Add Item to Cart web page. To proceed buying, customer has to enter the quantity of items
he/she needs. If this quantity exceeds the minimum discount quantity, discounts will be granted
and added items in to the customer's shopping cart. Shopping cart web page displays the list
of items already added to the cart and it enables removing of items from the cart. This application
will be not allow to add the same item shopping cart twise. </p>

<h2><a name="JBosstoGeronimo-EJB-SessionBeansMigration-ApplicationclassesandJSPpages"></a>Application
classes and JSP pages</h2>

<ul>
	<li>org.apache.geronimo.samples.computer.dto
	<ul>
		<li>ItemDTO - Data transfer object for item related information between web and ejb
tiers.</li>
		<li>TransactionDTO - Data transfer object for shopping cart transaction related information
between web and ejb tiers.</li>
	</ul>
	</li>
	<li>org.apache.geronimo.samples.computer.ejb
	<ul>
		<li>ItemServiceBean - Stateless session bean to handle item realated workflow activities.</li>
		<li>ShoppingCartBean - Stateful session bean to handle shopping cart related activities
fro shopping cart activities.</li>
	</ul>
	</li>
	<li>org.apache.geronimo.samples.computer.web
	<ul>
		<li>ItemServiceDispatchServlet - A servlet to dispatch item service related activities
from front end to web tier.</li>
		<li>ShoppingCartDispatchServlet - A servlet to dispatch shopping cart related activities
from fron end to web tier.</li>
	</ul>
	</li>
</ul>


<p>This eCommerce sample application also includes the following JSP pages:</p>
<ul>
	<li>buy_item.jsp -  Accepts quantity of items customer buys.</li>
	<li>error.jsp - Display error conditions of the application.</li>
	<li>index.jsp - Forward in to the item list of the application.</li>
	<li>list_items.jsp - Display list of items in the stock.</li>
	<li>shopping_cart.jsp - List of transactions added to the shopping cart will be displayed.</li>
</ul>


<h2><a name="JBosstoGeronimo-EJB-SessionBeansMigration-Toolsused"></a>Tools
used</h2>
<p>The tools used for developing and building the Computer acessories seller application
are:</p>

<h3><a name="JBosstoGeronimo-EJB-SessionBeansMigration-Eclipse"></a>Eclipse</h3>
<p>The Eclipse IDE was used for development of the sample application. This is a very
powerful and popular open source development tool. Integration plug-ins are available for
both JBoss and Geronimo. Eclipse can be downloaded from the following URL:<br/>
<a href="http://www.eclipse.org" rel="nofollow">http://www.eclipse.org</a></p>

<h3><a name="JBosstoGeronimo-EJB-SessionBeansMigration-ApacheAnt"></a>Apache
Ant</h3>
<p>Ant is a pure Java build tool. It is used for building the war files and populating
the database for the Online Brokerage application. Ant can be downloaded from the following
URL:<br/>
<a href="http://ant.apache.org" rel="nofollow">http://ant.apache.org</a></p>


<p><a href="#JBosstoGeronimo-EJB-SessionBeansMigration-top">Back to Top</a></p>
<h1><a name="JBosstoGeronimo-EJB-SessionBeansMigration-TheJBossenviroment"></a>The
JBoss enviroment <a name="JBosstoGeronimo-EJB-SessionBeansMigration-%23jboss"></a></h1>

<p>This section shows you how and where the sample JBoss reference environment was installed
so you can map this scenario to your own implementation. Note that for this migration example
JBoss v4.0.5 was used.</p>

<p>Detailed instructions for installing, configuring, and managing JBoss are provided
in the product documentation. Check the product Web site for the most updated documents.</p>

<p>The following list highlights the general tasks you will need to complete to install
and configure the initial environment as the starting point for deploying the sample application.</p>

<ol>
	<li>Download and install JBoss v4.0.5 as explained in the product documentation guides.
From now on the installation directory will be referred as <b>&lt;jboss_home&gt;</b></li>
	<li>Create a copy of the default JBoss v4.0.5 application server. Copy recursively
<b>&lt;jboss_home&gt;\server\default</b> to <b>&lt;jboss_home&gt;\server\&lt;your_server_name&gt;</b></li>
	<li>Start the new server by running the <b>run.sh -c &lt;your_server_name&gt;</b>
command from the <b>&lt;jboss_home&gt;\bin</b> directory.</li>
	<li>Once the server is started, you can verify that it is running by opening a Web
browser and pointing it to this URL: <a href="http://localhost:8080" rel="nofollow">http://localhost:8080</a>.
You should see the JBoss Welcome window and be able to access the JBoss console.</li>
	<li>Once the application server is up and running, the next step is to install and
configure all the remaining prerequisite software required by the sample application. This
step is described in the following section.</li>
</ol>


<h2><a name="JBosstoGeronimo-EJB-SessionBeansMigration-Installandconfigureprerequisitesoftware"></a>Install
and configure prerequisite software</h2>
<p>In order to build and run this sample application included in this article, you need
to install and configure the Ant build tool.</p>

<h3><a name="JBosstoGeronimo-EJB-SessionBeansMigration-ConfigureAnt"></a>Configure
Ant</h3>

<p>As mentioned before, Apache Ant is used to build the binaries for the Online Brokerage
application. If you do not have Ant installed this is a good time for doing it and make sure
that <b>&lt;ant_home&gt;/bin</b> directory is added to the system's path
variable.</p>

<p>Apache Ant can be downloaded from the following URL:</p>

<p><a href="http://ant.apache.org" rel="nofollow">http://ant.apache.org</a></p>

<h3><a name="JBosstoGeronimo-EJB-SessionBeansMigration-ConfigureXDoclet"></a>Configure
XDoclet</h3>

<p>XDoclet is going to be used as build tool for the configuration file generation.
It  is an open source code generation engine. It enables Attribute-Oriented Programming for
java. In short, this means that you can add more significance to your code by adding meta
data (attributes) to your java sources. This is done in special JavaDoc tags.<br/>
Although XDoclet originated as a tool for creating EJBs, it has evolved into a general-purpose
code generation engine. XDoclet consists of a core and a constantly growing number of modules.
It is fairly straight forward to write new modules if there is a need for a new kind of component.<br/>
<a href="http://xdoclet.sourceforge.net/xdoclet/index.html" rel="nofollow">http://xdoclet.sourceforge.net/xdoclet/index.html</a></p>

<p>Just extract the latest version of the XDoclet and set the <b>xdoclet.home</b>
parameter in to the <b>build.properties</b> file.</p>

<h2><a name="JBosstoGeronimo-EJB-SessionBeansMigration-Buildthesampleapplication"></a>Build
the sample application</h2>

<p>The computer acessories selling application included with this article provides an
Ant script that you will use in order to build the application. Download the computer acessories
selling application from the following link:</p>

<p><a href="/confluence/download/attachments/78092/computer.zip?version=1">Computer</a></p>

<p>After extracting the zip file, a <b>computer</b> directory is created.
In that directory open the build.properties file and edit the properties to match your environment
as shown in the following example:</p>

<style type="text/css">
@import url(/confluence/download/resources/confluence.ext.code:code/shStyles.css);
</style>
<!--[if IE]>
<style type="text/css">
    .code textarea, .code input { padding: 0 !important; }
</style>
<![endif]-->
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shCore.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushCSharp.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushPhp.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushJScript.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushVb.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushSql.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushXml.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushShell.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushDelphi.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushPython.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushJava.js"></script>
<div class="code">
<textarea name="newcodemacro" class="xml:nocontrols:nogutter" rows="10" readonly="readonly">##
Set the Geronimo 1.1 home here
geronimo.home=&lt;geronimo_home&gt;

## Set XDoclet 1.2.3 Home 
xdoclet.home=&lt;xdoclet_home&gt;</textarea>
<script class="javascript">
    if(!window.newcodemacro_initialised)
    {
        window.newcodemacro_initialised = true;
        window.oldonloadmethod = window.onload;
        window.onload = function(){
            dp.SyntaxHighlighter.HighlightAll('newcodemacro');
            if(window.oldonloadmethod)
            {
                window.oldonloadmethod();
            }
        }
    }

</script>
</div>


<p>Before starting the build process just set the correct paths for the <b>geronimo.home</b>
and <b>xdoclet.home</b> entries in the <b>build.properties</b> file
in the <b>config</b> directory.</p>

<p>From a command prompt or shell go to the <b>computer</b> directory and
run <b>ant jboss</b>. This will build the ear file and place it directly in the
<b>releases/jboss</b> directory.</p>


<h2><a name="JBosstoGeronimo-EJB-SessionBeansMigration-Deploythesampleapplication"></a>Deploy
the sample application</h2>

<p>To deploy the sample application just copy the <b>computer.ear</b> will
be created under the <b>computer/releases/jboss</b> folder to the <b>&lt;jboss_home&gt;/server/&lt;your_server_name&gt;/deploy</b>
folder. </p>

<p>If JBoss is already started, it will automatically deploy and start the application;
otherwise, the application will be deployed and started at the next startup.</p>

<h2><a name="JBosstoGeronimo-EJB-SessionBeansMigration-Testthesampleapplication"></a>Test
the sample application</h2>

<p>To test the application, open a Web browser and access the following URL:</p>

<p><a href="http://localhost:8080/computer" rel="nofollow">http://localhost:8080/computer</a></p>

<p>This brings up the item list page of the computer acessories selling application.
You can buy computer acessories using this application. The application is now configured
and running.</p>

<p><div align="center"><img src="/confluence/download/attachments/78092/computer_screen.gif"
border="0" /></div></p>

<p>Following is the demonstration of a shopping cart of the sample application.</p>

<p><div align="center"><img src="/confluence/download/attachments/78092/shopping_cart.gif"
border="0" /></div></p>

<p><a href="#JBosstoGeronimo-EJB-SessionBeansMigration-top">Back to Top</a></p>
<h1><a name="JBosstoGeronimo-EJB-SessionBeansMigration-TheGeronimoenviroment"></a>The
Geronimo enviroment <a name="JBosstoGeronimo-EJB-SessionBeansMigration-%23geronimo"></a></h1>

<p>Download and install Geronimo from the following URL:</p>

<p><a href="http://geronimo.apache.org/downloads.html" rel="nofollow">http://geronimo.apache.org/downloads.html</a></p>

<p>The release notes available there provide clear instructions on system requirements
and how to install and start Geronimo. Throughout the rest of this article we will refer to
the Geronimo installation directory as <b>&lt;geronimo_home&gt;</b>.</p>

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/forbidden.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td><b>TCP/IP ports
conflict</b><br /><p>If you are planning to run JBoss and Geronimo on the
same machine consider to change the default service ports on, at least, one of these servers.</p></td></tr></table></div>


<p><a href="#JBosstoGeronimo-EJB-SessionBeansMigration-top">Back to Top</a></p>
<h1><a name="JBosstoGeronimo-EJB-SessionBeansMigration-Stepbystepmigration"></a>Step-by-step
migration <a name="JBosstoGeronimo-EJB-SessionBeansMigration-%23migration"></a></h1>

<p>When you built the computer acessories selling sample application, Ant packaged the
deployment descriptors for both JBoss <b>jboss.xml</b> and Geronimo <b>openejb-jar.xml</b>
as they were already provided by the sample application. These files are located in the <b>computer/config</b>
directory.</p>

<p>The following example shows the JBoss deployment descriptor.</p>

<div class="code">
<textarea name="newcodemacro" class="xml:nocontrols:nogutter" rows="10" readonly="readonly">&lt;?xml
version="1.0" encoding="UTF-8"?&gt;

&lt;jboss&gt;

   &lt;enterprise-beans&gt;

      &lt;session&gt;
         &lt;ejb-name&gt;ShoppingCart&lt;/ejb-name&gt;
         &lt;local-jndi-name&gt;ShoppingCart&lt;/local-jndi-name&gt;

        &lt;method-attributes&gt;
        &lt;/method-attributes&gt;
      &lt;/session&gt;
      &lt;session&gt;
         &lt;ejb-name&gt;ItemService&lt;/ejb-name&gt;
         &lt;local-jndi-name&gt;ItemService&lt;/local-jndi-name&gt;

        &lt;method-attributes&gt;
        &lt;/method-attributes&gt;
      &lt;/session&gt;

   &lt;/enterprise-beans&gt;

   &lt;resource-managers&gt;
   &lt;/resource-managers&gt;

&lt;/jboss&gt;</textarea>
<script class="javascript">
    if(!window.newcodemacro_initialised)
    {
        window.newcodemacro_initialised = true;
        window.oldonloadmethod = window.onload;
        window.onload = function(){
            dp.SyntaxHighlighter.HighlightAll('newcodemacro');
            if(window.oldonloadmethod)
            {
                window.oldonloadmethod();
            }
        }
    }

</script>
</div>


<p>Compare it with the contents of the Geronimo deployment plan shown in the following
example.</p>

<div class="code">
<textarea name="newcodemacro" class="xml:nocontrols:nogutter" rows="10" readonly="readonly">&lt;?xml
version="1.0" encoding="UTF-8"?&gt;
&lt;openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1"&gt;
	&lt;dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"&gt;
		&lt;dep:moduleId&gt;
			&lt;dep:groupId&gt;org.apache.geronimo.samples&lt;/dep:groupId&gt;
			&lt;dep:artifactId&gt;ComputerEJB&lt;/dep:artifactId&gt;
			&lt;dep:version&gt;1.0&lt;/dep:version&gt;
			&lt;dep:type&gt;car&lt;/dep:type&gt;
		&lt;/dep:moduleId&gt;
		&lt;dep:dependencies/&gt;
		&lt;dep:hidden-classes/&gt;
		&lt;dep:non-overridable-classes/&gt;
	&lt;/dep:environment&gt;
	&lt;enterprise-beans&gt;
		&lt;session&gt;
			&lt;ejb-name&gt;ShoppingCart&lt;/ejb-name&gt;
			&lt;ejb-ref&gt;
				&lt;ref-name&gt;ejb/ItemServiceLocal&lt;/ref-name&gt;
				&lt;ejb-link&gt;ItemService&lt;/ejb-link&gt;
			&lt;/ejb-ref&gt;
		&lt;/session&gt;
		&lt;session&gt;
			&lt;ejb-name&gt;ItemService&lt;/ejb-name&gt;
		&lt;/session&gt;
	&lt;/enterprise-beans&gt;
&lt;/openejb-jar&gt;</textarea>
<script class="javascript">
    if(!window.newcodemacro_initialised)
    {
        window.newcodemacro_initialised = true;
        window.oldonloadmethod = window.onload;
        window.onload = function(){
            dp.SyntaxHighlighter.HighlightAll('newcodemacro');
            if(window.oldonloadmethod)
            {
                window.oldonloadmethod();
            }
        }
    }

</script>
</div>


<p>First difference can be clearly noted is Geronimo specific configuration has more
additional information than JBoss specific one. That part of the Geronimo configuration file
is quite similar to a Maven 2 build script. Both of these given configuration files has EJB
information. JBoss uses local JNDI names to link their EJBs while Geronimo directly use EJB's
name. In addition to above differences also <b>openejb-jar.xml</b> file clearly
gives the ejb reference information than <b>jboss.xml</b> file. </p>

<p>Looking at the web archive related configuration files give you few more differnces.</p>

<div class="code">
<textarea name="newcodemacro" class="xml:nocontrols:nogutter" rows="10" readonly="readonly">&lt;?xml
version="1.0" encoding="UTF-8"?&gt;
&lt;jboss-web&gt;

  &lt;!-- EJB Local References --&gt;
  &lt;ejb-local-ref&gt;
  	&lt;ejb-ref-name&gt;ejb/ItemServiceLocal&lt;/ejb-ref-name&gt;
  	&lt;local-jndi-name&gt;ItemService&lt;/local-jndi-name&gt;
  &lt;/ejb-local-ref&gt;  
  &lt;ejb-local-ref&gt;
  	&lt;ejb-ref-name&gt;ejb/ShoppingCartLocal&lt;/ejb-ref-name&gt;
  	&lt;local-jndi-name&gt;ShoppingCart&lt;/local-jndi-name&gt;
  &lt;/ejb-local-ref&gt;	
&lt;/jboss-web&gt;</textarea>
<script class="javascript">
    if(!window.newcodemacro_initialised)
    {
        window.newcodemacro_initialised = true;
        window.oldonloadmethod = window.onload;
        window.onload = function(){
            dp.SyntaxHighlighter.HighlightAll('newcodemacro');
            if(window.oldonloadmethod)
            {
                window.oldonloadmethod();
            }
        }
    }

</script>
</div>


<div class="code">
<textarea name="newcodemacro" class="xml:nocontrols:nogutter" rows="10" readonly="readonly">&lt;?xml
version="1.0" encoding="UTF-8"?&gt;
&lt;web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1"&gt;
  &lt;dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1"&gt;
    &lt;dep:moduleId&gt;
      &lt;dep:groupId&gt;org.apache.geronimo.samples&lt;/dep:groupId&gt;
      &lt;dep:artifactId&gt;ComputerWeb&lt;/dep:artifactId&gt;
      &lt;dep:version&gt;1.0&lt;/dep:version&gt;
      &lt;dep:type&gt;car&lt;/dep:type&gt;
    &lt;/dep:moduleId&gt;
    &lt;dep:dependencies/&gt;	
    &lt;dep:hidden-classes/&gt;
    &lt;dep:non-overridable-classes/&gt;
  &lt;/dep:environment&gt;
 
  &lt;naming:ejb-local-ref&gt;
	  &lt;naming:ref-name&gt;ejb/ItemServiceLocal&lt;/naming:ref-name&gt;
	  &lt;naming:ejb-link&gt;ItemService&lt;/naming:ejb-link&gt;
  &lt;/naming:ejb-local-ref&gt;

  &lt;naming:ejb-local-ref&gt;
	  &lt;naming:ref-name&gt;ejb/ShoppingCartLocal&lt;/naming:ref-name&gt;
	  &lt;naming:ejb-link&gt;ShoppingCart&lt;/naming:ejb-link&gt;
  &lt;/naming:ejb-local-ref&gt;
&lt;/web-app&gt;</textarea>
<script class="javascript">
    if(!window.newcodemacro_initialised)
    {
        window.newcodemacro_initialised = true;
        window.oldonloadmethod = window.onload;
        window.onload = function(){
            dp.SyntaxHighlighter.HighlightAll('newcodemacro');
            if(window.oldonloadmethod)
            {
                window.oldonloadmethod();
            }
        }
    }

</script>
</div>


<p><b>jboss-web.xml</b> map the EJBs from their JNDI names as given the
above while <b>geronimo-web.xml</b> uses directly EJB's name. The reference names
given in each mapping will be used refer EJBs from the Servlets. <b>web.xml</b>
file of the WAR file contains more information about each EJB reference name, which will be
common to the both Geronimo and JBoss flavours of this application.</p>

<h2><a name="JBosstoGeronimo-EJB-SessionBeansMigration-Buildthesampleapplication"></a>Build
the sample application</h2>

<p>Build the migrated Geronimo version of the sample application by running following
command from the <b>computer</b> directory.<br/>
<b>ant geronimo</b><br/>
It will create <b>computer.ear</b> file in the <b>computer/releases/geronimo</b>
folder.</p>

<h2><a name="JBosstoGeronimo-EJB-SessionBeansMigration-Deploythemigratedapplication"></a>Deploy
the migrated application</h2>

<p>To deploy the migrated Computer acessories selling application, make sure the Geronimo
server is up and running.</p>

<p>Open Geronimo console in your browser and follow the given steps:</p>
<ol>
	<li>Travel <b>Deploy New</b> from the <b>Console Navigation</b>.</li>
	<li>Load <b>computer.ear</b> from <b>computer/releases/geronimo</b>
folder in to the <b>Archive</b> input box.</li>
	<li>Press <b>Install</b> button to deploy application in the server.</li>
</ol>


<p>Once the application is deployed, open a Web browser and access the following URL:<br/>
<a href="http://localhost:8080/computer" rel="nofollow">http://localhost:8080/computer</a></p>

<p><a href="#JBosstoGeronimo-EJB-SessionBeansMigration-top">Back to Top</a></p>

<h1><a name="JBosstoGeronimo-EJB-SessionBeansMigration-Summary"></a>Summary
<a name="JBosstoGeronimo-EJB-SessionBeansMigration-%23summary"></a></h1>
<p>This article has shown how to migrate a sample application that uses Session Beans,
from JBoss v4.0.5 to Apache Geronimo. This article provided step-by-step instructions to build
the application, deploy and run it, and then migrate it to the Geronimo environment.</p>

<p>The following list summarizes the major differences found during this sample application
migration.</p>

<ul>
	<li>In order to deploy an EJB jar file in JBoss you need to just copy the configuration
file to the deploy directory but in Geronimo you can use either deployer tool, console or
hot deployment directory.</li>
	<li>The contents of the deployment plans for EJB jar files in JBoss and in Geronimo
are almost similar except for the starting part of the Geronimo which is more similar to a
Maven 2 build file.</li>
</ul>

     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/GMOxDOC21/JBoss+to+Geronimo+-+EJB-Session+Beans+Migration">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=78092&revisedVersion=2&originalVersion=1">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/GMOxDOC21/JBoss+to+Geronimo+-+EJB-Session+Beans+Migration?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message