How do you set a boolean property in an XA datasource?
apill Feb 6, 2007 5:35 AMI'm using Jboss 5 Beta1.
I have an XA datasource to DB2 on an AS400. I need to set a property on the datasource called translate binary, to the boolean value true.
Previously the <local-tx-datasource> specified this in the connection URL. i.e.
<local-tx-datasource> <connection-url>jdbc:as400://mydbhost.net;translate binary=true;</connection-url> <driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class> <user-name>guest</user-name> <password>guest</password> </local-tx-datasource>
I expect to set this in the XA datasource as follows.
<xa-datasource> <xa-datasource-class>com.ibm.as400.access.AS400JDBCXADataSource</xa-datasource-class> <xa-datasource-property name="User">guest</xa-datasource-property> <xa-datasource-property name="Password">guest</xa-datasource-property> <xa-datasource-property name="ServerName">mydbhost.net</xa-datasource-property> <xa-datasource-property name="TranslateBinary">true</xa-datasource-property> <isSameRM-override-value>false</isSameRM-override-value> <track-connection-by-tx/> <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --> <metadata> <type-mapping>DB2/400</type-mapping> </metadata> </xa-datasource>
When JBoss starts up I get the error...
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: com.ibm.as400.access.AS400JDBCXADataSource.setTranslateBinary(java.lang.String))) at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:162) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:579) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:247) at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:563) at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341) at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:351) at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:394) at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:838) at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:103) at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:44) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2006) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1289) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127) at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:237) 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:589) at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55) at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:108) at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:71) at org.jboss.kernel.plugins.dependency.LifecycleAction.installAction(LifecycleAction.java:147) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.install(KernelControllerContextAction.java:96) at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:709) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:429) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:538) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:472) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:274) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:177) at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:83) at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:77) at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:141) at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:473) at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:324) at org.jboss.ejb3.deployers.EJBStage2Deployer.deploy(EJBStage2Deployer.java:48) at org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer.commitDeploy(AbstractSimpleDeployer.java:52) at org.jboss.deployers.plugins.deployer.DeployerWrapper.commitDeploy(DeployerWrapper.java:145) at org.jboss.deployers.plugins.deployment.MainDeployerImpl.commitDeploy(MainDeployerImpl.java:440) at org.jboss.deployers.plugins.deployment.MainDeployerImpl.process(MainDeployerImpl.java:381) at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:366) at org.jboss.system.server.profileservice.ProfileServiceBootstrap.bootstrap(ProfileServiceBootstrap.java:246) at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:89) at org.jboss.system.server.profileservice.ServerImpl.doStart(ServerImpl.java:401) at org.jboss.system.server.profileservice.ServerImpl.start(ServerImpl.java:340) at org.jboss.Main.boot(Main.java:210) at org.jboss.Main$1.run(Main.java:508) at java.lang.Thread.run(Thread.java:626) Caused by: org.jboss.resource.JBossResourceException: Could not find accessor on XADataSource: ; - nested throwable: (java.lang.NoSuchMethodException: com.ibm.as400.access.AS400JDBCXADataSource.setTranslateBinary(java.lang.String)) at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.getXADataSource(XAManagedConnectionFactory.java:289) at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:154) ... 51 more Caused by: java.lang.NoSuchMethodException: com.ibm.as400.access.AS400JDBCXADataSource.setTranslateBinary(java.lang.String) at java.lang.Class.getMethod(Class.java:1594) at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.getXADataSource(XAManagedConnectionFactory.java:259) ... 52 more 10:29:58,417 WARN [SettingsFactory] Could not obtain connection metadata org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Could not find accessor on XADataSource: ; - nested throwable: (java.lang.NoSuchMethodException: com.ibm.as400.access.AS400JDBCXADataSource.setTranslateBinary(java.lang.String))); - nested throwable: (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: com.ibm.as400.access.AS400JDBCXADataSource.setTranslateBinary(java.lang.String)))) at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:109) at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:44) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2006) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1289) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127) at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:237) 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:589) at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55) at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:108) at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:71) at org.jboss.kernel.plugins.dependency.LifecycleAction.installAction(LifecycleAction.java:147) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.install(KernelControllerContextAction.java:96) at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:709) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:429) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:538) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:472) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:274) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:177) at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:83) at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:77) at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:141) at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:473) at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:324) at org.jboss.ejb3.deployers.EJBStage2Deployer.deploy(EJBStage2Deployer.java:48) at org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer.commitDeploy(AbstractSimpleDeployer.java:52) at org.jboss.deployers.plugins.deployer.DeployerWrapper.commitDeploy(DeployerWrapper.java:145) at org.jboss.deployers.plugins.deployment.MainDeployerImpl.commitDeploy(MainDeployerImpl.java:440) at org.jboss.deployers.plugins.deployment.MainDeployerImpl.process(MainDeployerImpl.java:381) at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:366) at org.jboss.system.server.profileservice.ProfileServiceBootstrap.bootstrap(ProfileServiceBootstrap.java:246) at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:89) at org.jboss.system.server.profileservice.ServerImpl.doStart(ServerImpl.java:401) at org.jboss.system.server.profileservice.ServerImpl.start(ServerImpl.java:340) at org.jboss.Main.boot(Main.java:210) at org.jboss.Main$1.run(Main.java:508) at java.lang.Thread.run(Thread.java:626) Caused by: 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: com.ibm.as400.access.AS400JDBCXADataSource.setTranslateBinary(java.lang.String))) at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:162) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:579) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:247) at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:563) at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341) at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:351) at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:394) at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:838) at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:103) ... 43 more Caused by: org.jboss.resource.JBossResourceException: Could not find accessor on XADataSource: ; - nested throwable: (java.lang.NoSuchMethodException: com.ibm.as400.access.AS400JDBCXADataSource.setTranslateBinary(java.lang.String)) at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.getXADataSource(XAManagedConnectionFactory.java:289) at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:154) ... 51 more Caused by: java.lang.NoSuchMethodException: com.ibm.as400.access.AS400JDBCXADataSource.setTranslateBinary(java.lang.String) at java.lang.Class.getMethod(Class.java:1594) at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.getXADataSource(XAManagedConnectionFactory.java:259) ... 52 more
It looks as though the xa-datasource-property tag is treating the text "true" as a string and not a boolean since it is looking for the method
setTranslateBinary(String translate)
instead of
setTranslateBinary(boolean translate)
Is there anyway to set this property as a boolean as otherwise I cannot use the database from JBoss with XA?
Thanks for your help.
Adrian