我的源代码在WebSphere中运行良好,但是当将其迁移到JBoss服务器时,出现了这样的错误。 使用warfile进行部署,将Oracle用作数据库。 我希望有人能有所启发。
我已经搜索了可能的答案和方案,但是没有运气。 我在conn的这一行出现错误。
conn = setDBConnection();
cstmt = conn.prepareCall(query);
这是示例日志。
10:40:27,576 [Outside DIR] WARN [listener.TxConnectionListener] - IJ000305: Connection error occured: org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@3e447f64[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@7eed4af connection handles=1 lastReturned=1557196808308 lastValidated=1557196802534 lastCheckedOut=1557196827576 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@3ffa012 mcp=SemaphoreConcurrentLinkedQueueManagedConnectionPool@46fd2e09[pool=CRM] xaResource=LocalXAResourceImpl@69d31ab0[connectionListener=3e447f64 connectionManager=16b60ec2 warned=false currentXid=null productName=Oracle productVersion=Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options jndiName=java:jboss/jdbc/CRM] txSync=null]
java.sql.SQLException: Closed Connection
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445)
at oracle.jdbc.driver.PhysicalConnection.prepareCall(PhysicalConnection.java:3204)
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.doPrepareCall(BaseWrapperManagedConnection.java:820)
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.prepareCall(BaseWrapperManagedConnection.java:806)
at org.jboss.jca.adapters.jdbc.WrappedConnection.prepareCall(WrappedConnection.java:661)
at ph.com.crm.modules.catalog.access.CatalogAccess.getPlanHandset(CatalogAccess.java:525)
at ph.com.crm.modules.catalog.ajax.ProductCatalogAjaxHandlerProcessor.getPlanHandsets(ProductCatalogAjaxHandlerProcessor.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34)
at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428)
at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431)
at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283)
at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52)
at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:285)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:264)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:175)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:792)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
更新: 我添加了try-catch来包围线
conn = setDBConnection();
logger.debug("Inside here:"+conn);
try {
logger.debug("TRYING:");
cstmt = conn.prepareCall(query);
}catch(SQLException e) {
logger.debug("####### CATCHING");
logger.debug("CAUSE: "+e.getCause());
logger.debug("NEXT EXCEPTION "+e.getNextException());
logger.debug("SQL STATE: "+e.getSQLState());
logger.debug("ERROR CODE: "+e.getErrorCode());
}
控制台结果:
:44:08,123 [Outside DIR] DEBUG [access.CatalogAccess] - ####### CATCHING
12:44:08,123 [Outside DIR] DEBUG [access.CatalogAccess] - CAUSE: null
12:44:08,124 [Outside DIR] DEBUG [access.CatalogAccess] - NEXT EXCEPTION null
12:44:08,124 [Outside DIR] DEBUG [access.CatalogAccess] - SQL STATE: 99999
12:44:08,125 [Outside DIR] DEBUG [access.CatalogAccess] - ERROR CODE: 17008
``
答案 0 :(得分:0)
已解决:在JBOSS中的数据源配置下,将“匹配时验证”设置为“ true”