blob: 2e42237a7c10e510eec6823e427375ec1d99f191 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Implementing the Solution | EclipseLink 2.7 Understanding EclipseLink</title>
<meta name="generator" content="Oracle DARB XHTML Converter (Mode = document) - Version 1.0.22 Build 1" />
<meta name="date" content="2014-06-10T10:35:14Z" />
<meta name="robots" content="noarchive" />
<meta name="doctitle" content="Implementing the Solution" />
<meta name="relnum" content="Release 2.7" />
<link rel="stylesheet" type="text/css" href="../../dcommon/style.css" media="screen" />
<link rel="copyright" href="../../dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
<link rel="start" href="../../index.htm" title="Home" type="text/html" />
<link rel="contents" href="toc.htm" title="Contents" type="text/html" />
<link rel="prev" href="jboss001.htm" title="Previous" type="text/html" />
<link rel="next" href="jboss003.htm" title="Next" type="text/html" />
<!-- START: Disqus --><script type="text/javascript"> var disqus_developer = 0; </script><!-- END: Disqus --><!-- START: Sharethis --><script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script><script type="text/javascript" src="http://s.sharethis.com/loader.js"></script> <!-- END: Sharethis --></head>
<body bgcolor="#FFFFFF"><iframe id="docheader" frameborder="0" framemargin="0" scrolling="no" src="../../dcommon/header.html"></iframe><script src="http://www.google.com/jsapi" type="text/javascript"></script><script type="text/javascript"> google.load('search', '1', {language : 'en'}); google.setOnLoadCallback(function() { var customSearchOptions = {}; var googleAnalyticsOptions = {}; googleAnalyticsOptions['queryParameter'] = 'q'; googleAnalyticsOptions['categoryParameter'] = ''; customSearchOptions['googleAnalyticsOptions'] = googleAnalyticsOptions; var customSearchControl = new google.search.CustomSearchControl( '016171230611334810008:enkkfjmsqju', customSearchOptions); customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); var options = new google.search.DrawOptions(); options.setSearchFormRoot('cse-search-form'); customSearchControl.draw('cse', options); }, true);</script><link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" /><div id="cse" style="width:100%;"></div>
<div class="header"><a id="top" name="top"></a>
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td align="left" valign="top"><font face="helvetica, arial, sans-serif"><b>EclipseLink Solutions Guide for EclipseLink</b><br />
Release 2.7</div></td>
<td valign="bottom" align="right" width="144">
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>&nbsp;</td>
<td align="center" valign="top"><a href="toc.htm"><img src="../../dcommon/images/contents.png" alt="Go To Table Of Contents" border="0" height="16" width="16" /><br />
</td><td>&nbsp;</td><td align="center"><a href="../../" target="_top" class="external text" title="Search" rel="nofollow"><img src="../../dcommon/images/search.png" alt="Search" style="border:0;" /><br /><span class="mini"></span></a></td><td>&nbsp;</td><td align="center"><a href="../eclipselink_otlcg.pdf" title="PDF" target="_blank"><img src="../../dcommon/images/pdf_icon.png" style="padding-right:5px;border:0" alt="PDF"></a></td>
</tr>
</table>
</td>
</tr>
</table>
<hr />
<table class="navigation simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100" align="center">
<tr>
<td align="center"><a href="jboss001.htm"><img src="../../dcommon/images/larrow.png" alt="Previous" border="0" height="16" width="16" /></a></td>
<td align="center"><a href="jboss003.htm"><img src="../../dcommon/images/rarrow.png" alt="Next" border="0" height="16" width="16" /></a></td>
<td>&nbsp;</td>
</tr>
</table>
</div>
<!-- class="header" -->
<div class="ind"><!-- End Header --><a id="BEIBJBCF" name="BEIBJBCF"></a><a id="TLADG747" name="TLADG747"></a>
<div class="sect1"><!-- infolevel="all" infotype="General" -->
<h1 class="sect1"><font face="arial, helvetica, sans-serif" color="#330099">Implementing the Solution</font></h1>
<p>To develop, deploy and run EclipseLink applications in JBoss Application Server 7, you must create EclipseLink as a module of JBoss. You must also create other modules, such as a JDBC driver, etc., in order to run applications.</p>
<p>This section contains the following tasks for using EclipseLink with JBoss 7.1:</p>
<ul>
<li>
<p><a href="#BEIFFJAJ">Task 1: Prerequisites</a></p>
</li>
<li>
<p><a href="#BEIHHAHD">Task 2: Configure EclipseLink as a Module in JBoss</a></p>
</li>
<li>
<p><a href="#BEIHDIBG">Task 3: Add ojdbc6.jar as a Module in JBoss</a></p>
</li>
<li>
<p><a href="#BEIIFFGB">Task 4: Create the Driver Definition and the Datasource</a></p>
</li>
<li>
<p><a href="#BEIDFCFI">Task 5: Create Users</a></p>
</li>
<li>
<p><a href="#BEIGFJIG">Task 6: Modify JBoss Properties</a></p>
</li>
<li>
<p><a href="#BEIHGDBJ">Task 7: Other Requirements</a></p>
</li>
<li>
<p><a href="#BEIGADEE">Task 8: Start JBoss</a></p>
</li>
</ul>
<a id="BEIFFJAJ" name="BEIFFJAJ"></a><a id="TLADG748" name="TLADG748"></a>
<div class="sect2"><!-- infolevel="all" infotype="General" -->
<h2 class="sect2"><font face="arial, helvetica, sans-serif" color="#330099">Task 1: Prerequisites</font></h2>
<p>Ensure that you have installed the following components:</p>
<ul>
<li>
<p>JBoss, version 7 or later. These instructions are based on JBoss release 7.1.1.</p>
<p>Download JBoss from <code><a href="http://www.jboss.org/jbossas/downloads/">http://www.jboss.org/jbossas/downloads/</a></code> . The version of JBoss must be identified as "Certified Java EE6." Version 7.1.1 or later is recommended.</p>
</li>
<li>
<p>EclipseLink 2.4 or later.</p>
<p>Download EclipseLink from <code><a href="http://www.eclipse.org/eclipselink/downloads/">http://www.eclipse.org/eclipselink/downloads/</a></code>.</p>
</li>
<li>
<p>Any compliant Java Database Connectivity (JDBC) database including Oracle Database, Oracle Express, MySQL, the HSQL database embedded in JBoss Application Server, and so on.</p>
<div align="center">
<div class="inftblnote"><br />
<table class="Note oac_no_warn" summary="" border="1" width="80%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<td align="left">
<p class="note"><img src="../../dcommon/images/note_icon.png" width="16" height="16" alt="Note" style="vertical-align:middle;padding-right:5px;" />Note:</p>
<p>Oracle XML DB (XDB) and JBoss Application Server both use port <code>8080</code> by default. If you have both available at the same URI, for example <code>localhost</code>, you must reconfigure one or the other to use a different port, for example <code>8081</code>.</p>
</td>
</tr>
</tbody>
</table>
<br /></div>
<!-- class="inftblnote" --></div>
<p>For the Oracle Database, see <code><a href="http://www.oracle.com/technetwork/database/enterprise-edition/overview/index.html">http://www.oracle.com/technetwork/database/enterprise-edition/overview/index.html</a></code>. For the Oracle Database, Express Edition, see <code><a href="http://www.oracle.com/technetwork/database/express-edition/overview/index.html">http://www.oracle.com/technetwork/database/express-edition/overview/index.html</a></code>. For MySQL, see <code><a href="http://www.oracle.com/us/products/mysql/index.html">http://www.oracle.com/us/products/mysql/index.html</a></code>. For information about the embedded HSQL database, see the JBoss documentation.</p>
</li>
<li>
<p>While it is not required, you may want to use a Java development environment (IDE) for convenience during development. For example JDeveloper, Oracle Enterprise Pack for Eclipse, and NetBeans all provide sophisticated Java EE development tools that support EclipseLink.</p>
<p>For JDeveloper, see <code><a href="http://www.oracle.com/technetwork/developer-tools/jdev/downloads/index.html">http://www.oracle.com/technetwork/developer-tools/jdev/downloads/index.html</a></code>. For Oracle Enterprise Pack for Eclipse, see <code><a href="http://www.oracle.com/technetwork/developer-tools/eclipse/overview/index.html">http://www.oracle.com/technetwork/developer-tools/eclipse/overview/index.html</a></code>. For NetBeans, see <code><a href="http://www.oracle.com/us/products/tools/050845.html">http://www.oracle.com/us/products/tools/050845.html</a></code>.</p>
</li>
</ul>
</div>
<!-- class="sect2" -->
<a id="BEIHHAHD" name="BEIHHAHD"></a><a id="TLADG749" name="TLADG749"></a>
<div class="sect2">
<h2 class="sect2"><font face="arial, helvetica, sans-serif" color="#330099">Task 2: Configure EclipseLink as a Module in JBoss</font></h2>
<p>To configure EclipseLink as a module in JBoss:</p>
<ol>
<li><a id="BEIJEJDJ" name="BEIJEJDJ"></a>
<p>Create a directory as follows:</p>
<p><em><code>JBOSS_ HOME</code></em><code>\modules\org\eclipse\persistence\main</code></p>
</li>
<li>
<p>Copy <code>eclipselink.jar</code> to the directory created in step <a href="#BEIJEJDJ">1</a>. (The <code>eclipselink.jar</code> file is located in the <code>eclipselink/jlib</code> directory of the <code>eclipselink-</code><em><code>ver_no</code></em><code>.zip</code> file.)</p>
</li>
<li>
<p>Create a <code>module.xml</code> file in the directory created in step <a href="#BEIJEJDJ">1</a>, with the following content:</p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;module xmlns="urn:jboss:module:1.1" name="org.eclipse.persistence"&gt;
&lt;resources&gt;
&lt;resource-root path="eclipselink.jar"/&gt;
&lt;!-- Insert resources here --&gt;
&lt;/resources&gt;
&lt;dependencies&gt;
&lt;module name="javax.api"/&gt;
&lt;module name="javax.persistence.api"/&gt;
&lt;module name="javax.transaction.api"/&gt;
&lt;module name="javax.validation.api"/&gt;
&lt;module name="javax.xml.bind.api"/&gt;
&lt;module name="org.antlr"/&gt;
&lt;module name="org.apache.commons.collections"/&gt;
&lt;module name="org.dom4j"/&gt;
&lt;module name="org.javassist"/&gt;
&lt;module name="org.jboss.logging"/&gt;
&lt;module name="com.oracle.ojdbc6"/&gt;
&lt;/dependencies&gt;
&lt;/module&gt;
</pre></li>
</ol>
</div>
<!-- class="sect2" -->
<a id="BEIHDIBG" name="BEIHDIBG"></a><a id="TLADG674" name="TLADG674"></a>
<div class="sect2"><!-- infolevel="all" infotype="General" -->
<h2 class="sect2"><font face="arial, helvetica, sans-serif" color="#330099">Task 3: Add ojdbc6.jar as a Module in JBoss</font></h2>
<p>Add the Oracle thin driver <code>ojdbc6.jar</code> as a module within JBoss, as follows:</p>
<ol>
<li><a id="BEIBFGCF" name="BEIBFGCF"></a>
<p>Create the module directory:</p>
<p><em><code>JBOSS_ HOME</code></em><code>\modules\com\oracle\ojdbc6\main</code></p>
</li>
<li>
<p>Copy <code>ojdbc6.jar</code> to the module directory created in step <a href="#BEIBFGCF">1</a>.</p>
</li>
<li>
<p>Create a <code>module.xml</code> file in the module directory created in step <a href="#BEIBFGCF">1</a>, with the following contents:</p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;module xmlns="urn:jboss:module:1.1" name="com.oracle.ojdbc6"&gt;
&lt;resources&gt;
&lt;resource-root path="ojdbc6.jar"/&gt;
&lt;!-- Insert resources here --&gt;
&lt;/resources&gt;
&lt;dependencies&gt;
&lt;module name="javax.api"/&gt;
&lt;/dependencies&gt;
&lt;/module&gt;
</pre></li>
</ol>
</div>
<!-- class="sect2" -->
<a id="BEIIFFGB" name="BEIIFFGB"></a><a id="TLADG675" name="TLADG675"></a>
<div class="sect2"><!-- infolevel="all" infotype="General" -->
<h2 class="sect2"><font face="arial, helvetica, sans-serif" color="#330099">Task 4: Create the Driver Definition and the Datasource</font></h2>
<p>Create the driver definition and create the datasource.</p>
<p>The following instructions tell how to configure JBoss for running in standalome mode, using the <code>standalone.xml</code> configuration file. For instructions on how to use <code>domain.xml</code> to configure JBoss for running in domain mode, see the JBoss documentation.</p>
<ol>
<li>
<p>In the standalone configuration file <code>JBOSS_ HOME</code><code>\standalone\configuration\standalone.xml</code>, find the following:</p>
<p><code>&lt;subsystem xmlns="urn:jboss:domain:datasources:1.0"&gt;</code></p>
</li>
<li>
<p>In that section, configure the datasource. The following example shows a configuration for the Oracle Database, using the Oracle JDBC Thin driver. For instructions on configuring other datasources, see the JBoss documentation.</p>
</li>
</ol>
<pre xml:space="preserve" class="oac_no_warn">
&lt;subsystem xmlns="urn:jboss:domain:datasources:1.0"&gt;
&lt;datasources&gt;
&lt;datasource jndi-name="java:/EclipseLinkDS"
pool-name="EclipseLinkDS"
enabled="true"
jta="true"
use-java-context="true"
use-ccm="true"&gt;
&lt;connection-url&gt;jdbc:oracle:thin:<em>node_name.example.com</em>:1521:TOPLINK&lt;/connection-url&gt;
&lt;driver&gt;oracle&lt;/driver&gt;
&lt;transaction-isolation&gt;TRANSACTION_READ_COMMITTED&lt;/transaction-isolation&gt;
&lt;pool&gt;
&lt;prefill&gt;true&lt;/prefill&gt;
&lt;use-strict-min&gt;false&lt;/use-strict-min&gt;
&lt;flush-strategy&gt;FailingConnectionOnly&lt;/flush-strategy&gt;
&lt;/pool&gt;
&lt;security&gt;
&lt;user-name&gt;Smith&lt;/user-name&gt;
&lt;password&gt;<em>password</em>&lt;/password&gt;
&lt;/security&gt;
&lt;/datasource&gt;
&lt;driver name="oracle" module="com.oracle.ojdbc6"&gt;
&lt;xa-datasource-class&gt;oracle.jdbc.OracleDriver&lt;/xa-datasource-class&gt;
&lt;/driver&gt;
&lt;/datasources&gt;
&lt;/subsystem&gt;
</pre></div>
<!-- class="sect2" -->
<a id="BEIDFCFI" name="BEIDFCFI"></a><a id="TLADG676" name="TLADG676"></a>
<div class="sect2"><!-- infolevel="all" infotype="General" -->
<h2 class="sect2"><font face="arial, helvetica, sans-serif" color="#330099">Task 5: Create Users</font></h2>
<p>Starting with JBoss Application Server 7.1, you must create an Application User to get started, because remote access to the JNDI tree is secured by default, and you must provide login credentials. Therefore, at a minimum, you just create an Application User to be able to deploy an application to the server. If you want to use the JBoss administration console for administration tasks, for example to view the JNDI tree, you must also create an Administration User.</p>
<p>To create user credentials, use the JBoss <code>add-user.bat</code> utility, located in <em><code>JBOSS_HOME</code></em><code>\bin\</code>.</p>
<p>For more information about security in JBoss Application Server, refer to the JBoss documentation.</p>
</div>
<!-- class="sect2" -->
<a id="BEIGFJIG" name="BEIGFJIG"></a><a id="TLADG677" name="TLADG677"></a>
<div class="sect2"><!-- infolevel="all" infotype="General" -->
<h2 class="sect2"><font face="arial, helvetica, sans-serif" color="#330099">Task 6: Modify JBoss Properties</font></h2>
<p>Modify JBoss properties, as follows:</p>
<pre xml:space="preserve" class="oac_no_warn">
## JBoss-7.x
server.factory=org.jboss.naming.remote.client.InitialContextFactory
java.naming.factory.url.pkgs=org.jboss.ejb.client.naming
server.depend=jboss-client.jar
jboss.server=${jboss.home}/standalone
server.lib=${jboss.home}/bin/client
server.url=remote://localhost:4447
server.user=usera
server.pwd=passworda
jboss.naming.client.ejb.context=true
</pre></div>
<!-- class="sect2" -->
<a id="BEIHGDBJ" name="BEIHGDBJ"></a><a id="TLADG681" name="TLADG681"></a>
<div class="sect2"><!-- infolevel="all" infotype="General" -->
<h2 class="sect2"><font face="arial, helvetica, sans-serif" color="#330099">Task 7: Other Requirements</font></h2>
<ol>
<li>
<p>Add <code>junit.jar</code> in the <code>ear</code> under the <code>\lib</code> directory.</p>
</li>
<li>
<p>Because of a classloading issue in JBoss, you must list all your entity classes in <code>persistence.xml</code>. You can use either <code>&lt;class&gt;</code> elements or a global <code>&lt;exclude-unlisted-classes&gt;false&lt;/exclude-unlisted-classes&gt;</code> element.</p>
</li>
<li>
<p>Add both <code>jndi.properties</code> and <code>jboss-ejb-client.properties</code> in the client classpath.</p>
</li>
</ol>
</div>
<!-- class="sect2" -->
<a id="BEIGADEE" name="BEIGADEE"></a><a id="TLADG680" name="TLADG680"></a>
<div class="sect2"><!-- infolevel="all" infotype="General" -->
<h2 class="sect2"><font face="arial, helvetica, sans-serif" color="#330099">Task 8: Start JBoss</font></h2>
<p>Start JBoss by running <code>standalone.bat</code> (for a single-server configuration) or <code>domain.bat</code> file (in a clustered environment) in <em><code>JBOSS_ HOME</code></em><code>\bin\</code>.</p>
<p>For information on different ways to configure and start JBoss, see the JBoss documentation.</p>
</div>
<!-- class="sect2" --></div>
<!-- class="sect1" --></div>
<!-- class="ind" -->
<!-- Start Footer -->
<div class="footer">
<hr />
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
<col width="33%" />
<col width="*" />
<col width="33%" />
<tr>
<td valign="bottom">
<table class="navigation simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100" align="center">
<col width="*" />
<col width="48%" />
<col width="48%" />
<tr>
<td>&nbsp;</td>
<td align="center"><a href="jboss001.htm"><img src="../../dcommon/images/larrow.png" alt="Previous" border="0" height="16" width="16" /></a></td>
<td align="center"><a href="jboss003.htm"><img src="../../dcommon/images/rarrow.png" alt="Next" border="0" height="16" width="16" /></a></td>
</tr>
</table>
</td>
<td align="center" width="34%"><a href="http://www.eclipse.org/eclipselink/" title="EclipseLink home"><img src="../../dcommon/images/ellogo.png" alt="EclipseLink" width="150" border="0" /></a><br />
<font size="-2">Copyright&nbsp;&copy;&nbsp;2014,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</font> <a href="../../dcommon/html/cpyr.htm"><br />
<td valign="bottom" align="right">
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="225">
<tr>
<td>&nbsp;</td>
<td align="center" valign="top"><a href="toc.htm"><img src="../../dcommon/images/contents.png" alt="Go To Table Of Contents" border="0" height="16" width="16" /><br />
</td><td>&nbsp;</td><td align="center"><a href="../../" target="_top" class="external text" title="Search" rel="nofollow"><img src="../../dcommon/images/search.png" alt="Search" style="border:0;" /><br /><span class="mini"></span></a></td><td>&nbsp;</td><td align="center"><a href="../eclipselink_otlcg.pdf" title="PDF" target="_blank"><img src="../../dcommon/images/pdf_icon.png" style="padding-right:5px;border:0" alt="PDF"></a></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!-- class="footer" -->
<div id="copyright">Copyright &copy; 2014 by The Eclipse Foundation under the <a href="http://www.eclipse.org/org/documents/epl-v10.php">Eclipse Public License (EPL)</a><br /> <script type="text/javascript">var LastUpdated = document.lastModified;document.writeln ("Updated: " + LastUpdated);</script> </div><!-- START: Analytics --><script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1608008-2']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script><!-- END: Analytics --><!-- START: Sharethis --><script>var options={ "publisher": "e2fe9e07-fab6-4f84-83ea-0991b429842c", "position": "right", "ad": { "visible": false, "openDelay": 5, "closeDelay": 0}};var st_hover_widget = new sharethis.widgets.hoverbuttons(options);</script><!-- END: Sharethis --></body>
</html>