<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    JBoss : persistence and EntityManager injection
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/zecas">zecas zecas</a> in <i>Beginner's Corner</i> - <a href="http://community.jboss.org/message/566354#566354">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I'm starting a small testing project from scratch, but I'm getting some trouble configuring JPA persistence ... I'll post some code fragments and hope someone can enlight me on the issue.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have an EAR, my-ear, and inside there is a single WAR, my-war. All definitions should be placed correctly, since I can make it to pick all settings, even those defined in "persistence.xml".</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="text-decoration: underline;"> my-war structure</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">C:.
|&#160;&#160; index.jsp
|
+---META-INF
|&#160;&#160;&#160;&#160;&#160;&#160; MANIFEST.MF
|
\---WEB-INF
&#160;&#160;&#160; |&#160;&#160; faces-config.xml
&#160;&#160;&#160; |&#160;&#160; jboss-web.xml
&#160;&#160;&#160; |&#160;&#160; web.xml
&#160;&#160;&#160; |
&#160;&#160;&#160; +---classes
&#160;&#160;&#160; |&#160;&#160; +---com
&#160;&#160;&#160; |&#160;&#160; |&#160;&#160; \---my
&#160;&#160;&#160; |&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160; \---package
&#160;&#160;&#160; |&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SimpleMessage.class
&#160;&#160;&#160; |&#160;&#160; |
&#160;&#160;&#160; |&#160;&#160; \---META-INF
&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; persistence.xml
&#160;&#160;&#160; |
&#160;&#160;&#160; \---lib
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="text-decoration: underline;"> web.xml</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;web-app ...&gt;</span>
&#160;&#160;&#160; ...
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;resource-ref&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;description&gt;</span>Datasource Connection<span class="jive-xml-tag">&lt;/description&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;res-ref-name&gt;</span>jdbc/MyDB<span class="jive-xml-tag">&lt;/res-ref-name&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;res-type&gt;</span>javax.sql.DataSource<span class="jive-xml-tag">&lt;/res-type&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;res-auth&gt;</span>Container<span class="jive-xml-tag">&lt;/res-auth&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;res-sharing-scope&gt;</span>Shareable<span class="jive-xml-tag">&lt;/res-sharing-scope&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/resource-ref&gt;</span>
<span class="jive-xml-tag">&lt;/web-app&gt;</span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="text-decoration: underline;"> jboss-web.xml</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;jboss-web&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;resource-ref&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;res-ref-name&gt;</span>jdbc/MyDB<span class="jive-xml-tag">&lt;/res-ref-name&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;jndi-name&gt;</span>java:/ds/MyDB<span class="jive-xml-tag">&lt;/jndi-name&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/resource-ref&gt;</span>
<span class="jive-xml-tag">&lt;/jboss-web&gt;</span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="text-decoration: underline;"> persistence.xml</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag"><span>&lt;persistence version="2.0"
&#160;&#160;&#160; xmlns="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence" target="_blank">http://java.sun.com/xml/ns/persistence</a><span>"
&#160;&#160;&#160; xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>"&gt;</span></span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;persistence-unit name="punit"&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;jta-data-source&gt;</span>java:jdbc/MyDB<span class="jive-xml-tag">&lt;/jta-data-source&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/persistence-unit&gt;</span>
<span class="jive-xml-tag">&lt;/persistence&gt;</span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>My Java code has the following class:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="text-decoration: underline;">SimpleMessage.java</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-java"><font color="navy"><b>package</b></font> com.my.package; 
&#160;
<font color="navy"><b>import</b></font> javax.persistence.PersistenceContext;
&#160;
<font color="navy"><b>public</b></font> <font color="navy"><b>class</b></font> SimpleMessage <font color="navy">{</font>
&#160;
&#160;&#160;&#160; @PersistenceContext
&#160;&#160;&#160; <font color="navy"><b>private</b></font> EntityManager em;
&#160;
&#160;&#160;&#160; @PersistenceUnit(name=<font color="red">"punit"</font>)
&#160;&#160;&#160; <font color="navy"><b>private</b></font> EntityManagerFactory emf;
&#160;
&#160;&#160;&#160; <font color="navy"><b>public</b></font> <font color="navy"><b>void</b></font> something() <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>if</b></font>( em!=<font color="navy"><b>null</b></font> ) <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(<font color="red">"EntityManager Available!"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font> <font color="navy"><b>else</b></font> <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(<font color="red">"EntityManager is NULL!"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>if</b></font>( emf!=<font color="navy"><b>null</b></font> ) <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(<font color="red">"EntityManagerFactory Available!"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font> <font color="navy"><b>else</b></font> <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(<font color="red">"EntityManagerFactory is NULL!"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
&#160;&#160;&#160; <font color="navy">}</font>
<font color="navy">}</font> 
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I intend to test just this ... a simple basic class where I inject the manager instance. The class is not an EJB class, just an basic injected class.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>When deploying, I get the following result:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">2010-10-13 14:09:55,197 INFO [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (HDScanner) deploy, ctxPath=/my-war
2010-10-13 14:09:55,213 ERROR [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (HDScanner) ENC setup failed
java.lang.NullPointerException
 at org.jboss.injection.PersistenceUnitHandler.getManagedEntityManagerFactory(PersistenceUnitHandler.java:149)
 at org.jboss.injection.PcEncInjector.inject(PcEncInjector.java:76)
 at org.jboss.web.tomcat.service.TomcatInjectionContainer.populateEnc(TomcatInjectionContainer.java:482)
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>However, if in "persistence.xml" I instead define the datasource reference as "java:ds/MyDB" (datasource name definition on JBoss), I obtain the following result:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">2010-10-13 14:15:20,552 INFO&#160; [org.jboss.jpa.deployment.PersistenceUnitDeployment] (HDScanner)&#160; Starting persistence unit&#160; persistence.unit:unitName=my-ear-1.0.0.ear/my-war-1.0.0.war#punit
2010-10-13 14:15:20,552 INFO [org.hibernate.ejb.Ejb3Configuration] (HDScanner) Processing PersistenceUnitInfo [
 name: punit
 ...]
2010-10-13&#160; 14:15:20,552 WARN [org.hibernate.ejb.Ejb3Configuration] (HDScanner)&#160; Persistence provider caller does not implement the EJB3 spec correctly.&#160; PersistenceUnitInfo.getNewTempClassLoader() is null.
2010-10-13&#160; 14:15:20,568 INFO&#160; [org.hibernate.cfg.search.HibernateSearchEventListenerRegister]&#160; (HDScanner) Unable to find&#160; org.hibernate.search.event.FullTextIndexEventListener on the classpath.&#160; Hibernate Search is not enabled.
2010-10-13 14:15:20,568 INFO&#160; [org.hibernate.connection.ConnectionProviderFactory] (HDScanner)&#160; Initializing connection provider:&#160; org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
2010-10-13&#160; 14:15:20,568 INFO&#160; [org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider]&#160; (HDScanner) Using provided datasource
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) RDBMS: MySQL, version: 5.1.41-3ubuntu12.6
2010-10-13&#160; 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) JDBC&#160; driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.10 (&#160; Revision: ${svn.Revision} )
2010-10-13 14:15:20,568 INFO [org.hibernate.dialect.Dialect] (HDScanner) Using dialect: org.hibernate.dialect.MySQLDialect
2010-10-13&#160; 14:15:20,568 INFO [org.hibernate.transaction.TransactionFactoryFactory]&#160; (HDScanner) Transaction strategy:&#160; org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
2010-10-13&#160; 14:15:20,568 INFO&#160; [org.hibernate.transaction.TransactionManagerLookupFactory] (HDScanner)&#160; instantiating TransactionManagerLookup:&#160; org.hibernate.transaction.JBossTransactionManagerLookup
2010-10-13&#160; 14:15:20,568 INFO&#160; [org.hibernate.transaction.TransactionManagerLookupFactory] (HDScanner)&#160; instantiated TransactionManagerLookup
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Automatic flush during beforeCompletion(): disabled
2010-10-13&#160; 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner)&#160; Automatic session close at end of transaction: disabled
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) JDBC batch size: 15
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) JDBC batch updates for versioned data: disabled
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Scrollable result sets: enabled
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) JDBC3 getGeneratedKeys(): enabled
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Connection release mode: auto
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Maximum outer join fetch depth: 2
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Default batch fetch size: 1
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Generate SQL with comments: disabled
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Order SQL updates by primary key: disabled
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Order SQL inserts for batching: disabled
2010-10-13&#160; 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Query&#160; translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2010-10-13 14:15:20,568 INFO [org.hibernate.hql.ast.ASTQueryTranslatorFactory] (HDScanner) Using ASTQueryTranslatorFactory
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Query language substitutions: {}
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) JPA-QL strict compliance: enabled
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Second-level cache: enabled
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Query cache: disabled
2010-10-13&#160; 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Cache&#160; region factory :&#160; org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
2010-10-13&#160; 14:15:20,568 INFO&#160; [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge]&#160; (HDScanner) Cache provider: org.hibernate.cache.HashtableCacheProvider
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Optimize cache for minimal puts: disabled
2010-10-13&#160; 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Cache&#160; region prefix:&#160; persistence.unit:unitName=my-ear-1.0.0.ear/my-war-1.0.0.war#punit
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Structured second-level cache entries: disabled
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Statistics: disabled
2010-10-13&#160; 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner)&#160; Deleted entity synthetic identifier rollback: disabled
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Default entity-mode: pojo
2010-10-13 14:15:20,568 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Named query checking : enabled
2010-10-13 14:15:20,568 INFO [org.hibernate.impl.SessionFactoryImpl] (HDScanner) building session factory
2010-10-13&#160; 14:15:20,568 INFO [org.hibernate.impl.SessionFactoryObjectFactory]&#160; (HDScanner) Factory name:&#160; persistence.unit:unitName=my-ear-1.0.0.ear/my-war-1.0.0.war#punit
2010-10-13&#160; 14:15:20,568 INFO [org.hibernate.util.NamingHelper] (HDScanner) JNDI&#160; InitialContext&#160; properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,&#160; java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
2010-10-13&#160; 14:15:20,584 INFO [org.hibernate.impl.SessionFactoryObjectFactory]&#160; (HDScanner) Bound factory to JNDI name:&#160; persistence.unit:unitName=my-ear-1.0.0.ear/my-war-1.0.0.war#punit
2010-10-13&#160; 14:15:20,584 WARN [org.hibernate.impl.SessionFactoryObjectFactory]&#160; (HDScanner) InitialContext did not implement EventContext
2010-10-13&#160; 14:15:20,584 INFO [org.hibernate.util.NamingHelper] (HDScanner) JNDI&#160; InitialContext&#160; properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,&#160; java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
2010-10-13 14:15:20,724 INFO [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (HDScanner) deploy, ctxPath=/my-war
2010-10-13&#160; 14:15:20,755 INFO [javax.enterprise.resource.webcontainer.jsf.config]&#160; (HDScanner) Initializing Mojarra (1.2_12-b01-FCS) for context '/my-war'&#160; 
2010-10-13 14:15:20,896 ERROR [STDERR] (HDScanner) SLF4J: Class path contains multiple SLF4J bindings.
2010-10-13&#160; 14:15:20,896 ERROR [STDERR] (HDScanner) SLF4J: Found binding in&#160; [vfszip:/C:/Program&#160; Files/Java/jboss-5.1.0.GA/common/lib/slf4j-jboss-logging.jar/org/slf4j/impl/StaticLoggerBinder.class]
2010-10-13&#160; 14:15:20,896 ERROR [STDERR] (HDScanner) SLF4J: Found binding in&#160; [vfszip:/C:/Program&#160; Files/Java/jboss-5.1.0.GA/server/default/deploy/my-ear-1.0.0.ear/logback-classic-0.9.20.jar/org/slf4j/impl/StaticLoggerBinder.class]
2010-10-13&#160; 14:15:20,912 ERROR [STDERR] (HDScanner) SLF4J: See&#160; http://www.slf4j.org/codes.html#multiple_bindings for an explanation.</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>So my questions are:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>1#</strong> After invoking "SimpleMessage.something();" (using the second option "java:ds/MyDB" in "persistence.xml") I receive the following output:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">EntityManager is NULL!
EntityManagerFactory is NULL!
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>So no injection happened ... shouldn't it occur? what happened?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><br/><strong>2#</strong> I was assuming that "web.xml" defines the JNDI to be used inside my webapp, then "jboss-web.xml" would map that name into the internall JNDI defined in JBoss.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>In this case for JBoss usage, if changing to IBM WebSphere I would use another mapping config file.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>BUT ... I was also assuming that "persistence.xml" would define the JNDI that is defined in "web.xml" ... and not the one defined in application server level ... so I would get an abstraction from whichever server I'll deploy my project into.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Shouldn't this be working like that? What am I doing wrong?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Any help would be appreciated ... I really need to understand and put this to work ...</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/566354#566354">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Beginner's Corner at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>