Discussions

EJB programming & troubleshooting: javax.transaction.xa.XAException: Closed Connection

  1. javax.transaction.xa.XAException: Closed Connection (2 messages)

    If the oracle connection is down in between the application access, i am getting the exception,
    "Unidentified SQLException of type: java.sql.SQLException Details: Io exception: End of TNS data channel "

    Instead i need to give the user defined message.

    In the weblogic console,
    the exception thrown is shown below.
    <Exception occurred during rollback of transaction Name=[EJB
     com.covansys.jclarety.arch.app.internal.ServiceProviderBean.handleRequest(com.covansys.jclarety.arch.common.api.ServiceRe
    quest)],Xid=BEA1-000403B8051EE4727FF9(42158136),Status=Rolled back. [Reason=weblogic.transaction.internal.AppSetRollbackOn
    lyException],HeuristicErrorCode=XA_HEURHAZ,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=59
    ,XAServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl
    ]=(state=rolledback,assigned=myserver),xar=weblogic.jdbc.wrapper.JTSXAResourceImpl@285f9d8,re-Registered = false),SCInfo[S
    Sdomain+myserver]=(state=rolledback),properties=({weblogic.transaction.name=[EJB com.covansys.jclarety.arch.app.internal.S
    erviceProviderBean.handleRequest(com.covansys.jclarety.arch.common.api.ServiceRequest)], weblogic.jdbc=t3://10.6.95.44:800
    1}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=myserver+10.6.95.44:8001+SSdomain+t3+, XA
    Resources={},NonXAResources={})],CoordinatorURL=myserver+10.6.95.44:8001+SSdomain+t3+): javax.transaction.SystemException:
     Heuristic hazard: (weblogic.jdbc.wrapper.JTSXAResourceImpl, HeuristicHazard, (javax.transaction.xa.XAException: Closed Co
    nnection))
            at weblogic.transaction.internal.ServerTransactionImpl.internalRollback()V(ServerTransactionImpl.java:396)
    ................

    ErrorMessage Unidentified SQLException of type: java.sql.SQLException Details: Io exception: End of TNS data channel
    Stack Trace: Unidentified SQLException of type: java.sql.SQLException Details: Io exception: End of TNS data channel
  2. Not very sure on what your question is. can you clarify.
    Common Oracle exceptions are typically converted to "user-friendly" exceptions.
  3. If I understand correctly, you want to show a meaningful message in this particular error condition. something like "database server was down"
    For that, first catch java.sql.SQLException being thrown at this point. Then, find what error code it contains by calling a "getErrorCode()" on your exception object.
    I am sure Oralce driver must be populating some particular error code for this scenario. Test if you have that error code. If you see the expected error code, Show meaningful message to user
    HTH