Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » PersistenceUnitInfo xxx has transactionType JTA, but doesnt have jtaDataSource
PersistenceUnitInfo xxx has transactionType JTA, but doesnt have jtaDataSource [message #385491] Fri, 20 February 2009 01:56 Go to next message
Ari Meyer is currently offline Ari Meyer
Messages: 136
Registered: July 2009
Senior Member
Hi all,

I posted this to the Spring Data Access forum, but got no responses.
Anyone have any recommendations?

Thanks in advance,
Ari


I got this error when deploying a Spring-JPA EAR to WebLogic 10.3:

org.eclipse.persistence.exceptions.EntityManagerSetupExcepti on
Exception Description: PersistenceUnitInfo xxx has transactionType JTA,
but doesnt have jtaDataSource.

trace:

<Feb 6, 2009 8:20:08 PM GMT> <Error> <Deployer> <BEA-149265> <Failure
occurred in the execution of deployment request with ID '1233951591173'
for task '0'. Error is: 'weblogic.application.ModuleException: '
weblogic.application.ModuleException:
at
weblogic.servlet.internal.WebAppModule.prepare(WebAppModule. java:393)
at
weblogic.application.internal.flow.ScopedModuleDriver.prepar e(ScopedModuleDriver.java:176)
at
weblogic.application.internal.flow.ModuleListenerInvoker.pre pare(ModuleListenerInvoker.java:93)
at
weblogic.application.internal.flow.DeploymentCallbackFlow$1. next(DeploymentCallbackFlow.java:387)
at
weblogic.application.utils.StateMachineDriver.nextState(Stat eMachineDriver.java:37)
Truncated. see log file for complete stacktrace
Exception [EclipseLink-28010] (Eclipse Persistence Services - 1.0.2
(Build 20081024)):
org.eclipse.persistence.exceptions.EntityManagerSetupExcepti on Exception
Description: PersistenceUnitInfo xxx has transactionType JTA, but doesnt
have jtaDataSource.
at
org.eclipse.persistence.exceptions.EntityManagerSetupExcepti on.jtaPersistenceUnitInfoMissingJtaDataSource(EntityManagerS etupException.java:154)
at
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl. predeploy(EntityManagerSetupImpl.java:790)
at
org.eclipse.persistence.jpa.PersistenceProvider.createContai nerEntityManagerFactory(PersistenceProvider.java:189)
at
weblogic.deployment.PersistenceUnitInfoImpl.createEntityMana gerFactory(PersistenceUnitInfoImpl.java:330)
at
weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:123)
Truncated. see log file for complete stacktrace


Strangely, everything worked fine when testing with Eclipse/WTP and the
exact same configurations, but when I packaged up an EAR with Maven and
manually deployed to the same WebLogic instance, the error appeared.
Apparently, WebLogic is attempting to load persistence.xml at startup
before Spring loads. The Spring reference warns about this:

Note that this option may conflict with the built-in JPA capabilities of
a Java EE 5 server. So when running in a full Java EE 5 environment,
consider obtaining your EntityManagerFactory from JNDI. Alternatively,
specify a custom "persistenceXmlLocation" on your
LocalContainerEntityManagerFactoryBean definition, e.g.
"META-INF/my-persistence.xml", and only include a descriptor with that
name in your application jar files. Since the Java EE 5 server will
only look for default META-INF/persistence.xml files, it will ignore
such custom persistence units and hence avoid conflicts with a
Spring-driven JPA setup upfront. (This applies to Resin 3.1, for example.)

I would rather not rename persistence.xml, though, as everything works
fine with Eclipse Dali JPA (could probably handle a name change, but I
don't want to mess with it). I was able to get it to work by hardcoding
the <jta-data-source> in persistence.xml, but I'd much rather leave that
blank and have Spring manage the datasources, since I have separate test
and web configs. It also worked, alternatively, by setting
transaction-type="RESOURCE_LOCAL" in the <persistence-unit>, and my
non-JNDI unit tests would also run fine with this setting, but that
again is something I'd rather not hardcode here. (Initially, I didn't
specify transaction-type at all, but I think it defaults to "JTA".) Has
anyone else encountered this issue and found a cleaner way to use Spring
for managing JPA datasources/EntityManagerFactories? Also, I'm still
unclear why this worked from Eclipse/WTP/WebLogic but not with my
manually deployed EAR.

Here are relevant snippets from my Spring config:

<jee:jndi-lookup id="xxxDataSourceRef" jndi-name="jdbc/xxx"/>


<bean id="entityManagerFactoryRef"

class=" org.springframework.orm.jpa.LocalContainerEntityManagerFacto ryBean "
p:dataSource-ref="xxxDataSourceRef">
<property name="persistenceUnitName" value="xxx"/>
<property name="jpaVendorAdapter">
<bean
class=" org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapt er "

p:databasePlatform=" org.eclipse.persistence.platform.database.oracle.OraclePlatf orm "
p:showSql="true"/>
</property>
</bean>

<bean id="transactionManagerRef"
class="org.springframework.orm.jpa.JpaTransactionManager"
p:entityManagerFactory-ref="entityManagerFactoryRef"/>


and persistence.xml:

<persistence-unit name="xxx" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >
<!--
<jta-data-source>jdbc/xxx</jta-data-source>
-->
...

<properties>
<property name="eclipselink.logging.level" value="WARNING"/>
<property name="eclipselink.jdbc.driver"
value="oracle.jdbc.OracleDriver"/>
<property name="eclipselink.jdbc.url" value="yyy"/>
<property name="eclipselink.jdbc.user" value="xxx"/>
<property name="eclipselink.jdbc.password" value="zzz"/>
<property name="eclipselink.weaving" value="static"/>
</properties>
</persistence-unit>


