0 Replies Latest reply on Mar 27, 2007 3:56 AM by Nikolay Zhivoglotov

    multiple persistence unit in one persistence.xml

    Nikolay Zhivoglotov Newbie

      Can I use two and more datasource in one persistence.xml?

      When I use one persistence-unit tag in persistence.xml, it's work.
      When I added second persistence-unit tag in persistence.xml I received next error message

      2007-03-26 16:18:24,646 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
      org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: ?????????? ?????/??????: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153093120)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4)))))
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:179)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:565)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:250)
      at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:491)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)
      at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:301)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
      at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
      at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
      at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1216)
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:688)
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
      at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:102)
      .......


      My persistence.xml :
      <?xml version="1.0" encoding="UTF-8"?>
      <persistence>
       <persistence-unit name="clrProd" transaction-type="JTA">
       <jta-data-source>java:/jdbc/ClrProdDS</jta-data-source>
       <properties>
       <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
       </properties>
       </persistence-unit>
      
       <persistence-unit name="clrArch">
       <jta-data-source>java:/jdbc/ClrArchDS</jta-data-source>
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <properties>
       <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
       </properties>
       </persistence-unit>
      </persistence>