Connection need to be done in xa-datasource with AS400 driver
gayrat.komilov Jun 14, 2013 1:45 AMI have prepared standalone.xml file and I have as400 driver file (jt400.jar ) in c:\jboss-as-7.1.1.Final\modules\com\ibm\as400\main\
I have tried Datasource connection and XA-datasource connection,
There is no problem datasource connection with as400 driver.
this is standalone.xml file
<datasources>
<datasource jta="false" jndi-name="java:/jdbc/as400" pool-name="as400" enabled="true" use-ccm="false">
<connection-url>jdbc:as400://122.212.243.75/mgolib;naming=sql;errors=full</connection-url>
<driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>
<driver>as400</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<xa-datasource jndi-name="java:/jdbc/as400XA" pool-name="as400xa-pool" enabled="true" use-ccm="false">
<xa-datasource-property name="URL">
jdbc:as400://122.212.243.75/mgolib;naming=sql;errors=full
</xa-datasource-property>
<driver>as400XA</driver>
<xa-pool>
<is-same-rm-override>false</is-same-rm-override>
<interleaving>false</interleaving>
<pad-xid>false</pad-xid>
<wrap-xa-resource>false</wrap-xa-resource>
</xa-pool>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</xa-datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="as400" module="com.ibm.as400">
<xa-datasource-class>com.ibm.as400.access.AS400JDBCDriver</xa-datasource-class>
</driver>
<driver name="as400XA" module="com.ibm.as400">
<xa-datasource-class>com.ibm.as400.access.AS400JDBCXADataSource</xa-datasource-class>
</driver>
<driver name="ora" module="com.oracle.ojdbc6">
<xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class>
</driver>
</drivers>
</datasources>
when I try to test connection in XA datasource this error displays
Please help me to solve this issue.
Unknown error
Unexpected HTTP response: 500
Request
{
"address" => [
("subsystem" => "datasources"),
("xa-data-source" => "as400xa-pool")
],
"operation" => "test-connection-in-pool"
}
Response
Internal Server Error
{
"outcome" => "failed",
"failure-description" => "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid",
"rolled-back" => true
}
after then in console
18:27:26,927 INFO [org.jboss.as.connector.subsystems.datasources] (ServerServic
e Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Dr
iver (version 1.3)
18:27:26,933 INFO [org.jboss.as.connector] (MSC service thread 1-8) JBAS010408:
Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
18:27:26,949 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBA
S013101: Activating Security Subsystem
18:27:26,952 INFO [org.jboss.as.security] (MSC service thread 1-8) JBAS013100:
Current PicketBox version=4.0.7.Final
18:27:26,956 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48)
JBAS015537: Activating WebServices Extension
18:27:26,958 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011
940: Activating OSGi Subsystem
18:27:26,957 INFO [org.jboss.as.connector.subsystems.datasources] (ServerServic
e Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class com.ibm.a
s400.access.AS400JDBCDriver (version 7.0)
18:27:26,956 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS0
11800: Activating Naming Subsystem
18:27:26,995 INFO [org.jboss.as.connector.subsystems.datasources] (ServerServic
e Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class com.ibm.a
s400.access.AS400JDBCDriver (version 7.0)
18:27:27,024 INFO [org.jboss.as.naming] (MSC service thread 1-1) JBAS011802: St
arting Naming Service
18:27:27,027 INFO [org.jboss.as.mail.extension] (MSC service thread 1-2) JBAS01
5400: Bound mail session [java:jboss/mail/Default]
18:27:27,042 INFO [org.jboss.as.connector.subsystems.datasources] (ServerServic
e Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class oracle.jd
bc.OracleDriver (version 11.2)
18:27:27,179 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC se
rvice thread 1-8) JBoss Web Services - Stack CXF Server 4.0.2.GA
18:27:27,227 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread
1-5) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080
18:27:27,256 INFO [org.jboss.as.remoting] (MSC service thread 1-4) JBAS017100:
Listening on /127.0.0.1:4447
18:27:27,258 INFO [org.jboss.as.remoting] (MSC service thread 1-5) JBAS017100:
Listening on /127.0.0.1:9999
18:27:27,258 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread
1-7) JBAS015012: Started FileSystemDeploymentService for directory C:\jboss-as-7
.1.1.Final\standalone\deployments
18:27:27,398 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service
thread 1-5) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
18:27:27,398 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service
thread 1-3) JBAS010400: Bound data source [java:/jdbc/as400]
18:27:27,398 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service
thread 1-7) JBAS010400: Bound data source [java:/jdbc/as400XA]
18:27:27,411 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBA
S015876: Starting deployment of "App1.ear"
18:27:27,480 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBA
S015876: Starting deployment of "Model.jar"
18:27:27,480 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBA
S015876: Starting deployment of "View.war"
18:27:27,510 INFO [org.jboss.as.jpa] (MSC service thread 1-4) JBAS011401: Read
persistence.xml for Model
18:27:27,567 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeplo
ymentUnitProcessor] (MSC service thread 1-5) JNDI bindings for session bean name
d Facade in deployment unit subdeployment "Model.jar" of deployment "App1.ear" a
re as follows:
java:global/App1/Model/Facade!ru.intf.Model.FacadeLocal
java:app/Model/Facade!ru.intf.Model.FacadeLocal
java:module/Facade!ru.intf.Model.FacadeLocal
java:global/App1/Model/Facade
java:app/Model/Facade
java:module/Facade
18:27:27,591 INFO [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011402: Start
ing Persistence Unit Service 'App1.ear#Model'
18:27:27,674 INFO [org.hibernate.annotations.common.Version] (MSC service threa
d 1-3) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
18:27:27,678 INFO [org.hibernate.Version] (MSC service thread 1-3) HHH000412: H
ibernate Core {4.0.1.Final}
18:27:27,679 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-3) HHH0
00206: hibernate.properties not found
18:27:27,681 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-3) HHH0
00021: Bytecode provider name : javassist
18:27:27,768 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-3
) HHH000204: Processing PersistenceUnitInfo [
name: Model
...]
18:27:27,776 INFO [org.jboss.web] (MSC service thread 1-4) JBAS018210: Register
ing web context: /View
18:27:27,808 INFO [org.hibernate.service.jdbc.connections.internal.ConnectionPr
oviderInitiator] (MSC service thread 1-3) HHH000130: Instantiating explicit conn
ection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvid
er
18:27:27,846 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool]
(MSC service thread 1-3) IJ000604: Throwable while attempting to get a new conne
ction: null: javax.resource.ResourceException: Could not create connection
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManage
dConnection(XAManagedConnectionFactory.java:447)
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.createManag
edConnection(XAManagedConnectionFactory.java:385)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManag
edConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnecti
onPool.java:761)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManag
edConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConne
ction(AbstractPool.java:397)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(
AbstractPool.java:365)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getMan
agedConnection(AbstractConnectionManager.java:329)
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getMa
nagedConnection(TxConnectionManagerImpl.java:368)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.alloca
teConnection(AbstractConnectionManager.java:464)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDa
taSource.java:129)
at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.get
Connection(InjectedDataSourceConnectionProvider.java:67) [hibernate-entitymanage
r-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProvide
rJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:253) [hibernate-cor
e-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcSer
vicesImpl.java:119) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureS
ervice(StandardServiceRegistryImpl.java:75) [hibernate-core-4.0.1.Final.jar:4.0.
1.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initialize
Service(AbstractServiceRegistryImpl.java:159) [hibernate-core-4.0.1.Final.jar:4.
0.1.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService
(AbstractServiceRegistryImpl.java:131) [hibernate-core-4.0.1.Final.jar:4.0.1.Fin
al]
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:
71) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.j
ava:2270) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2266
) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1735) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactor
yImpl.java:84) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
figuration.java:904) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
figuration.java:889) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFa
ctory(HibernatePersistence.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0
.1.Final]
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEn
tityManagerFactory(PersistenceUnitServiceImpl.java:162) [jboss-as-jpa-7.1.1.Fina
l.jar:7.1.1.Final]
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(Persistence
UnitServiceImpl.java:85) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
rviceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
rollerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt
.jar:1.7.0_10]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [r
t.jar:1.7.0_10]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_10]
Caused by: javax.resource.ResourceException: Could not find accessor on XADataSo
urce:
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXADataSo
urce(XAManagedConnectionFactory.java:629)
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManage
dConnection(XAManagedConnectionFactory.java:430)
... 30 more
Caused by: java.lang.NoSuchMethodException: com.ibm.as400.access.AS400JDBCXAData
Source.setURL(java.lang.String)
at java.lang.Class.getMethod(Unknown Source) [rt.jar:1.7.0_10]
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXADataSo
urce(XAManagedConnectionFactory.java:597)
... 31 more
18:27:27,945 WARN [org.hibernate.engine.jdbc.internal.JdbcServicesImpl] (MSC se
rvice thread 1-3) HHH000342: Could not obtain connection to query metadata : jav
ax.resource.ResourceException: IJ000453: Unable to get managed connection for ja
va:/jdbc/as400XA
18:27:27,956 INFO [org.hibernate.dialect.Dialect] (MSC service thread 1-3) HHH0
00400: Using dialect: org.hibernate.dialect.DB2400Dialect
18:27:27,968 INFO [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (MSC s
ervice thread 1-3) HHH000422: Disabling contextual LOB creation as connection wa
s null
18:27:27,978 INFO [org.hibernate.engine.transaction.internal.TransactionFactory
Initiator] (MSC service thread 1-3) HHH000268: Transaction strategy: org.hiberna
te.engine.transaction.internal.jta.CMTTransactionFactory
18:27:27,985 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (M
SC service thread 1-3) HHH000397: Using ASTQueryTranslatorFactory
18:27:28,083 INFO [org.jboss.as] (MSC service thread 1-8) JBAS015951: Admin con
sole listening on http://127.0.0.1:9990
18:27:28,084 INFO [org.jboss.as] (MSC service thread 1-8) JBAS015874: JBoss AS
7.1.1.Final "Brontes" started in 2079ms - Started 236 of 322 services (82 servic
es are passive or on-demand)
18:27:28,111 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018
559: Deployed "App1.ear"
18:27:36,219 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool]
(HttpManagementService-threads - 1) IJ000604: Throwable while attempting to get
a new connection: null: javax.resource.ResourceException: Could not create conne
ction
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManage
dConnection(XAManagedConnectionFactory.java:447) [ironjacamar-jdbc-1.0.9.Final.j
ar:1.0.9.Final]
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.createManag
edConnection(XAManagedConnectionFactory.java:385) [ironjacamar-jdbc-1.0.9.Final.
jar:1.0.9.Final]
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManag
edConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnecti
onPool.java:761) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManag
edConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)
[ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConne
ction(AbstractPool.java:397) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(
AbstractPool.java:365) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.internalTestCo
nnection(AbstractPool.java:627) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Fin
al]
at org.jboss.jca.core.connectionmanager.pool.strategy.OnePool.testConnec
tion(OnePool.java:88) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]
at org.jboss.as.connector.pool.PoolOperations$TestConnectionInPool.invok
eCommandOn(PoolOperations.java:121) [jboss-as-connector-7.1.1.Final.jar:7.1.1.Fi
nal]
at org.jboss.as.connector.pool.PoolOperations$1.execute(PoolOperations.j
ava:60) [jboss-as-connector-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.executeStep(Abstract
OperationContext.java:385) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(Abstr
actOperationContext.java:272) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.completeStep(Abstrac
tOperationContext.java:200) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.connector.pool.PoolOperations.execute(PoolOperations.jav
a:74) [jboss-as-connector-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.executeStep(Abstract
OperationContext.java:385) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(Abstr
actOperationContext.java:272) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.completeStep(Abstrac
tOperationContext.java:200) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.ModelControllerImpl$DefaultPrepareStepHandler
.execute(ModelControllerImpl.java:466) [jboss-as-controller-7.1.1.Final.jar:7.1.
1.Final]
at org.jboss.as.controller.AbstractOperationContext.executeStep(Abstract
OperationContext.java:385) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(Abstr
actOperationContext.java:272) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.completeStep(Abstrac
tOperationContext.java:200) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerIm
pl.java:121) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.ModelControllerImpl$1.execute(ModelController
Impl.java:309) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.ModelControllerImpl$1.execute(ModelController
Impl.java:299) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.domain.http.server.DomainApiHandler.processRequest(Domai
nApiHandler.java:294)
at org.jboss.as.domain.http.server.DomainApiHandler.doHandle(DomainApiHa
ndler.java:201)
at org.jboss.as.domain.http.server.DomainApiHandler.handle(DomainApiHand
ler.java:208)
at org.jboss.as.domain.http.server.security.SubjectAssociationHandler.ha
ndle(SubjectAssociationHandler.java:51)
at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:78
)
at org.jboss.sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:69)
at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:81
)
at org.jboss.sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(S
erverImpl.java:710)
at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:78
)
at org.jboss.as.domain.http.server.RealmReadinessFilter.doFilter(RealmRe
adinessFilter.java:54)
at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:81
)
at org.jboss.sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:
682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt
.jar:1.7.0_10]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [r
t.jar:1.7.0_10]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_10]
at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-thread
s-2.0.0.GA.jar:2.0.0.GA]
Caused by: java.sql.SQLException: The application requester cannot establish the
connection. (Connection refused: connect)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:528)
at com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConne
ction.java:2826)
at com.ibm.as400.access.AS400JDBCDataSource.getConnection(AS400JDBCDataS
ource.java:589)
at com.ibm.as400.access.AS400JDBCDataSource.getConnection(AS400JDBCDataS
ource.java:562)
at com.ibm.as400.access.AS400JDBCXADataSource.getXAConnection(AS400JDBCX
ADataSource.java:145)
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManage
dConnection(XAManagedConnectionFactory.java:430) [ironjacamar-jdbc-1.0.9.Final.j
ar:1.0.9.Final]
... 39 more