aspose file tools*
The moose likes JBoss/WildFly and the fly likes Multiple version of application's ear on same JBoss AS 6.0.1 all point to same datasource. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Multiple version of application Watch "Multiple version of application New topic
Author

Multiple version of application's ear on same JBoss AS 6.0.1 all point to same datasource.

Francois-Xavier Seheut de Ronchi
Greenhorn

Joined: Nov 04, 2013
Posts: 2
Hi everyone,

First of all thank you very much, this forum helped me more than once.

So my problem is this one :

A little presentation of what I have :



In JBoss 6.0.1/server/default/ :

I have two applications which are two versions of the same application : version A and version B.
I want them to work on their own (different databases - which is my problem now).

application.vA.ear

persistence.xml :

<persistence-unit name="appA">

<provider>org.hibernate.ejb.HibernatePersistence</provider>

<jta-data-source>java:/appVADatasource</jta-data-source>

...

<properties>

<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />

<property name="hibernate.hbm2ddl.auto" value="validate" />

<property name="hibernate.show_sql" value="false" />

<property name="hibernate.format_sql" value="true" />

<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />



<property name="hibernate.query.factory_class" value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory" />

<property name="jboss.entity.manager.factory.jndi.name" value="java:/viewerEntityManagerFactory" />

<!-- Enable Hibernate Search In Memory Configuration: use a file system based index -->

<property name="hibernate.search.default.directory_provider" value="com.blabla.wp6.viewer.search.directory.StandaloneDirectoryProvider" />

<property name="hibernate.search.indexing_strategy" value="manual" />

</properties>

</persistence-unit>
application.vA-ds.xml
<datasources>

<local-tx-datasource>

<jndi-name>appVBDatasource</jndi-name>

<use-java-context>true</use-java-context>

<connection-url>jdbc:mysql://localhost:3306/appA</connection-url>

<driver-class>org.mysqldb.jdbcDriver</driver-class>

<user-name>root</user-name>

<password></password>

</local-tx-datasource>

</datasources>


application.vB.ear

persistence.xml :

<persistence-unit name="appB">

<provider>org.hibernate.ejb.HibernatePersistence</provider>

<jta-data-source>java:/appVBDatasource</jta-data-source>

...

<properties>

<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />

<property name="hibernate.hbm2ddl.auto" value="validate" />

<property name="hibernate.show_sql" value="false" />

<property name="hibernate.format_sql" value="true" />

<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />

<property name="hibernate.query.factory_class" value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory" />

<property name="jboss.entity.manager.factory.jndi.name" value="java:/viewerEntityManagerFactory" />

<!-- Enable Hibernate Search In Memory Configuration: use a file system based index -->

<property name="hibernate.search.default.directory_provider" value="com.blabla.wp6.viewer.search.directory.StandaloneDirectoryProvider" />

<property name="hibernate.search.indexing_strategy" value="manual" />

</properties>

</persistence-unit>
application.vB-ds.xml

<datasources>

<local-tx-datasource>

<jndi-name>appVBDatasource</jndi-name>

<use-java-context>true</use-java-context>

<connection-url>jdbc:mysql://localhost:3306/appA</connection-url>

<driver-class>org.mysqldb.jdbcDriver</driver-class>

<user-name>root</user-name>

<password></password>

</local-tx-datasource>

</datasources>




When I start the server, I see that the two persistence unit are binded to the GLOBAL jndi.

But when the server is started and I connect to both applications, both applications use the same datasource.



So I'm wondering what am I missing to tell application A to use Datasource A and application B to use datasource B.



Any help would be greatly appreciated.



Thanks in advance.

See below the link to the same issue on JBoss forum.

https://community.jboss.org/message/843903#843903
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

I'm marking this as resolved based on the discussion in the other forum https://community.jboss.org/message/844295#844295


[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple version of application's ear on same JBoss AS 6.0.1 all point to same datasource.
 
Similar Threads
JTA EntityManager cannot access a transactions
Entity not mapped!
JNDI error message
@Resource injection not working for DataSource
JBOSS 7.1.1 - Missing servicesManager_EM