1 2 Previous Next 23 Replies Latest reply on Oct 13, 2007 1:34 PM by vickyk

    database failover for ejb application (persistance.xml probl

      hi all,
      i tried to use database failover by ha-xa-datasource.
      my database configuration file looks like :
      1.oracle-ha-xa-ds.xml

      <datasources>
       <ha-xa-datasource>
       <jndi-name>XAOracleDS</jndi-name>
       <track-connection-by-tx/>
       <isSameRM-override-value>false</isSameRM-override-value>
       <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
       <!-- list of connection URLs -->
       <xa-datasource-property name="URL">jdbc:oracle:thin:@192.168.9.135:1521:DEVSTR|jdbc:oracle:thin:@192.9.200.222:1521:DEVSTR</xa-da
       <xa-datasource-property name="User">USER_MANAGER</xa-datasource-property>
       <xa-datasource-property name="Password">USER_MANAGER</xa-datasource-property>
       <url-property>URL</url-property>
       <url-delimeter>|</url-delimeter>
       <valid-connection-checker-class-name>tempPackage.OracleValidConnectionChecker</valid-connection-checker-class-name>
       <exception-sorter-class-name>tempPackage.OracleExceptionSorter</exception-sorter-class-name>
       </ha-xa-datasource>
      </datasources>
      


      bu ti can't use this configuration into my ejb application,
      is there any doc or example how to config my persistance.xml in this case ????
      my persistance.xml looks like :
      2.persistance.xml
      <?xml version="1.0" encoding="ISO-8859-1" ?>
      <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="Test">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <non-jta-data-source>java:/XAOracleDS</non-jta-data-source>
       <properties>
       <property name="hibernate.hbm2ddl.auto" value="validate"/>
       <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
       <property name="hibernate.default_schema" value="USER_MANAGER"/>
       </properties>
       </persistence-unit>
      </persistence>
      

      i tried to use jta-data-source instead of non-jta-data-source but i got the errors :
      1.non-jta-datasource:

      java.lang.RuntimeException: You have not defined a jta-data-source for a JTA enabled persistence context named: Test
       at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:220)
       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:597)
       at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
       at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      

      2. jta-datasource:
      09:20:28,571 WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
      org.jboss.resource.JBossResourceException: Missing configuration for HA XA datasource. No url-delimiter.
       at org.jboss.resource.adapter.jdbc.xa.HAXAManagedConnectionFactory.createManagedConnection(HAXAManagedConnectionFactory.java:97)
       at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:577)
       at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:262)
      
      



      i fount documentations how to write database failover configuration file but i can't find anything about persistance.xml :( how i can use it into my ejb application ?

      any idea will be appreciated.


      Thanks In Advance.
      _________________
      Paata,




        1 2 Previous Next