我正在使用comporsys JCA连接器从Java连接到大型机环境. Java应用程序部署在JBOSS中.以这种方式配置的连接器:
<connection-factories>
<no-tx-connection-factory>
<jndi-name>ComporsysIMSConnector</jndi-name>
<rar-name>ims_connector_port4027_CreditAuth.rar</rar-name>
<connection-definition>de.comporsys.connector.ims.ConnectionFactory</connection-definition>
<min-pool-size>1</min-pool-size>
<max-pool-size>15</max-pool-size>
<shrinking-enabled>true</shrinking-enabled>
<shrink-period-minutes>2</shrink-period-minutes>
<logging-enabled>true</logging-enabled>
<!-- <log-filename>/opt/jboss/xxxx/logs/ims_connector.log</log-filename> -->
<log-filename>D:\ims_connector.log</log-filename>
</no-tx-connection-factory>
</connection-factories>
通信一定不能100%正确,因为我在日志中看到很多错误,如下所示:
[2010-12-16 05:21:10,061] WARN (org.jboss.resource.connectionmanager.NoTxConnectionManager:738) - Pearl 1,DE82000,CGN,D5 ,10450565,768209411 - Connection error occured: org.jboss.resource.connectionmanager.NoTxConnectionManager$NoTxConnectionEventListener@3dcbef2a[state=NORMAL mc=de.comporsys.connector.ims.ManagedConnectionImpl@4743f21b handles=1 lastUse=1292++++++++++++ permit=true trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@7afdd15b context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@2dbbec72]
de.comporsys.connector.ims.imstoc.ImstocException: IMS Connect-Error: Return=40, Reason=59
at de.comporsys.connector.ims.imstoc.Connection.execute(Connection.java:261)
at de.comporsys.connector.ims.imstoc.IMSTOCWorkunit.execute(IMSTOCWorkunit.java:261)
at de.comporsys.connector.ims.imstoc.IMSTOCWorkunit.resumeTPipe(IMSTOCWorkunit.java:167)
at de.comporsys.connector.ims.imstoc.IMSTOCWorkunit.execute(IMSTOCWorkunit.java:98)
at de.comporsys.connector.AbstractStatement.executeRequest(AbstractStatement.java:45)
at de.comporsys.connector.ims.Statement.execute(Statement.java:101)
at com.xxx.ims.access.GenericImsTransaction.executeUCIAysnc(GenericImsTransaction.java:340)
at com.xxx.ims.access.GenericImsTransaction.executeUCI(GenericImsTransaction.java:127)
at com.xxx.ims.access.GenericImsTransaction.execute(GenericImsTransaction.java:60)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:50)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleRepromptWithEnter(UpdateCheckinIMF.java:280)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:208)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleOverPaymentResponse(UpdateCheckinIMF.java:367)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:219)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleRepromptWithEnter(UpdateCheckinIMF.java:280)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:208)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:121)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:22)
at com.xxx.core.rental.VehicleCheckinBC.executeUpdateCheckInWizardTransaction(VehicleCheckinBC.java:541)
at com.xxx.core.rental.VehicleCheckinBC.executeVehicleCheckin(VehicleCheckinBC.java:315)
at com.xxx.merlin.vehiclecheckin.VehicleCheckinMH.processMessage(VehicleCheckinMH.java:112)
at com.xxx.merlin.servlet.util.HttpRequestHandler.handleMessage(HttpRequestHandler.java:150)
at com.xxx.merlin.servlet.util.HttpRequestHandler.processRequest(HttpRequestHandler.java:88)
at com.xxx.merlin.servlet.MerlinServlet.doPost(MerlinServlet.java:22)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.xxx.scope.ServletRequestScopeFilter.doFilter(ServletRequestScopeFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
[2010-12-16 05:21:10,155] WARN (com.xxx.ims.access.GenericImsTransaction:82) - Pearl 1,DE82000,CGN,D5 ,10450565,768209411 - pac71068: ResourceException caught upon IMF execute. IMF body was:/MSKY\/RAN768209411\/MVA10450565\/DOM23021\/DOGY/G8\/COLN\/AGT82000\/OWM\/FLO\/MOPCV\/DLAY\/DOLCGN\/DOD16Dec10/0600\/TAM39058\/ACTA\/RPIY\/ENT\/AUT\/PRTN\@
javax.resource.spi.ResourceAdapterInternalException: de.comporsys.connector.NoActiveTransactionException: connection is not in transaction: de.comporsys.connector.ims.ManagedConnectionImpl@4743f21b
at de.comporsys.connector.AbstractManagedConnection.getActiveTransaction(AbstractManagedConnection.java:216)
at de.comporsys.connector.AbstractStatement.executeRequest(AbstractStatement.java:53)
at de.comporsys.connector.ims.Statement.execute(Statement.java:101)
at com.xxx.ims.access.GenericImsTransaction.executeUCIAysnc(GenericImsTransaction.java:340)
at com.xxx.ims.access.GenericImsTransaction.executeUCI(GenericImsTransaction.java:127)
at com.xxx.ims.access.GenericImsTransaction.execute(GenericImsTransaction.java:60)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:50)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleRepromptWithEnter(UpdateCheckinIMF.java:280)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:208)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleOverPaymentResponse(UpdateCheckinIMF.java:367)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:219)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleRepromptWithEnter(UpdateCheckinIMF.java:280)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:208)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:121)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:22)
at com.xxx.core.rental.VehicleCheckinBC.executeUpdateCheckInWizardTransaction(VehicleCheckinBC.java:541)
at com.xxx.core.rental.VehicleCheckinBC.executeVehicleCheckin(VehicleCheckinBC.java:315)
at com.xxx.merlin.vehiclecheckin.VehicleCheckinMH.processMessage(VehicleCheckinMH.java:112)
at com.xxx.merlin.servlet.util.HttpRequestHandler.handleMessage(HttpRequestHandler.java:150)
at com.xxx.merlin.servlet.util.HttpRequestHandler.processRequest(HttpRequestHandler.java:88)
at com.xxx.merlin.servlet.MerlinServlet.doPost(MerlinServlet.java:22)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.xxx.scope.ServletRequestScopeFilter.doFilter(ServletRequestScopeFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
at de.comporsys.connector.ExceptionHandler.handle(ExceptionHandler.java:46)
at de.comporsys.connector.AbstractStatement.executeRequest(AbstractStatement.java:55)
at de.comporsys.connector.ims.Statement.execute(Statement.java:101)
at com.xxx.ims.access.GenericImsTransaction.executeUCIAysnc(GenericImsTransaction.java:340)
at com.xxx.ims.access.GenericImsTransaction.executeUCI(GenericImsTransaction.java:127)
at com.xxx.ims.access.GenericImsTransaction.execute(GenericImsTransaction.java:60)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:50)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleRepromptWithEnter(UpdateCheckinIMF.java:280)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:208)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleOverPaymentResponse(UpdateCheckinIMF.java:367)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:219)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleRepromptWithEnter(UpdateCheckinIMF.java:280)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:208)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:121)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:22)
at com.xxx.core.rental.VehicleCheckinBC.executeUpdateCheckInWizardTransaction(VehicleCheckinBC.java:541)
at com.xxx.core.rental.VehicleCheckinBC.executeVehicleCheckin(VehicleCheckinBC.java:315)
at com.xxx.merlin.vehiclecheckin.VehicleCheckinMH.processMessage(VehicleCheckinMH.java:112)
at com.xxx.merlin.servlet.util.HttpRequestHandler.handleMessage(HttpRequestHandler.java:150)
at com.xxx.merlin.servlet.util.HttpRequestHandler.processRequest(HttpRequestHandler.java:88)
at com.xxx.merlin.servlet.MerlinServlet.doPost(MerlinServlet.java:22)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.xxx.scope.ServletRequestScopeFilter.doFilter(ServletRequestScopeFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: de.comporsys.connector.NoActiveTransactionException: connection is not in transaction: de.comporsys.connector.ims.ManagedConnectionImpl@4743f21b
at de.comporsys.connector.AbstractManagedConnection.getActiveTransaction(AbstractManagedConnection.java:216)
at de.comporsys.connector.AbstractStatement.executeRequest(AbstractStatement.java:53)
... 52 more
不幸的是,我没有任何信息,这是什么意思,因为composys不再支持它.
你知道为什么会这样吗?
有一个IMSConnectionFactory初始化comporsys的东西
public static ConnectionFactory getIMSConnectionFactory() {
InitialContext context;
ConnectionFactory imsConnectionFactory = null;
try {
// Create a Properties Object and set the JNDI properties
Properties jndiProperties = new Properties();
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, WizardContext.getInstance().getWizardProperties().getJndiClass());
// Try obtaining a JNDI context so that the application server can be queried
context = new InitialContext(jndiProperties);
// Request the Connection Factory from the application server using a JNDI context lookup
imsConnectionFactory = (ConnectionFactory) context.lookup(WizardContext.getInstance().getWizardProperties().getConnectionJndi());
事务处理可能在m_IMSStatementSync.execute中,但由于是第三方内容,因此是一个黑匣子. IMSConnector在JBOSS中注册,我们在servlet中对其进行访问.事务处理程序的详细信息:
for(int尝试= 1顽强;尝试> 0;){
尝试{
// Slightly nervous re. the location of this block.
// It looks like it should be above, where it is now commented out,
// but moving it there coincided with failures.
// This may well have just been a coincidence - but it all happened at cutover time,
// so for the sake of safety I've put it back here for now.
m_IMSStatementSync = m_IMSConnection.createStatement(); /* This created by the connection factory */
m_IMSRequest = m_IMSStatementSync.createRequest();
m_IMSRequest.setTimeout(m_WizardConfiguration.getWizardTimeOut());
m_IMSRequest.setTransaction(p_Input.get_TransactionCode());
m_IMSRequest.setCommArea(p_Input);
m_IMSRequest.setLterm(p_Input.get_TSR().get_ID());
m_IMSRequest.setTimer((byte) WizardOperationConstants.IMS_CONNECT_SYNC_TIMEOUT);
// end of block
// Execute the IMS transaction
m_IMSReply = m_IMSStatementSync.execute(m_IMSRequest); /*pac7102*/
attempts = 0;
}
catch (NoActiveTransactionException e) {
if (--attempts < 1) {
tenaciousness >>= 1;
throw (e);
}
try {
wait(rnd());
}
catch (InterruptedException f) { ... }
}
解决方法:
从堆栈跟踪中可以很明显地看出警告的原因:
de.comporsys.connector.NoActiveTransactionException: connection is not in transaction
….但您肯定要弄清楚该接口是否确实有效.无论如何,警告该连接不在事务中是因为您已将JCA池定义为非事务池.为了切换到事务池,它应该看起来像这样:
<connection-factories>
<tx-connection-factory>
<jndi-name>ComporsysIMSConnector</jndi-name>
<rar-name>ims_connector_port4027_CreditAuth.rar</rar-name>
<connection-definition>de.comporsys.connector.ims.ConnectionFactory</connection-definition>
<min-pool-size>1</min-pool-size>
<max-pool-size>15</max-pool-size>
<shrinking-enabled>true</shrinking-enabled>
<shrink-period-minutes>2</shrink-period-minutes>
<logging-enabled>true</logging-enabled>
<!-- <log-filename>/opt/jboss/xxxx/logs/ims_connector.log</log-filename> -->
<log-filename>D:\ims_connector.log</log-filename>
</tx-connection-factory>
</connection-factories>
我认为这是受支持的,因为警告消息表明它期望连接处于事务处理中,这就是tx-connection-factory会执行的操作.
我会旋转一下,看看会发生什么.