blob: 0683670e1b9c657820ebba8a905336cbc728f2f4 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<!-- $PAGETITLE -->
<TITLE>OpenEJB - Manual del Usario</TITLE>
<LINK href="http://incubator.apache.org/openejb/default.css" rel="stylesheet" type="text/css">
<LINK href="http://incubator.apache.org/openejb/style.css" rel="stylesheet" type="text/css">
<LINK rel="SHORTCUT ICON" href="http://incubator.apache.org/openejb/images/favicon.ico">
<SCRIPT language="JavaScript" src="http://cwiki.apache.org/confluence/pages/viewpage.action?spaceKey=OPENEJB&title=functions.js" type="text/javascript"></SCRIPT>
<META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD>
<BODY bgcolor="#ffffff" link="#6763a9" vlink="#6763a9" topmargin="0" bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0">
<A name="top"></A>
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%" height="400">
<TR>
<TD width="20" valign="top" align="left" bgcolor="#7270c2"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="1" border="0"></TD>
<TD width="95" valign="top" align="left" bgcolor="#7270c2"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="1" border="0"></TD>
<TD width="7" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" border="0" width="1" height="1"></TD>
<TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="40" height="6" border="0"></TD>
<TD width="100%" valign="top" align="left" bgcolor="#5A5CB8"><IMG src="http://incubator.apache.org/openejb/images/top_2.gif" width="430" height="6" border="0"></TD>
<TD width="120" valign="top" align="left" bgcolor="#E24717"><IMG src="http://incubator.apache.org/openejb/images/top_3.gif" width="120" height="6" border="0"></TD>
</TR>
<TR>
<TD width="20" bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" border="0" width="1" height="1"></TD>
<TD width="95" bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" border="0" width="1" height="1"></TD>
<TD width="7" bgcolor="#ffffff" valign="top" align="left"></TD>
<TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="1" border="0"></TD>
<TD id="breadcrumbs" width="100%" valign="middle" align="left">
<!-- $TOP_NAV_BAR -->
<SPAN id="Content">
<A href="index.html" title="Index">Index</A> | <A href="news.html" title="News">News</A> | <A href="faq.html" title="FAQ">FAQ</A> | <A href="download.html" title="Download">Download</A> | <A href="mailing-lists.html" title="Mailing Lists">Lists</A> | <SPAN class="nobr"><A href="http://issues.apache.org/jira/browse/OPENEJB" title="Visit page outside Confluence" rel="nofollow">Issues<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN>
</SPAN>
<IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="2" border="0"></TD>
<TD width="120" height="20" valign="top" align="left">&nbsp;</TD>
</TR>
<TR>
<TD width="20" bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="20" height="3" border="0"></TD>
<TD width="95" bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/line_sm.gif" width="105" height="3" border="0"></TD>
<TD width="7" bgcolor="#a9a5de" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/line_sm.gif" width="7" height="3" border="0"></TD>
<TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/line_light.gif" width="40" height="3" border="0"></TD>
<TD width="100%" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/line_light.gif" width="430" height="3" border="0"></TD>
<TD width="120" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" border="0" width="1" height="1"></TD>
</TR>
<TR>
<TD bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="20" height="10" border="0"></TD>
<TD id="leftColumn" valign="top" style="padding-top: 0px;">
<SPAN id="Content">
<H3><A name="Navigation-Overview"></A>Overview</H3>
<UL class="alternate" type="square">
<LI><A href="index.html" title="Index">Home</A></LI>
<LI><A href="news.html" title="News">News</A></LI>
<LI><A href="faq.html" title="FAQ">FAQ</A></LI>
<LI><A href="download.html" title="Download">Download</A></LI>
<LI><A href="examples.html" title="Examples">Examples</A></LI>
<LI><A href="mailing-lists.html" title="Mailing Lists">Mailing Lists</A></LI>
<LI><A href="source-code.html" title="Source Code">Source Code</A></LI>
</UL>
<H3><A name="Navigation-General"></A>General</H3>
<UL class="alternate" type="square">
<LI><A href="deploy-tool.html" title="Deploy Tool">Deployment</A></LI>
<LI><A href="startup.html" title="Startup">Startup</A></LI>
<LI><A href="validation-tool.html" title="Validation Tool">Validation</A></LI>
<LI><A href="webadmin.html" title="Webadmin">Webadmin</A></LI>
</UL>
<H3><A name="Navigation-Configuration"></A>Configuration</H3>
<UL class="alternate" type="square">
<LI><A href="configuration.html" title="Configuration">General</A></LI>
<LI><A href="deployments.html" title="Deployments">Deployments</A></LI>
<LI><A href="containers.html" title="Containers">Containers</A></LI>
<LI><A href="castor-cmp.html" title="Castor CMP">Castor CMP</A></LI>
</UL>
<H3><A name="Navigation-Servers"></A>Servers</H3>
<UL class="alternate" type="square">
<LI><A href="local-server.html" title="Local Server">Local</A></LI>
<LI><A href="remote-server.html" title="Remote Server">Remote</A></LI>
</UL>
<H3><A name="Navigation-Integrations"></A>Integrations</H3>
<UL class="alternate" type="square">
<LI><A href="tomcat.html" title="Tomcat">Tomcat</A></LI>
<LI><A href="geronimo.html" title="Geronimo">Geronimo</A></LI>
<LI><A href="webobjects.html" title="WebObjects">WebObjects</A></LI>
</UL>
<H3><A name="Navigation-Community"></A>Community</H3>
<UL class="alternate" type="square">
<LI><A href="team.html" title="Team">Team</A></LI>
<LI><A href="help.html" title="Help">Help</A></LI>
<LI><A href="articles.html" title="Articles">Articles</A></LI>
<LI><A href="annoyances.html" title="Annoyances">Annoyances</A></LI>
<LI><SPAN class="nobr"><A href="index.html" title="Visit page outside Confluence" rel="nofollow">Wiki<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
<LI><SPAN class="nobr"><A href="irc://irc.freenode.net/#openejb" title="Visit page outside Confluence" rel="nofollow">IRC<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
</UL>
</SPAN>
<H3 class="heading3">Feeds</H3>
<TABLE border="0" cellspacing="4px">
<TR>
<TD align="right">
<A href="http://cwiki.apache.org/confluence/spaces/rss.action?key=OPENEJB&newPages=false"><IMG src="http://incubator.apache.org/openejb/images/rss.gif" border="0"></A><BR>
</TD>
<TD align="left">
<A href="http://cwiki.apache.org/confluence/spaces/rss.action?key=OPENEJB&newPages=false">Site</A>
</TD>
</TR>
<TR>
<TD align="right">
<A href="http://cwiki.apache.org/confluence/spaces/blogrss.action?key=OPENEJB"><IMG src="http://incubator.apache.org/openejb/images/rss.gif" border="0"></A>
</TD>
<TD align="left">
<A href="http://cwiki.apache.org/confluence/spaces/blogrss.action?key=OPENEJB">News</A>
</TD>
</TR>
</TABLE>
</TD>
<TD width="7" bgcolor="#a9a5de" valign="top" align="left">&nbsp;</TD>
<TD width="40" valign="top" align="left">&nbsp;</TD>
<TD rowspan="4" width="100%" valign="top">
<TABLE cols="1" rows="2" border="0" cellpadding="0" cellspacing="0" width="100%">
<TR>
<TD valign="top" align="left"><BR>
<TABLE cols="3" rows="1" border="0" cellpadding="0" cellspacing="0" width="100%">
<TR>
<TD valign="top" width="200" align="left">
<A href="http://openejb.org/">
<IMG border="0" hspace="0" src="http://incubator.apache.org/openejb/images/logo_openejb.gif" vspace="0">
</A>
</TD>
<TD align="right" valign="middle" style="padding:0px;margin:0px;">
<TABLE style="padding:0px;margin:0px;">
<TR>
<TD>
<A href="http://www.apache.org/">
<IMG src="http://www.apache.org/images/asf-logo.gif" border="0">
</A>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<BR>
</TD>
</TR>
<TR>
<TD valign="top" align="left">
<IMG border="0" height="7" hspace="0" src="http://incubator.apache.org/openejb/images/dotTrans.gif"><BR>
<DIV id="page_title">
<TABLE width="100%">
<TR>
<TD>
<!-- $TITLE -->
Manual del Usario
</TD>
<TD align="right" style="padding-left:0px;"><A style="color:#999;font-size:small;font-weight:normal;" href="http://cwiki.apache.org/confluence/pages/editpage.action?spaceKey=OPENEJB&title=Manual%20del%20Usario">[ edit ]</A></TD>
<TD align="right" width="25">
<SCRIPT type="text/javascript" language="javascript">
document.write('<a href="http://cwiki.apache.org/confluence/pages/viewpage');
document.write('.action?pageId=26512&decorator=printable">');
</SCRIPT>
<IMG src="http://cwiki.apache.org/confluence/images/icons/print_16.gif" height="16" width="16" border="0" align="absmiddle" title="Print"></A>
</TD>
</TR>
</TABLE>
</DIV>
<IMG border="0" height="1" hspace="0" src="http://incubator.apache.org/openejb/images/dotTrans.gif"></TD>
</TR>
</TABLE>
<P>
<!-- $BODY -->
<DIV id="PageContent">
<DIV class="pagecontent">
<DIV class="wiki-content">
<H1><A name="ManualdelUsario-Configuration"></A>Configuration</H1>
<H2><A name="ManualdelUsario-ShortOverview"></A>Short Overview</H2>
<H3><A name="ManualdelUsario-ConfigurationProperties"></A>Configuration Properties</H3>
<UL>
<LI><B>openejb.home</B> - OpenEJB home (installation) directory path. All relative paths are resolved against the property unless openejb.base is set. Unless set, the value is assigned to the <EM>user.dir</EM> Java property.</LI>
<LI><B>openejb.base</B> - OpenEJB base directory path. If set, the directory pointed by the property is searched for resources before openejb.home.</LI>
<LI><B>openejb.configuration</B> - OpenEJB configuration file path.</LI>
<LI><B>openejb.loader</B> - OpenEJB loader that's responsible for loading EJBs. There are 3 different loader types:
<UL>
<LI><B>tomcat-webapp</B> - set it when inside of Tomcat scoped at just the webapp, aka. <A href="collapsed-ear.html" title="Collapsed EAR">Collapsed EAR</A></LI>
<LI><B>tomcat</B> - set it when inside of Tomcat scoped for all webapps to share</LI>
<LI><B>system</B> (also: bootstrap)</LI>
<LI><B>embedded</B> (also: noload)</LI>
</UL>
</LI>
<LI><B>openejb.configurator</B> (default: <EM>org.openejb.alt.config.ConfigurationFactory</EM> ) - a class that builds org.openejb.alt.assembler.classic.OpenEjbConfiguration object; implements the org.openejb.alt.assembler.classic.OpenEjbConfigurationFactory interface</LI>
</UL>
<H3><A name="ManualdelUsario-ConfigurationFile"></A>Configuration File</H3>
<P>Show a config file with the elements hyperlinked.</P>
<DIV class="code"><DIV class="codeHeader"><B>openejb.conf</B></DIV><DIV class="codeContent">
<PRE class="code-xml"><SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>?&gt;</SPAN>
<SPAN class="code-tag">&lt;openejb&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;Default CMP Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;CMP_ENTITY&quot;</SPAN>&gt;</SPAN>
Global_TX_Database c:/my/app/conf/postgresql.cmp_global_database.xml
Local_TX_Database c:/my/app/conf/postgresql.cmp_local_database.xml
<SPAN class="code-tag">&lt;/Container&gt;</SPAN>
<SPAN class="code-tag">&lt;Connector id=<SPAN class="code-quote">&quot;Default JDBC Database&quot;</SPAN>&gt;</SPAN>
JdbcDriver org.postgresql.Driver
JdbcUrl jdbc:postgresql://localhost/mydb
UserName username
Password password
<SPAN class="code-tag">&lt;/Connector&gt;</SPAN>
<SPAN class="code-tag">&lt;SecurityService id=<SPAN class="code-quote">&quot;Default Security Service&quot;</SPAN>/&gt;</SPAN>
<SPAN class="code-tag">&lt;TransactionService id=<SPAN class="code-quote">&quot;Default Transaction Manager&quot;</SPAN>/&gt;</SPAN>
<SPAN class="code-tag">&lt;Deployments jar=<SPAN class="code-quote">&quot;c:/my/app/employee.jar&quot;</SPAN>/&gt;</SPAN>
<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;beans/&quot;</SPAN> /&gt;</SPAN>
<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
</DIV></DIV>
<H2><A name="ManualdelUsario-BasicLayout"></A>Basic Layout</H2>
<P>Basically, openejb.base is the source for 100% of all configuration information and third party config files (log4j, castor, instantdb, whatever). This includes finding where the, possibly many, &lt;Deployment&gt; entries in the openejb.conf point. The openejb.home is where the code loading OpenEJB will look for all the OpenEJB libraries. Usually openejb.base is not explicitly set and defaults to the value of openejb.home, so many people are used to only dealing with openejb.home.</P>
<P>The point of having and openejb.base and openejb.home was basically to allow several independently configured instances of OpenEJB running on a system (perhaps embedded in Swing apps, in Tomcat, running as a standalone Server, or even in Groovy as Mr. Strachan did!) but without the need to copy all the OpenEJB system libraries everywhere.</P>
<P><B>openejb.home</B> </P>
<UL>
<LI>can be set explicitly via a system property.</LI>
<LI>if not set it default's to user.dir, which is the current working directory.</LI>
</UL>
<P><B>openejb.base</B></P>
<UL>
<LI>can be set explicitly via a system property.</LI>
<LI>If not set it default's to openejb.home.</LI>
</UL>
<P><B>openejb.configuration</B></P>
<UL>
<LI>can be set to explicitly point to the file containing your configuration.</LI>
<LI>If set to a relative path, we first look in user.dir/your-conf-file, then in openejb.base/your-conf-file</LI>
<LI>If not set we check in openejb.base/conf/openejb.conf</LI>
<LI>If no conf file is found, we create one in openejb.base/conf/openejb.conf</LI>
</UL>
<P><B>relative paths in openejb.conf</B></P>
<UL>
<LI>Deployment entries are resolved relative to openejb.base.</LI>
<LI>Containers use openejb.base to resolve their own config files. For example, Castor JDO to loads the database.xml and all other files from the openejb.base directory.</LI>
<LI>Resource adapters that are embedded usually have config files of their own and are also loaded from the openeb.base.</LI>
</UL>
<P><B>log files</B></P>
<UL>
<LI>The log4.configuration file is resolved relative to openejb.base.</LI>
<LI>The properties in the config file that point to files are also resolved relative to openejb.base.</LI>
</UL>
<P><B>OpenEJB libraries</B></P>
<UL>
<LI>The jars in the lib and dist directories under openejb.home are added to the classpath.</LI>
</UL>
<H3><A name="ManualdelUsario-Summary"></A>Summary</H3>
<P>A summary of the above in a different notation:</P>
<DIV class="preformatted"><DIV class="preformattedContent">
<PRE>openejb.home = user.dir (can be set explicitly)
openejb.base = openejb.home (can be set explicitly)
openejb.conf = openejb.base/conf/openejb.conf (can be set explicitly)
logging.conf = openejb.base/conf/logging.conf (can be set explicitly)
deployments = paths listed in openejb.conf (relative paths resolved from openejb.base)
Classpath includes openejb.home/lib and openejb.home/dist
</PRE>
</DIV></DIV>
<H3><A name="ManualdelUsario-Examplelayout"></A>Example layout</H3>
<P>In this one the openejb.home and openejb.base are set, everything else is defaulted. The openejb.conf file as been updated to point to the ejb jars by name (abc-ejbs.jar and xyz-ejbs.jar).</P>
<P>An example layout:</P>
<DIV class="preformatted"><DIV class="preformattedContent">
<PRE>/usr/local/openejb (openejb.home)
/usr/local/openejb/lib (in classpath)
/usr/local/openejb/dist (in classpath)
/home/jsmith/foo_app (openejb.base)
/home/jsmith/foo_app/conf/openejb.conf
/home/jsmith/foo_app/conf/logging.conf
/home/jsmith/foo_app/abc-ejbs.jar (Deployment entry in openejb.conf)
/home/jsmith/foo_app/xyz-ejbs.jar (Deployment entry in openejb.conf)
/home/jsmith/foo_app/logs/
</PRE>
</DIV></DIV>
<H3><A name="ManualdelUsario-AnotherExamplelayout"></A>Another Example layout</H3>
<P>In this example openejb.home and openejb.base are setup as well as the explicit paths for the openejb and log4j configuration files.</P>
<P>An example layout:</P>
<DIV class="preformatted"><DIV class="preformattedContent">
<PRE>/usr/local/openejb (openejb.home)
/usr/local/openejb/lib (in classpath)
/usr/local/openejb/dist (in classpath)
/home/jsmith/foo_app (openejb.base)
/home/jsmith/foo_app/openejb.xml (openejb.configuration)
/home/jsmith/foo_app/abc-ejbs.jar (Deployment entry in openejb.xml)
/home/jsmith/foo_app/xyz-ejbs.jar (Deployment entry in openejb.xml)
/home/jsmith/foo_app/log4j.conf (log4j.configuration)
/home/jsmith/foo_app/mylogs/ (logging dir as defined in log4j.conf)
</PRE>
</DIV></DIV>
<H1><A name="ManualdelUsario-Deployments"></A>Deployments</H1>
<H2><A name="ManualdelUsario-The%27Deployments%27elementinopenejb.conf"></A>The 'Deployments' element in openejb.conf</H2>
<H3><A name="ManualdelUsario-Asinglejar"></A>A single jar</H3>
<P>To include a single jar by name, just declare a 'Deployments' element with a 'jar' attribute pointing to the jar file on the file system.</P>
<DIV class="code"><DIV class="codeHeader"><B>openejb.conf</B></DIV><DIV class="codeContent">
<PRE class="code-xml"><SPAN class="code-tag">&lt;openejb&gt;</SPAN>
...
<SPAN class="code-tag">&lt;Deployments jar=<SPAN class="code-quote">&quot;c:\my\app\superEjbs.jar&quot;</SPAN> /&gt;</SPAN>
<SPAN class="code-tag">&lt;Deployments jar=<SPAN class="code-quote">&quot;c:\someplace\purchasing.jar&quot;</SPAN> /&gt;</SPAN>
<SPAN class="code-tag">&lt;Deployments jar=<SPAN class="code-quote">&quot;timeTrack.jar&quot;</SPAN> /&gt;</SPAN>
<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
</DIV></DIV>
<P>The last element in the example uses a relative path to point to the ejb jar. This path will be resolved relative to the openejb.base property. So, for example, of the value of openejb.base was 'c:\timeapp\' then OpenEJB would look for the jar 'c:\timeapp\timeTrack.jar'. See the <A href="configuration.html" title="Configuration">Configuration</A> guide for more details.</P>
<H3><A name="ManualdelUsario-Adirectoryofjars"></A>A directory of jars</H3>
<P>To point to a directory that contains several jar files that OpenEJB should load, simply declare a 'Deployments' element with a 'dir' attribute pointing to the directory containing the jar files.</P>
<DIV class="code"><DIV class="codeHeader"><B>openejb.conf</B></DIV><DIV class="codeContent">
<PRE class="code-xml"><SPAN class="code-tag">&lt;openejb&gt;</SPAN>
...
<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\my\app\beans\&quot;</SPAN> /&gt;</SPAN>
<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\crimestopper\lib&quot;</SPAN> /&gt;</SPAN>
<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;ejbs&quot;</SPAN> /&gt;</SPAN>
<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;beans&quot;</SPAN> /&gt;</SPAN>
<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
</DIV></DIV>
<P>The directories listed will be searched for jars containing 'META-INF/ejb-jar.xml' files and will be added to the list of jars to load if they do. Better said, it's completely save to point to a directory containing a mix of ejbs and regular jar files. OpenEJB will simply skip over jars that do contain the required 'META-INF/ejb-jar.xml' file.</P>
<P>The last Deployments element declares a 'beans' directory relative to openejb.base for holding ejb jars. This declaration is simply convention and not required.</P>
<H3><A name="ManualdelUsario-Anunpackedjar"></A>An unpacked jar</H3>
<P>As of 1.0 beta1, OpenEJB supports unpacked ejb jars. Simply meaning that you don't need to pack your ejb's into a jar file in order to use them in OpenEJB. You still need to follow the ejb jar layout and include an &quot;META-INF/ejb-jar.xml&quot; in the directory that contains your ejbs.</P>
<P>For example, if you have a directory structure like this:</P>
<BLOCKQUOTE>
<P>C:\myapp\<BR>
C:\myapp\acmeEjbs\<BR>
C:\myapp\acmeEjbs\META-INF\ejb-jar.xml<BR>
C:\myapp\acmeEjbs\org\acme\Foo.class<BR>
C:\myapp\acmeEjbs\org\acme\FooBean.class<BR>
C:\myapp\acmeEjbs\org\acme\FooHome.class<BR>
C:\myapp\acmeEjbs\org\acme\Bar.class<BR>
C:\myapp\acmeEjbs\org\acme\BarBean.class<BR>
C:\myapp\acmeEjbs\org\acme\BarHome.class</P></BLOCKQUOTE>
<P>Then you would delcare a 'Deployments' element with the 'dir' attribute set to 'C:\myapp\acmeEjbs' as shown below.</P>
<DIV class="code"><DIV class="codeHeader"><B>openejb.conf</B></DIV><DIV class="codeContent">
<PRE class="code-xml"><SPAN class="code-tag">&lt;openejb&gt;</SPAN>
...
<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\myapp\acmeEjbs&quot;</SPAN> /&gt;</SPAN>
<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
</DIV></DIV>
<P>Note that this syntax is the same as the directory syntax above. If OpenEJB finds a META-INF directory with an 'ejb-jar.xml' fine inside, then OpenEJB will treat the directory as an unpacked ejb jar. Otherwise OpenEJB will look for ejb jar files to load as detailed in the above section.</P>
<H1><A name="ManualdelUsario-Logfile"></A>Log file </H1>
<P>When trying to figure out if your ejbs were loaded, the openejb.log file is an incredible asset.</P>
<P>If your ejbs were loaded successfully you should see entries like the following (1.x and higher only):</P>
<DIV class="panel"><DIV class="panelHeader"><B>openejb.log</B></DIV><DIV class="panelContent">
<P>INFO : Loaded EJBs from /usr/local/openejb-1.0-beta1/beans/openejb-itests-beans.jar<BR>
INFO : Loaded EJBs from /usr/local/openejb-1.0-beta1/beans/openejb-webadmin-clienttools.jar</P>
</DIV></DIV>
<P>If your ejbs failed to load, you will see an entry similar to the following.</P>
<DIV class="panel"><DIV class="panelHeader"><B>openejb.log</B></DIV><DIV class="panelContent">
<P>WARN : Jar not loaded. /usr/local/openejb-1.0-beta1/beans/helloworld.jar. Jar failed validation. Use the validation tool for more details</P>
</DIV></DIV>
<P>Additionally, all the successfully loaded ejbs are individually listed in the log file at startup. The Deployment ID listed is the JNDI name used to lookup the ejb from a client of the Local or Remote Servers. The beans listed below are from our test suite.</P>
<DIV class="preformatted"><DIV class="preformattedContent">
<PRE>DEBUG: Deployments : 19
DEBUG: Type Deployment ID
DEBUG: CMP_ENTITY client/tests/entity/cmp/RMI-over-IIOP/EJBHome
DEBUG: STATEFUL client/tests/stateful/EncBean
DEBUG: STATELESS client/tests/stateless/BeanManagedBasicStatelessHome
DEBUG: STATEFUL client/tests/stateful/BasicStatefulHome
DEBUG: STATELESS client/tests/stateless/EncBean
DEBUG: STATEFUL client/tests/stateful/BeanManagedTransactionTests/EJBHome
DEBUG: BMP_ENTITY client/tests/entity/bmp/RMI-over-IIOP/EJBHome
DEBUG: STATEFUL client/tests/stateful/RMI-over-IIOP/EJBHome
DEBUG: STATELESS client/tests/stateless/BeanManagedTransactionTests/EJBHome
DEBUG: BMP_ENTITY client/tests/entity/bmp/allowed_operations/EntityHome
DEBUG: CMP_ENTITY client/tests/entity/cmp/EncBean
DEBUG: STATEFUL client/tests/stateful/BeanManagedBasicStatefulHome
DEBUG: BMP_ENTITY client/tests/entity/bmp/BasicBmpHome
DEBUG: STATELESS client/tests/stateless/BasicStatelessHome
DEBUG: CMP_ENTITY client/tests/entity/cmp/BasicCmpHome
DEBUG: STATELESS client/tools/DatabaseHome
DEBUG: CMP_ENTITY client/tests/entity/cmp/allowed_operations/EntityHome
DEBUG: BMP_ENTITY client/tests/entity/bmp/EncBean
DEBUG: STATELESS client/tests/stateless/RMI-over-IIOP/EJBHome
</PRE>
</DIV></DIV>
<H1><A name="ManualdelUsario-Containers"></A>Containers</H1>
<H2><A name="ManualdelUsario-DeclaringyourContainer"></A>Declaring your Container</H2>
<P>CMP Entity containers are defined with the &lt;Container&gt; element, under the &lt;openejb&gt; element. This is actually the declaration used for all containers defined in the container system. The part that actually makes it a cmp container is the ctype attribute, specifially, a ctype attribute set to CMP_ENTITY as such...</P>
<DIV class="code"><DIV class="codeHeader"><B>example_01.conf</B></DIV><DIV class="codeContent">
<PRE class="code-xml"><SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>?&gt;</SPAN>
<SPAN class="code-tag">&lt;openejb&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;Default CMP Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;CMP_ENTITY&quot;</SPAN>/&gt;</SPAN>
<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
</DIV></DIV>
<P>The really fun part is that the above configuration file is completely legal! If you started the server and pointed to this file...</P>
<BLOCKQUOTE><P>./openejb.sh start -conf example_01.conf</P></BLOCKQUOTE>
<P>...you would end up with a running server that contained only one container, called &quot;Default CMP Container&quot;. You could then deploy beans into it and everything. There would be no other containers running in the server at all. If you telnet'd into the server and typed the 'system' command, you could see for yourself that there is nothing else in the system.</P>
<BLOCKQUOTE>
<P>dblevins@Miles /dev/OpenEJB<BR>
$ telnet localhost 4200<BR>
Trying 127.0.0.1...<BR>
Connected to Miles<BR>
Escape character is '^]'.<BR>
OpenEJB Remote Server Console<BR>
type 'help' for a list of commands<BR>
<SPAN class="nobr"><A href="http://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=OPENEJB&title=openejb&linkCreation=true&fromPageId=26512" title="Create Page: openejb" class="createlink">openejb<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/plus.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN>$ system<BR>
Containers:<BR>
Default CMP Container</P>
<P>Deployments:<BR>
<SPAN class="nobr"><A href="http://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=OPENEJB&title=openejb&linkCreation=true&fromPageId=26512" title="Create Page: openejb" class="createlink">openejb<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/plus.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN>$</P></BLOCKQUOTE>
<P>You see that. No beans, no JDBC resources, nothing but one CMP container called &quot;Default CMP Container&quot;.</P>
<H2><A name="ManualdelUsario-NamingyourContainer"></A>Naming your Container</H2>
<P>You can call the container anything you want, just change the value of the id attribute. Here is a container called &quot;My PostgreSQL Contianer&quot;</P>
<DIV class="code"><DIV class="codeHeader"><B>example_02.conf</B></DIV><DIV class="codeContent">
<PRE class="code-xml"><SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>?&gt;</SPAN>
<SPAN class="code-tag">&lt;openejb&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My PostgreSQL Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;CMP_ENTITY&quot;</SPAN>/&gt;</SPAN>
<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
</DIV></DIV>
<P>If you were to deploy a CMP bean into this configuration, you would see &quot;My PostgreSQL Container&quot; in the list of usable containers, in fact, it would be the only container in the list.</P>
<BLOCKQUOTE>
<P>dblevins@Miles /dev/OpenEJB/openejb<BR>
$ ./openejb.sh deploy -conf example_02.conf myCMPBean.jar<BR>
...(skipping to step two)...</P>
<P>==--- Step 2 ---==</P>
<P>Please specify which container the bean will run in.<BR>
Available containers are:</P>
<P>Num Type ID</P>
<P>1 CMP_ENTITY My PostgreSQL Container</P>
<P>Type the number of the container<BR>
-options to view the list again<BR>
or -help for more information.</P>
<P>Container:</P></BLOCKQUOTE>
<P>After deployment, you would end up with a configuration like this one</P>
<DIV class="code"><DIV class="codeHeader"><B>example_02.conf</B></DIV><DIV class="codeContent">
<PRE class="code-xml"><SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>?&gt;</SPAN>
<SPAN class="code-tag">&lt;openejb&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My PostgreSQL Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;CMP_ENTITY&quot;</SPAN>/&gt;</SPAN>
<SPAN class="code-tag">&lt;Deployments jar=<SPAN class="code-quote">&quot;myCMPBean.jar&quot;</SPAN> /&gt;</SPAN>
<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
</DIV></DIV>
<P>Most important, that bean will now be mapped directly to the container id &quot;My PostgreSQL Container&quot;. So if you change the name of the container and do not redeploy the myCMPBean.jar to point to the new container id, you will have big problems!</P>
<H2><A name="ManualdelUsario-Containertypes"></A>Container types</H2>
<P>You can declare as many containers as you want. The available container types are:</P>
<UL>
<LI>CMP_ENTITY</LI>
<LI>BMP_ENTITY</LI>
<LI>STATELESS</LI>
<LI>STATEFUL</LI>
</UL>
<P>The containers can all be of the same type, or a mix of the types.</P>
<DIV class="code"><DIV class="codeHeader"><B>example_03.conf</B></DIV><DIV class="codeContent">
<PRE class="code-xml"><SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>?&gt;</SPAN>
<SPAN class="code-tag">&lt;openejb&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My PostgreSQL Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;CMP_ENTITY&quot;</SPAN>/&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My MySQL Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;CMP_ENTITY&quot;</SPAN>/&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My InstantDB Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;CMP_ENTITY&quot;</SPAN>/&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My Stateful Session Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;STATEFUL&quot;</SPAN>/&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My Stateless Session Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;STATELESS&quot;</SPAN>/&gt;</SPAN>
<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
</DIV></DIV>
<H2><A name="ManualdelUsario-ConfiguringyourContainer"></A>Configuring your Container</H2>
<P>Of course, if you did have a configuration like the one above, it would be a bit pointless as all three of your CMP containers would be using the default CMP container configuration. To acually configure a container differently, you simply need to specifiy new values for the properties that the container has. These will override the defaults for that particular container declaration. So it's possible to declare multiple containers of the same type, but configure each one differently. Let's use our CMP_ENTITY containers above as an example.</P>
<DIV class="code"><DIV class="codeHeader"><B>example_03.conf</B></DIV><DIV class="codeContent">
<PRE class="code-xml"><SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>?&gt;</SPAN>
<SPAN class="code-tag">&lt;openejb&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My PostgreSQL Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;CMP_ENTITY&quot;</SPAN>&gt;</SPAN>
Global_TX_Database conf/postgresql.cmp.global-database.xml
Local_TX_Database conf/postgresql.cmp.local-database.xml
<SPAN class="code-tag">&lt;/Container&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My MySQL Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;CMP_ENTITY&quot;</SPAN>&gt;</SPAN>
Global_TX_Database conf/mysql.cmp.global-database.xml
Local_TX_Database conf/mysql.cmp.local-database.xml
<SPAN class="code-tag">&lt;/Container&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My InstantDB Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;CMP_ENTITY&quot;</SPAN>&gt;</SPAN>
Global_TX_Database conf/instantdb.cmp.global-database.xml
Local_TX_Database conf/instantdb.cmp.local-database.xml
<SPAN class="code-tag">&lt;/Container&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My Stateful Session Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;STATEFUL&quot;</SPAN>/&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My Stateless Session Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;STATELESS&quot;</SPAN>/&gt;</SPAN>
<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
</DIV></DIV>
<P>The format of the configuration parameters is actually just regular old java.util.Properties file format. It keeps things simple and doesn't require you to type endless amounts of tags that are just name/value pairs anyway. The java.util.Properties file format allows for spaces, tabs, colons, or equals signs to separate the name value pairs, so this would also be acceptable..</P>
<DIV class="code"><DIV class="codeHeader"><B>example_03.conf</B></DIV><DIV class="codeContent">
<PRE class="code-xml"><SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>?&gt;</SPAN>
<SPAN class="code-tag">&lt;openejb&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My PostgreSQL Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;CMP_ENTITY&quot;</SPAN>&gt;</SPAN>
! This is a comment
Global_TX_Database = conf/postgresql.cmp.global-database.xml
Local_TX_Database=conf/postgresql.cmp.local-database.xml
<SPAN class="code-tag">&lt;/Container&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My MySQL Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;CMP_ENTITY&quot;</SPAN>&gt;</SPAN>
# This is also a comment
Global_TX_Database:conf/mysql.cmp.global-database.xml
Local_TX_Database : conf/mysql.cmp.local-database.xml
<SPAN class="code-tag">&lt;/Container&gt;</SPAN>
<SPAN class="code-tag">&lt;Container id=<SPAN class="code-quote">&quot;My InstantDB Container&quot;</SPAN> ctype=<SPAN class="code-quote">&quot;CMP_ENTITY&quot;</SPAN>&gt;</SPAN>
Global_TX_Database conf/instantdb.cmp.global-database.xml
Local_TX_Database conf/instantdb.cmp.local-database.xml
<SPAN class="code-tag">&lt;/Container&gt;</SPAN>
<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
</DIV></DIV>
<H2><A name="ManualdelUsario-Configurationproperties"></A>Configuration properties</H2>
<P>The actual properties that each container type accepts are different for each type. Here is a reference for each container type.</P>
<H3><A name="ManualdelUsario-CMPENTITYproperties"></A>CMP_ENTITY properties</H3>
<H4><A name="ManualdelUsario-PoolSize"></A>PoolSize</H4>
<P>The default size of the method ready bean pools. Every bean class gets its own pool of this size. The value should be any integer.</P>
<P>Default:</P>
<BLOCKQUOTE><P>PoolSize 100</P></BLOCKQUOTE>
<H4><A name="ManualdelUsario-GlobalTXDatabase"></A>Global_TX_Database</H4>
<P>The name of the database.xml file that is used for global or container managed transactions. This will be used when the TransactionManager is managing the transaction, such as when the tx attribute is Supports(and there is a client tx), RequiresNew, Required or Manditory.</P>
<P>Specifies the configuration for obtaining database connections and the mapping.xml schema which describes how beans map to the database.</P>
<P>Default:</P>
<BLOCKQUOTE><P>Global_TX_Database conf/default.cmp_global_tx_database.xml</P></BLOCKQUOTE>
<H4><A name="ManualdelUsario-LocalTXDatabase"></A>Local_TX_Database</H4>
<P>The name of the database.xml file that is used for local or unspecified transaction contexts. This will be used when the TransactionManager is not managing the transaction, such as when the tx attribute is Supports (and there is no client tx), NotSupported, or Never.</P>
<P>Specifies the configuration for obtaining database connections and the mapping.xml schema which describes how beans map to the database.</P>
<P>Default:</P>
<BLOCKQUOTE><P>Local_TX_Database conf/default.cmp_local_tx_database.xml</P></BLOCKQUOTE>
<H3><A name="ManualdelUsario-BMPENTITYproperties"></A>BMP_ENTITY properties</H3>
<P>The BMP Container has no customizable properties to override.</P>
<H2><A name="ManualdelUsario-STATEFULproperties"></A>STATEFUL properties</H2>
<H4><A name="ManualdelUsario-Passivator"></A>Passivator</H4>
<P>The passivator is responsible for writing beans to disk at passivation time. Different passivators can be used by setting this property to the fully qualified class name of the PassivationStrategy implementation. The passivator is not responsible for invoking any callbacks or other processing, its only responsibly is to write the bean state to disk.</P>
<P>Known implementations:<BR>
org.openejb.core.stateful.RAFPassivater<BR>
org.openejb.core.stateful.SimplePassivater<BR>
Default:</P>
<BLOCKQUOTE><P>Passivator org.openejb.core.stateful.SimplePassivater</P></BLOCKQUOTE>
<H4><A name="ManualdelUsario-TimeOut"></A>TimeOut</H4>
<P>Specifies the time to wait between invocations. This value is measured in minutes. A value of 5 would result in a time-out of 5 minutes between invocations.</P>
<P>Default:</P>
<BLOCKQUOTE><P>TimeOut 20</P></BLOCKQUOTE>
<H4><A name="ManualdelUsario-PoolSize"></A>PoolSize</H4>
<P>Specifies the size of the bean pools for this stateful SessionBean container.</P>
<P>Default:</P>
<BLOCKQUOTE><P>PoolSize 100</P></BLOCKQUOTE>
<H4><A name="ManualdelUsario-BulkPassivate"></A>BulkPassivate</H4>
<P>Property name that specifies the number of instances to passivate at one time when doing bulk passivation. Must be less than the PoolSize.</P>
<P>Default:</P>
<BLOCKQUOTE><P>BulkPassivate 50</P></BLOCKQUOTE>
<H3><A name="ManualdelUsario-STATELESSproperties"></A>STATELESS properties</H3>
<H4><A name="ManualdelUsario-StrictPooling"></A>StrictPooling</H4>
<P>Specifies the whether or not to this stateless SessionBean container should use a strict pooling algorithm. true or false</P>
<P>Default:</P>
<BLOCKQUOTE><P>StrictPooling true</P></BLOCKQUOTE>
</DIV>
</DIV>
</DIV>
</P>
</TD>
</TR>
<TR height="5">
<TD width="20" height="5" bgcolor="#7270c2" valign="top" align="left">&nbsp;</TD>
<TD width="95" height="5" bgcolor="#7270c2" valign="top">&nbsp;</TD>
<TD width="7" height="5" bgcolor="#a9a5de" valign="top" align="left">&nbsp;</TD>
<TD width="40" height="5" valign="top" align="left">&nbsp;</TD>
<TD width="120" height="5" valign="top" align="left">&nbsp;</TD>
</TR>
<TR>
<TD width="20" height="5" bgcolor="#7270c2" valign="top" align="left">&nbsp;</TD>
<TD width="95" bgcolor="#7270c2" valign="BOTTOM" align="left">&nbsp;</TD>
<TD width="7" bgcolor="#a9a5de" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="25" border="0"></TD>
<TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="25" border="0"></TD>
<TD width="120" valign="top" align="left">&nbsp;</TD>
</TR>
<TR>
<TD width="20" height="5" bgcolor="#7270c2" valign="top" align="left">&nbsp;</TD>
<TD width="95" bgcolor="#7270c2" valign="BOTTOM" align="left">&nbsp;</TD>
<TD width="7" bgcolor="#a9a5de" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="25" border="0"></TD>
<TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="25" border="0"></TD>
<TD width="120" valign="top" align="left">&nbsp;</TD>
</TR>
<TR height="5">
<TD width="20" rowspan="2" height="100%" bgcolor="#7270c2" valign="bottom" align="left"><IMG src="http://incubator.apache.org/openejb/images/stripes1.gif" width="20" height="125" border="0"></TD>
<TD width="95" rowspan="2" height="100%" bgcolor="#7270c2" valign="bottom" align="left"><IMG src="http://incubator.apache.org/openejb/images/stripe105.gif" width="105" height="125" border="0"></TD>
<TD width="7" rowspan="2" height="100%" bgcolor="#a9a5de" valign="top" align="left">&nbsp;</TD>
<TD width="40" height="100%" valign="top" align="left">&nbsp;</TD>
<TD width="120" height="100%" valign="top" align="left">&nbsp;</TD>
</TR>
<TR height="5">
<TD width="40" height="25" valign="top" align="left">&nbsp;</TD>
<TD width="100%" height="25" valign="bottom" align="left"><BR>
<BR>
<IMG src="http://incubator.apache.org/openejb/images/line_light.gif" border="0" width="430" height="3"><BR>
<P>
</P>
<SPAN class="bodyGrey">
<SMALL><NOTICE><!-- $FOOTER -->
Apache OpenEJB is an project of The Apache Software Foundation (ASF)
</NOTICE> <BR>
&nbsp;<BR>
Powered by <A href="http://atlassian.com/">Atlassian</A> <A href="http://atlassian.com/confluence/">Confluence</A>.
</SMALL>
</SPAN>
<P>
</P>
</TD>
<TD width="120" height="25" valign="top" align="left">&nbsp;</TD>
</TR>
</TABLE>
</BODY>
</HTML>