users@glassfish.java.net

Re: Application scoped resources and persistence.xml do not work together, what I

From: <jagadish.ramu_at_oracle.com>
Date: Tue, 9 Oct 2012 19:58:57 -0700 (PDT)

rom: Jagadish Prasath Ramu <jagadish.ramu_at_oracle.com>
Reply-To: jagadish.ramu_at_oracle.com
To: users_at_glassfish.java.net
Date: Tue, 09 Oct 2012 19:58:55 -0700
In-Reply-To: <listhandler=29&site=www.java.net&nid=891288&pid=0&cid=&uid=202983&tid=&8d9b175655d2ffb6566abd57e9f38f8d_at_www.java.net>
References:
        <listhandler=29&site=www.java.net&nid=891288&pid=0&cid=&uid=202983&tid=&8d9b175655d2ffb6566abd57e9f38f8d_at_www.java.net>
Organization: Oracle
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.2.2-
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0

A simple test-case that uses application scoped resources with JPA seems
to work fine for me (trunk based build).
appserv-tests/devtests/connector/v3/jpa-tx-propagation-gf-resources-xml
Can you raise a JIRA issue with the sample .ear (and steps if any) ?

Thanks,
-Jagadish

On Mon, 2012-10-08 at 11:01 -0500, forums_at_java.net wrote:
> I've got pretty simple application packaged as ear. This application include
> one ejb module, one datamodel.jar (inside lib directory which include
> persistence.xml) and glassfish-resources.xml in META-INF subdirectory of ear.
> Contents of persistence.xml: ... < persistence-unit
> name="inventory-datamodel" transaction-type="JTA"> <
> provider>org.eclipse.persistence.jpa.PersistenceProvider <
> jta-data-source>java:app/jdbc/InventoryPool2 ... Contents of
> glassfish-resources.xml: < resources> < jdbc-connection-pool
> datasource-classname="org.postgresql.xa.PGXADataSource"
> res-type="javax.sql.XADataSource" name="java:app/AppInventoryPool"
> validate-atmost-once-period-in-seconds="10" > < property name="databaseName"
> value="hp-inventory"/> < property name="serverName"
> value="hp-inventory-stage"/> .... < jdbc-resource
> pool-name="java:app/AppInventoryPool"
> jndi-name="java:app/jdbc/InventoryPool2" /> Deployment of application goes
> fine. But when I restart server I got following exception stack:
> java.lang.RuntimeException: javax.naming.NameNotFoundException: No object
> bound to name java:app/jdbc/InventoryPool2 at
> org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.(PersistenceUnitInfoImpl.java:111)
> at
> org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:155)
> at
> org.glassfish.persistence.jpa.PersistenceUnitLoader.(PersistenceUnitLoader.java:120)
> at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:224)
> at
> org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:495)
> at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:233)
> at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168) at
> com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:871)
> at
> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:410)
> at
> com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:375)
> ... This error leads to uninitialized EJBs and other stuff (e.g. iiop
> listener do not start properly). I assume that this happens because
> ApplicationLoaderService invoked before ApplicationScopedResourcesManager -
> i.e. resources from glassfish-resources.xml (or may be domain.xml) not yet
> have been read and lookup do not return anything. I want to mention that this
> problem only related to application scoped resources, NOT to globally
> defined. My question is anyone know how to workaround this? (Except for
> creating global resources)
>
> --
>
> [Message sent by forum member 'gray']
>
> View Post: http://forums.java.net/node/891288
>
>