Thanks!
Ari
Re: PersistenceUnitInfo xxx has transactionType JTA, but doesnt have jtaDataSource [message #385497 is a reply to message #385491] Mon, 23 February 2009 09:44 Go to previous messageGo to next message
Michael OBrien is currently offline Michael OBrien
Messages: 34
Registered: July 2009
Member
Ari,
Hi, that error usually means that EclipseLink is not receiving
connections from your JTA datasource. This could mean the database is
down, the datasource has a different JNDI name, or the globally or
application defined datasource is not setup.
Q) Behavior when transation-type is ommitted?
A) Yes, When you run in an EE environment - the persistence unit
transaction-type defaults to "JTA", when it is run as SE - the
transaction-type defaults to RESOURCE_LOCAL

From your persistence.xml it looks like you are setup for non-JTA
RESOURCE_LOCAL, try adding the target-database property.
When you run in JTA mode, are you running the datasource as a globally
defined datasource or an application managed datasource?
If you are running as an application managed datasource, make sure you
have the config set in a *-jdbc.xml configuration file and that this file
is referenced in weblogic-application.xml on the EAR. Note: For now you
will also need to specify the specification JTA properties as well as the
jta-data-source element...
<property name="javax.persistence.jtaDataSource"
value="java:app/jdbc/appScopedLocalJTA"/>
<property name="javax.persistence.nonJtaDataSource"
value="java:app/jdbc/appScopedLocalJTA"/>

See:
http://wiki.eclipse.org/EclipseLink/Examples/JPA/WLS_AppScop ed_DataSource


As to why a manual EAR deployment does not work but Eclipe WTP is
working?
The latest ORacle WebLogic 10.3 plugin runs the same ant scripts that
the server does so the runtime environment should be the same. However
packaging an EAR with Maven or the Eclipse IDE packager may be different.
I would verify that the datasource is working outside of the EAR (so we
are not seeing a jdbc jar issue) - as you must have had to add the jdbc
jar to your path/manifest when running as RESOURCE_LOCAL.


hope this helps to start.
thank you
/michael
Re: PersistenceUnitInfo xxx has transactionType JTA, but doesnt have jtaDataSource [message #385748 is a reply to message #385497] Mon, 02 March 2009 18:56 Go to previous message
Ari Meyer is currently offline Ari Meyer
Messages: 136
Registered: July 2009
Senior Member
Hi Michael,

Thanks for the detailed response. The main issue I have is that I
really want to have Spring drive as much as possible, and not have to
hardcode all these properties into persistence.xml (and other config
files). This way I can have the same persistence.xml settings for both
unit tests and deployments, but with different Spring config files to
access different DataSources. (I'm assuming that if I try to use
multiple persistence.xml files for different environments, this could
pose a problem for Dali.)

Since everything works fine via Eclipse WTP, I assumed that I could have
Spring control these settings when deploying an EAR, but that didn't
work (will do more tests as you mentioned). Adding the target-database
property to persistence.xml will constrain me more, but if I have no
other choice, I'll do it.

Thanks for the info on the globally defined datasource config, but I'd
prefer to avoid more configuration like that, if possible.

Bottom line: is it possible to do any of this configuration via Spring?

Best regards,
Ari


Michael OBrien wrote:
> Ari,
> Hi, that error usually means that EclipseLink is not receiving
> connections from your JTA datasource. This could mean the database is
> down, the datasource has a different JNDI name, or the globally or
> application defined datasource is not setup.
> Q) Behavior when transation-type is ommitted?
> A) Yes, When you run in an EE environment - the persistence unit
> transaction-type defaults to "JTA", when it is run as SE - the
> transaction-type defaults to RESOURCE_LOCAL
> From your persistence.xml it looks like you are setup for non-JTA
> RESOURCE_LOCAL, try adding the target-database property.
> When you run in JTA mode, are you running the datasource as a globally
> defined datasource or an application managed datasource?
> If you are running as an application managed datasource, make sure you
> have the config set in a *-jdbc.xml configuration file and that this
> file is referenced in weblogic-application.xml on the EAR. Note: For
> now you will also need to specify the specification JTA properties as
> well as the jta-data-source element...
> <property name="javax.persistence.jtaDataSource"
> value="java:app/jdbc/appScopedLocalJTA"/>
> <property name="javax.persistence.nonJtaDataSource"
> value="java:app/jdbc/appScopedLocalJTA"/>
>
> See:
> http://wiki.eclipse.org/EclipseLink/Examples/JPA/WLS_AppScop ed_DataSource
>
>
> As to why a manual EAR deployment does not work but Eclipe WTP is
> working? The latest ORacle WebLogic 10.3 plugin runs the same ant
> scripts that the server does so the runtime environment should be the
> same. However packaging an EAR with Maven or the Eclipse IDE packager
> may be different. I would verify that the datasource is working outside
> of the EAR (so we are not seeing a jdbc jar issue) - as you must have
> had to add the jdbc jar to your path/manifest when running as
> RESOURCE_LOCAL.
>
>
> hope this helps to start.
> thank you
> /michael
>
>
Previous Topic:most optimal wy to persisted list?
Next Topic:Re: JPA/EclipseLink 1.0.2 J2SE Project: emf.createEntityManager() truncates tables
Goto Forum:
  


Current Time: Tue Jul 29 06:51:34 EDT 2014

Powered by FUDForum. Page generated in 0.02870 seconds