0 Replies Latest reply on Sep 12, 2008 11:21 AM by Ravi kaithwas

    set custom properties to xa data source (deploy/con-ds.xml)

    Ravi kaithwas Newbie

      HI,
      I am trying to add a ldap property to the jboss configuration file this ldap property will be used for setting load balancing in oracle,
      the configuration file is somename-ds.xml and it is used for connecting to oracle database the configuration for xa-datasouce properties. which uses 'oracle.jdbc.xa.client.OracleXADataSource' class to connect to database

      the configuration is file extract is

      <xa-datasource>
      <jndi-name>jdbc/TCRecsDB</jndi-name>
      <use-java-context>false</use-java-context>
      <track-connection-by-tx>true</track-connection-by-tx>
      <isSameRM-override-value>false</isSameRM-override-value>
      <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
      <xa-datasource-property name="URL">jdbc url....</xa-datasource-property>
      <!-- Use the security domain defined in conf/login-config.xml -->
      <security-domain>EncryptDBPassword2</security-domain>
      <xa-datasource-property name="oracle.net.ldap_loadbalance">OFF</xa-datasource-property>
      <exception-sorter-class-name>
      org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
      </exception-sorter-class-name>
      <no-tx-separate-pools/>
      <max-pool-size>100</max-pool-size>
      </xa-datasource>


      the problem is when i start jboss it throws error NoSuchMethodException

      11:25:48,217 WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
      org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Could not find accessor on XADataSource: ; - nested throwable: (java.lang.NoSuchMethodException: oracle.jdbc.xa.client.OracleXADataSource.setoracle.net.ldap_loadbalance(java.lang.String)))
      at
      org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:162)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:539)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:228)
      at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:417)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:324)
      at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:301)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:379)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:812)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
      at com.smartstream.control.common.configuration.dao.EngineHibernateUtil.getProductNameFrom(EngineHibernateUtil.java:127)
      at com.smartstream.control.common.configuration.dao.EngineHibernateUtil.getSqlDialect(EngineHibernateUtil.java:85)
      at com.smartstream.control.common.configuration.dao.EngineHibernateUtil.createHibernateConfigPropertiesEngine(EngineHibernateUtil.java:46)
      at com.smartstream.control.common.configuration.dao.EngineHibernateUtil.(EngineHibernateUtil.java:36)
      at com.smartstream.control.common.configuration.dao.HibernateUtil.createEngineInstance(HibernateUtil.java:72)
      at com.smartstream.control.engine.EngineStartupManager.initialise(EngineStartupManager.java:65)
      at com.smartstream.control.engine.EngineStartupManager.(EngineStartupManager.java:44)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:75)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:579)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:322)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:276)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:312)
      at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:80)
      at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:65)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:75)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:579)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:322)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)



      but I tried it on different maching have the same jboss configuration it worked there but it is not working on this server....

      if it load the ldap_loadbalancing property properly I should get the server.log like this...

      <config-property name='XADataSourceProperties' type='java.lang.String'>URL=jdbc:url....
      User=tcm
      Password=tcm
      oracle.net.ldap_loadbalance=OFF
      </config-property>



      can some one tell me how to set a custom properties for this
      the senario is that while connecting to database the connection properties should be set like this.

      java.util.Properties props = new java.util.Properties();

      props.put("password", userPassword);

      props.put("user", userName);

      props.put("oracle.net.ldap_loadbalance","OFF") ;




      connExternal = DriverManager.getConnection(url, props);



      can some one tell me how to achive this in jboss with xa datasource driver

      Thanks
      Ravi....