javax.resource.spi.ResourceAdapterInternalException: Failed to stop connection on cleanup

Spring JIRA | Jan-Kees van Andel | 3 years ago
  1. 0

    When I set the logging in the package org.springframework.ws.transport.support (or org.springframework FWIW), I get a strange exception. See below: {code:Java} [9/5/13 20:18:30:610 CEST] 00000056 ConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource JMS$LQG00386-LQG00386$JMSManagedConnection@3. The exception is: com.ibm.msg.client.jms.DetailedIllegalStateException: JMSCC0032: This message consumer is closed. An application called a method that must not be used after the message consumer is closed. Ensure that the message consumer is not closed before calling the method. [9/5/13 20:18:30:640 CEST] 00000051 MCWrapper E J2CA0081E: Method cleanup failed while trying to execute method cleanup on ManagedConnection <null> from resource jms/LQG00386. Caught exception: javax.resource.spi.ResourceAdapterInternalException: Failed to stop connection on cleanup at com.ibm.ejs.jms.JMSCMUtils.mapToResourceException(JMSCMUtils.java:176) at com.ibm.ejs.jms.JMSManagedConnection.cleanup(JMSManagedConnection.java:1122) at com.ibm.ejs.j2c.MCWrapper.cleanup(MCWrapper.java:1549) at com.ibm.ejs.j2c.FreePool.cleanupAndDestroyMCWrapper(FreePool.java:732) at com.ibm.ejs.j2c.FreePool.returnToFreePool(FreePool.java:502) at com.ibm.ejs.j2c.PoolManager.release(PoolManager.java:1915) at com.ibm.ejs.j2c.MCWrapper.releaseToPoolManager(MCWrapper.java:2404) at com.ibm.ejs.j2c.MCWrapper.connectionErrorOccurred(MCWrapper.java:2543) at com.ibm.ejs.j2c.ConnectionEventListener.connectionErrorOccurred(ConnectionEventListener.java:511) at com.ibm.ejs.jms.JMSManagedConnection.connectionErrorOccurred(JMSManagedConnection.java:1493) at com.ibm.ejs.jms.JMSConnectionHandle.markManagedConnectionAsStale(JMSConnectionHandle.java:922) at com.ibm.ejs.jms.JMSSessionHandle.markManagedObjectsAsStale(JMSSessionHandle.java:1540) at com.ibm.ejs.jms.JMSMessageConsumerHandle.markManagedObjectsAsStale(JMSMessageConsumerHandle.java:915) at com.ibm.ejs.jms.JMSMessageConsumerHandle.receive(JMSMessageConsumerHandle.java:570) at com.ibm.ejs.jms.JMSMessageConsumerHandle.receive(JMSMessageConsumerHandle.java:500) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessageListenerContainer.java:429) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:310) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947) at java.lang.Thread.run(Thread.java:738) Caused by: com.ibm.msg.client.jms.DetailedIllegalStateException: JMSCC0008: This connection is closed. An application called a method that must not be used after the connection is closed. Ensure that the connection is not closed before calling the method. at sun.reflect.GeneratedConstructorAccessor319.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39) at java.lang.reflect.Constructor.newInstance(Constructor.java:527) at com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:411) at com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:390) at com.ibm.msg.client.jms.internal.JmsErrorUtils.createException(JmsErrorUtils.java:104) at com.ibm.msg.client.jms.internal.State.checkNotClosed(State.java:145) at com.ibm.msg.client.jms.internal.JmsConnectionImpl.getExceptionListener(JmsConnectionImpl.java:590) at com.ibm.mq.jms.MQConnection.getExceptionListener(MQConnection.java:373) at com.ibm.ejs.jms.JMSManagedConnection.cleanup(JMSManagedConnection.java:1100) ... 20 more [9/5/13 20:18:30:643 CEST] 00000051 MCWrapper W J2CA0088W: The ManagedConnection that is being destroyed from resource No longer available is in an invalid state STATE_INACTIVE. Processing will continue. [9/5/13 20:21:31:349 CEST] 00000057 FreePool E J2CA0045E: Connection not available while invoking method createOrWaitForConnection for resource JMS$LQG00386-LQG00386$JMSManagedConnection@4. [9/5/13 20:21:36:371 CEST] 00000058 ConnectionEve W J2CA0206W: A connection error occurred. To help determine the problem, enable the Diagnose Connection Usage option on the Connection Factory or Data Source. This is the multithreaded access detection option. [9/5/13 20:21:36:372 CEST] 00000058 ConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource JMS$LQG00386-LQG00386$JMSManagedConnection@4. The exception is: com.ibm.msg.client.jms.DetailedIllegalStateException: JMSCC0032: This message consumer is closed. An application called a method that must not be used after the message consumer is closed. Ensure that the message consumer is not closed before calling the method. {code} When digging down into the issue, I found that the root cause was in the org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport#logUri() method. This method calls a method: org.springframework.ws.transport.jms.JmsReceiverConnection#getUri() which crashes because requestMessage.getJMSDestination() resolves to null. However, the exception is not caught, so it bubbles up. And since it's outside of the try block, the rest of the code is not executed and the connection is not freed. In my local environment I fixed the issue by adding a catch clause to the logURI method, like this: {code:Java} private void logUri(WebServiceConnection connection) { if (logger.isDebugEnabled()) { try { logger.debug("Accepting incoming [" + connection + "] at [" + connection.getUri() + "]"); } catch (URISyntaxException e) { // ignore } catch (IllegalArgumentException e) { if (logger.isWarnEnabled()) { logger.warn("Error while trying to log WebServiceConnection URI " + e.getMessage()); } else { logger.debug("Error while trying to log WebServiceConnection URI", e); } } } } {code} This way, the logging statement doesn't have (a visible at least) side effect. Expanding the try block in handleConnection was also something I tried, but that had as a result that the connection is properly closed, but the rest of the code (my service endpoint) was still not executed. So that solution also had side effects

    Spring JIRA | 3 years ago | Jan-Kees van Andel
    javax.resource.spi.ResourceAdapterInternalException: Failed to stop connection on cleanup
  2. 0

    When I set the logging in the package org.springframework.ws.transport.support (or org.springframework FWIW), I get a strange exception. See below: {code:Java} [9/5/13 20:18:30:610 CEST] 00000056 ConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource JMS$LQG00386-LQG00386$JMSManagedConnection@3. The exception is: com.ibm.msg.client.jms.DetailedIllegalStateException: JMSCC0032: This message consumer is closed. An application called a method that must not be used after the message consumer is closed. Ensure that the message consumer is not closed before calling the method. [9/5/13 20:18:30:640 CEST] 00000051 MCWrapper E J2CA0081E: Method cleanup failed while trying to execute method cleanup on ManagedConnection <null> from resource jms/LQG00386. Caught exception: javax.resource.spi.ResourceAdapterInternalException: Failed to stop connection on cleanup at com.ibm.ejs.jms.JMSCMUtils.mapToResourceException(JMSCMUtils.java:176) at com.ibm.ejs.jms.JMSManagedConnection.cleanup(JMSManagedConnection.java:1122) at com.ibm.ejs.j2c.MCWrapper.cleanup(MCWrapper.java:1549) at com.ibm.ejs.j2c.FreePool.cleanupAndDestroyMCWrapper(FreePool.java:732) at com.ibm.ejs.j2c.FreePool.returnToFreePool(FreePool.java:502) at com.ibm.ejs.j2c.PoolManager.release(PoolManager.java:1915) at com.ibm.ejs.j2c.MCWrapper.releaseToPoolManager(MCWrapper.java:2404) at com.ibm.ejs.j2c.MCWrapper.connectionErrorOccurred(MCWrapper.java:2543) at com.ibm.ejs.j2c.ConnectionEventListener.connectionErrorOccurred(ConnectionEventListener.java:511) at com.ibm.ejs.jms.JMSManagedConnection.connectionErrorOccurred(JMSManagedConnection.java:1493) at com.ibm.ejs.jms.JMSConnectionHandle.markManagedConnectionAsStale(JMSConnectionHandle.java:922) at com.ibm.ejs.jms.JMSSessionHandle.markManagedObjectsAsStale(JMSSessionHandle.java:1540) at com.ibm.ejs.jms.JMSMessageConsumerHandle.markManagedObjectsAsStale(JMSMessageConsumerHandle.java:915) at com.ibm.ejs.jms.JMSMessageConsumerHandle.receive(JMSMessageConsumerHandle.java:570) at com.ibm.ejs.jms.JMSMessageConsumerHandle.receive(JMSMessageConsumerHandle.java:500) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessageListenerContainer.java:429) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:310) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947) at java.lang.Thread.run(Thread.java:738) Caused by: com.ibm.msg.client.jms.DetailedIllegalStateException: JMSCC0008: This connection is closed. An application called a method that must not be used after the connection is closed. Ensure that the connection is not closed before calling the method. at sun.reflect.GeneratedConstructorAccessor319.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39) at java.lang.reflect.Constructor.newInstance(Constructor.java:527) at com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:411) at com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:390) at com.ibm.msg.client.jms.internal.JmsErrorUtils.createException(JmsErrorUtils.java:104) at com.ibm.msg.client.jms.internal.State.checkNotClosed(State.java:145) at com.ibm.msg.client.jms.internal.JmsConnectionImpl.getExceptionListener(JmsConnectionImpl.java:590) at com.ibm.mq.jms.MQConnection.getExceptionListener(MQConnection.java:373) at com.ibm.ejs.jms.JMSManagedConnection.cleanup(JMSManagedConnection.java:1100) ... 20 more [9/5/13 20:18:30:643 CEST] 00000051 MCWrapper W J2CA0088W: The ManagedConnection that is being destroyed from resource No longer available is in an invalid state STATE_INACTIVE. Processing will continue. [9/5/13 20:21:31:349 CEST] 00000057 FreePool E J2CA0045E: Connection not available while invoking method createOrWaitForConnection for resource JMS$LQG00386-LQG00386$JMSManagedConnection@4. [9/5/13 20:21:36:371 CEST] 00000058 ConnectionEve W J2CA0206W: A connection error occurred. To help determine the problem, enable the Diagnose Connection Usage option on the Connection Factory or Data Source. This is the multithreaded access detection option. [9/5/13 20:21:36:372 CEST] 00000058 ConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource JMS$LQG00386-LQG00386$JMSManagedConnection@4. The exception is: com.ibm.msg.client.jms.DetailedIllegalStateException: JMSCC0032: This message consumer is closed. An application called a method that must not be used after the message consumer is closed. Ensure that the message consumer is not closed before calling the method. {code} When digging down into the issue, I found that the root cause was in the org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport#logUri() method. This method calls a method: org.springframework.ws.transport.jms.JmsReceiverConnection#getUri() which crashes because requestMessage.getJMSDestination() resolves to null. However, the exception is not caught, so it bubbles up. And since it's outside of the try block, the rest of the code is not executed and the connection is not freed. In my local environment I fixed the issue by adding a catch clause to the logURI method, like this: {code:Java} private void logUri(WebServiceConnection connection) { if (logger.isDebugEnabled()) { try { logger.debug("Accepting incoming [" + connection + "] at [" + connection.getUri() + "]"); } catch (URISyntaxException e) { // ignore } catch (IllegalArgumentException e) { if (logger.isWarnEnabled()) { logger.warn("Error while trying to log WebServiceConnection URI " + e.getMessage()); } else { logger.debug("Error while trying to log WebServiceConnection URI", e); } } } } {code} This way, the logging statement doesn't have (a visible at least) side effect. Expanding the try block in handleConnection was also something I tried, but that had as a result that the connection is properly closed, but the rest of the code (my service endpoint) was still not executed. So that solution also had side effects

    Spring JIRA | 3 years ago | Jan-Kees van Andel
    javax.resource.spi.ResourceAdapterInternalException: Failed to stop connection on cleanup
  3. 0

    SimpleMessageListenerContainer used with taskExecutor with default auto_acknowledge

    Stack Overflow | 2 years ago | user3090171
    com.ibm.msg.client.jms.DetailedIllegalStateException: JMSCC0033: A synchronous method call is not permitted when a session is being used asynchronously: 'getTransacted' The JMS specification does not permit the use of a session for synchronous methods when asynchronous message delivery is running. Create a separate session if you wish to use both synchronous methods and asynchronous delivery simultaneously.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Exception inside the DMLC for Temporary ReplyTo Queue for destination - Red Hat Customer Portal

    redhat.com | 7 months ago
    com.ibm.msg.client.jms.DetailedIllegalStateException: JMSCC0020: This session is closed. An application called a method that must not be used after the session is closed. Ensure that the session is not closed before calling the method.
  6. 0

    Exception in Server Logs : JMSCC0033 While using Weblogic 10.3.X and MQ 7

    Oracle Community | 5 years ago | 907018
    com.ibm.msg.client.jms.DetailedIllegalStateException: JMSCC0033: A synchronous method call is not permitted when a session is being used asynchronously: 'acknowledge' The JMS specification does not permit the use of a session for synchronous methods when asynchronous message delivery is running. Create a separate session if you wish to use both synchronous methods and asynchronous delivery simultaneously.

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.ibm.msg.client.jms.DetailedIllegalStateException

      JMSCC0008: This connection is closed. An application called a method that must not be used after the connection is closed. Ensure that the connection is not closed before calling the method.

      at sun.reflect.GeneratedConstructorAccessor319.newInstance()
    2. Java RT
      Constructor.newInstance
      1. sun.reflect.GeneratedConstructorAccessor319.newInstance(Unknown Source)
      2. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
      3. java.lang.reflect.Constructor.newInstance(Constructor.java:527)
      3 frames
    3. com.ibm.msg
      JmsConnectionImpl.getExceptionListener
      1. com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:411)
      2. com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:390)
      3. com.ibm.msg.client.jms.internal.JmsErrorUtils.createException(JmsErrorUtils.java:104)
      4. com.ibm.msg.client.jms.internal.State.checkNotClosed(State.java:145)
      5. com.ibm.msg.client.jms.internal.JmsConnectionImpl.getExceptionListener(JmsConnectionImpl.java:590)
      5 frames
    4. com.ibm.mq
      MQConnection.getExceptionListener
      1. com.ibm.mq.jms.MQConnection.getExceptionListener(MQConnection.java:373)
      1 frame
    5. com.ibm.ejs
      JMSMessageConsumerHandle.receive
      1. com.ibm.ejs.jms.JMSManagedConnection.cleanup(JMSManagedConnection.java:1100)
      2. com.ibm.ejs.j2c.MCWrapper.cleanup(MCWrapper.java:1549)
      3. com.ibm.ejs.j2c.FreePool.cleanupAndDestroyMCWrapper(FreePool.java:732)
      4. com.ibm.ejs.j2c.FreePool.returnToFreePool(FreePool.java:502)
      5. com.ibm.ejs.j2c.PoolManager.release(PoolManager.java:1915)
      6. com.ibm.ejs.j2c.MCWrapper.releaseToPoolManager(MCWrapper.java:2404)
      7. com.ibm.ejs.j2c.MCWrapper.connectionErrorOccurred(MCWrapper.java:2543)
      8. com.ibm.ejs.j2c.ConnectionEventListener.connectionErrorOccurred(ConnectionEventListener.java:511)
      9. com.ibm.ejs.jms.JMSManagedConnection.connectionErrorOccurred(JMSManagedConnection.java:1493)
      10. com.ibm.ejs.jms.JMSConnectionHandle.markManagedConnectionAsStale(JMSConnectionHandle.java:922)
      11. com.ibm.ejs.jms.JMSSessionHandle.markManagedObjectsAsStale(JMSSessionHandle.java:1540)
      12. com.ibm.ejs.jms.JMSMessageConsumerHandle.markManagedObjectsAsStale(JMSMessageConsumerHandle.java:915)
      13. com.ibm.ejs.jms.JMSMessageConsumerHandle.receive(JMSMessageConsumerHandle.java:570)
      14. com.ibm.ejs.jms.JMSMessageConsumerHandle.receive(JMSMessageConsumerHandle.java:500)
      14 frames
    6. Spring Framework
      DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run
      1. org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessageListenerContainer.java:429)
      2. org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:310)
      3. org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)
      4. org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)
      5. org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)
      6. org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
      6 frames
    7. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:738)
      1 frame