Hello,
i have a Seam app for Seam 1.2.1 and JBoss 4.0.5 GA which uses 2 persistent uinits. After
migrating this app to SEAM 2.0.0Beta1 and JBoss 4.2.0GA i get an exception when both
persistance units are used.
I tried to declare both persistenceunits within one jar-file:
<?xml version="1.0" encoding="UTF-8"?>
|
| <!-- Persistence deployment descriptor for dev profile -->
| <persistence
xmlns="http://java.sun.com/xml/ns/persistence"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
|
|
|
| <persistence-unit name="aveqtest">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/aveqtestDatasource</jta-data-source>
| <class>de.bafz.aveqtest.model.AccessionEvaluation</class>
|
| <class>de.bafz.aveqtest.model.AddresscodechangeClient</class>
|
| [...] <exclude-unlisted-classes />
|
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="validate"
/>
| <property name="hibernate.cache.use_query_cache"
value="true" />
| <property name="hibernate.show_sql" value="true" />
| <property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLInnoDBDialect"/>
|
| <property name="jboss.entity.manager.jndi.name"
value="java:/entityManager" />
|
| <property name="jboss.entity.manager.factory.jndi.name"
value="java:/aveqtestEntityManagerFactory" />
|
| </properties>
| </persistence-unit>
|
| <persistence-unit name="oracleDB">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/oracleDatasource</jta-data-source>
| <class>de.bafz.aveqtest.model.oracle.Address</class>
| [...] <exclude-unlisted-classes />
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="validate"
/>
| <property name="hibernate.cache.use_query_cache"
| value="true" />
| <property name="hibernate.show_sql" value="true" />
| <property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle9Dialect"/>
| <property name="jboss.entity.manager.jndi.name"
| value="java:/oracleEntityManager" />
| <property name="jboss.entity.manager.factory.jndi.name"
| value="java:/oracleEntityManagerFactory" />
| </properties>
| </persistence-unit>
| </persistence>
|
The experiment comes from one database and after that a query to the other db should be
executed, but raises this exception. 16:17:17,890 INFO [STDOUT] Hibernate: select
experiment0_.ExperimentID as Experime1_76_, experiment
| 0_.Size as Size76_, experiment0_.SowingYear as SowingYear76_, experiment0_.Description
as Descript4_
| 76_, experiment0_.HarvestYear as HarvestY5_76_, experiment0_.SowingDate as
SowingDate76_, experiment
| 0_.AddressCode as AddressC7_76_, experiment0_.AddressFAOCode as AddressF8_76_,
experiment0_.PartnerC
| ode as PartnerC9_76_, experiment0_.ProjectCode as Project10_76_,
experiment0_.ExperimentCode as Expe
| rim11_76_, experiment0_.ExperimentName as Experim12_76_, experiment0_.SiteID as
SiteID76_, experimen
| t0_.HarvestDate as Harvest14_76_, experiment0_.Design as Design76_,
experiment0_.Samples as Samples7
| 6_, experiment0_.Replications as Replica17_76_ from EXPERIMENT experiment0_ limit ?
| 16:17:17,984 WARN [loggerI18N]
[com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.dis
| allow] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow]
Adding multiple la
| st resources is disallowed. Current resource is
org.jboss.resource.connectionmanager.TxConnectionMan
| ager$LocalXAResource@1340091
| 16:17:18,000 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
| 16:17:18,000 ERROR [JDBCExceptionReporter] Could not enlist in transaction on entering
meta-aware ob
| ject!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable:
Unabled to enlis
| t resource, see the previous warnings. tx=TransactionImple < ac, BasicAction:
-53e0d9e7:77e:469b7d96:41 status: ActionStatus.ABORT_ONLY >); - nested throwable:
(org.jboss.resource.JBossResourceException: Could not enlist in transaction o
| n entering meta-aware object!; - nested throwable: (javax.transaction.SystemException:
java.lang.Thr
| owable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple
< ac, BasicAction: -53e0d9e7:77e:469b7d96:41 status: ActionStatus.ABORT_ONLY >))
| 16:17:18,000 FATAL [application] javax.persistence.PersistenceException:
org.hibernate.exception.Gen
| ericJDBCException: Cannot open connection
| javax.faces.el.EvaluationException: javax.persistence.PersistenceException:
org.hibernate.exception.
| GenericJDBCException: Cannot open connection
| at
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionA
| dapter.java:91)
| at
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
| at javax.faces.component.UICommand.broadcast(UICommand.java:383)
|
Both connections are working. I can access each database in isolated state. But not the
two togehter.
It would be fine if someone has an idea what this error means. Any pointer (even it is a
pointer to the right forum to ask: hibernate,EJB3,JCA etc) are welcome.
In the SEAM forum, gavin said to use XA DataSources.Are they really nessecary. My apps
runs with JBoss 4.0.5GA but not with 4.2.0GA.
Here are my Datasources:
<datasources>
|
| <local-tx-datasource>
| <jndi-name>aveqtestDatasource</jndi-name>
| <connection-url>jdbc:mysql://localhost/aveq</connection-url>
| <driver-class>com.mysql.jdbc.Driver</driver-class>
| <user-name>aaaa</user-name>
| <password>pppp</password>
|
| </local-tx-datasource>
|
| <local-tx-datasource>
| <jndi-name>oracleDatasource</jndi-name>
| <connection-url>
| jdbc:oracle:thin:@localhost:xe
| </connection-url>
| <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
| <user-name>eeee</user-name>
| <password>ooooo</password>
| <metadata>
| <type-mapping>Oracle</type-mapping>
| </metadata>
| </local-tx-datasource>
| </datasources>
|
Googling yield only this
link:http://lists.jboss.org/pipermail/jboss-svn-commits/2007-March/006849... and was not
helpful.
If XA DS are the solution, can someone tell me how to define them? It would be great
Ciao,
Carsten
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4064622#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...