2017-08-01 138 views
0

我們在我們的Web應用程序中使用Spring。Websphere + Spring DMLC + MQ -J2CA0045E:爲資源JMS調用方法createOrWaitForConnection時連接不可用

我想使用Spring的DefaultMessageListenerContainer(DMLC)同時收聽MQ的消息。

在websphere中我沒有改變任何連接配置。

問題:

當DMLC聽者試圖從隊列同時接收幾個(6個消息)消息,WebSphere應用服務器登錄FFDC事件日誌。

任何人都可以幫我如果我錯過了連接配置?

版本:

服務器:在WebSphere Application Server 8.5

消息監聽:

<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"> 
    <property name="connectionFactory" ref="connectionFactory"/> 
    <property name="destinationName" ref="queue"/> 
    <property name="messageListener" ref="myMessageListener"/> 
    <property name ="concurrentConsumers" value ="5"/> 
    <property name ="maxConcurrentConsumers" value ="20"/> 
    <property name="idleTaskExecutionLimit" value="10" /> 
    <property name="idleConsumerLimit" value="5" /> 
    <property name="recoveryInterval" value="60000" />   
</bean> 

的QueueConnectionFactory - 連接池: Image of default Connection pool of QueueConnection factory

日誌服務器日誌:

[8/1/17 12:47:54:071 ] FreePool  E J2CA0045E: Connection not available while invoking method createOrWaitForConnection for resource [email protected] 
[8/1/17 12:43:44:131 ] FfdcProvider W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on WebSphere/path/path/logFileName.txt Max connections reached 869 
[8/1/17 12:43:44:131 ] FfdcProvider W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on WebSphere/path/path/logFileName.txt com.ibm.ejs.jms.JMSConnectionHandle.createSession 1051 
[8/1/17 12:44:44:132 ] SystemOut  O 12:44:44.132 [jmsContainer-11] WARN o.s.j.l.DefaultMessageListenerContainer - Setup of JMS message listener invoker failed for destination 'queue:' - trying to recover. Cause: Failed to create session; nested exception is com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException: CWTE_NORMAL_J2CA1009 
[8/1/17 12:44:45:153 ] FfdcProvider W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on WebSphere/path/path/logFileName.txt com.ibm.ejs.jms.JMSMessageConsumerHandle.receive 264 
[8/1/17 12:44:55:304 ] SystemOut  O 12:44:55.304 [jmsContainer-11] INFO o.s.j.l.DefaultMessageListenerContainer - Successfully refreshed JMS Connection 
[8/1/17 12:47:55:310 ] FreePool  E J2CA0045E: Connection not available while invoking method createOrWaitForConnection for resource [email protected] 

FFDC日誌事件:

[8/1/17 13:41:03:046]  FFDC Exception:com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException SourceId:Max connections reached ProbeId:869 Reporter:[email protected] 
com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException: CWTE_NORMAL_J2CA1009 
    at com.ibm.ejs.j2c.FreePool.createOrWaitForConnection(FreePool.java:1782) 
    at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.java:3816) 
    at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.java:3092) 
    at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:1548) 
    at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:1031) 
    at com.ibm.ejs.jms.JMSConnectionHandle.createSession(JMSConnectionHandle.java:1434) 
    at org.springframework.jms.support.JmsAccessor.createSession(JmsAccessor.java:196) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer.access$12(DefaultMessageListenerContainer.java:1) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.initResourcesIfNecessary(DefaultMessageListenerContainer.java:1091) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1070) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1063) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:960) 
    at java.lang.Thread.run(Thread.java:863) 

==> Performing default dump from com.ibm.ejs.j2c.DiagnosticModuleForJ2C :Tue Aug 01 13:41:03 2017 
Maximum number of connections has been reached, and the connection request has been waiting longer than:ConnectionWaitTime. Two possible solutions : increase the max number of connections, or increase the:ConnectionWaitTime.: 
    Maximum Connections   = :10 
    Current number of connections = :10 
    Connection Wait Timout  = :180 
If the current number of connections is not greater than or equal to max connections, :there has been a WebSphere internal error.: 
This = BEGIN:[email protected] 
com.ibm.ejs.j2c.PoolManager::tc BEGIN:[email protected] 
com.ibm.ejs.ras.TraceElement::ivLevel:10 
com.ibm.ejs.ras.TraceElement::ivName:com.ibm.ejs.j2c.PoolManager 
com.ibm.ejs.ras.TraceElement::ivDebugEnabled:false 
com.ibm.ejs.ras.TraceElement::ivEventEnabled:false 
com.ibm.ejs.ras.TraceElement::ivEntryEnabled:false 
com.ibm.ejs.ras.TraceElement::ivDetailEnabled:false 
com.ibm.ejs.ras.TraceElement::ivConfigEnabled:false 
com.ibm.ejs.ras.TraceElement::ivInfoEnabled:true 
com.ibm.ejs.ras.TraceElement::ivServiceEnabled:true 
com.ibm.ejs.ras.TraceElement::ivWarningEnabled:true 
com.ibm.ejs.ras.TraceElement::ivErrorEnabled:true 
com.ibm.ejs.ras.TraceElement::ivFatalEnabled:true 
com.ibm.ejs.ras.TraceComponent::defaultMessageFile:com.ibm.ejs.resources.seriousMessages 
com.ibm.ejs.ras.TraceComponent::EXTENSION_NAME_DPID:DiagnosticProvider 
com.ibm.ejs.ras.TraceComponent::ivDumpEnabled:false 
com.ibm.ejs.ras.TraceComponent::ivResourceBundleName:com.ibm.ws.j2c.resources.J2CAMessages 
com.ibm.ejs.ras.TraceComponent::ivLogger:[email protected] 
com.ibm.ejs.ras.TraceComponent::ivDiagnosticProviderID:null 
com.ibm.ejs.ras.TraceComponent::anyTracingEnabled:null 
END:[email protected] 

[8/1/17 13:42:03:108 ]  FFDC Exception:com.ibm.msg.client.jms.DetailedIllegalStateException SourceId:com.ibm.ejs.jms.JMSMessageConsumerHandle.receive ProbeId:264 Reporter:[email protected] 
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. 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:86) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:58) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:542) 
    at com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:314) 
    at com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:228) 
    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.JmsMessageConsumerImpl.receive(JmsMessageConsumerImpl.java:413) 
    at com.ibm.mq.jms.MQMessageConsumer.receive(MQMessageConsumer.java:212) 
    at com.ibm.ejs.jms.JMSMessageConsumerHandle.receive(JMSMessageConsumerHandle.java:553) 
    at com.ibm.ejs.jms.JMSMessageConsumerHandle.receive(JMSMessageConsumerHandle.java:501) 
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessageListenerContainer.java:431) 
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:311) 
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:264) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1071) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1063) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:960) 
    at java.lang.Thread.run(Thread.java:863) 

==> Performing default dump from com.ibm.ejs.jms.JMSDiagnosticModule :Tue Aug 01 13:42:03 2017 
+Data for directive [defaultdefault] obtained.: 
==> Dump complete for com.ibm.ejs.jms.JMSDiagnosticModule :Tue Aug 01 13:42:03 CEST 201 

[8/1/17 13:50:13:445]  FFDC Exception:javax.jms.IllegalStateException SourceId:com.ibm.ejs.jms.JMSConnectionHandle.createSession ProbeId:1044 Reporter:[email protected] 
javax.jms.IllegalStateException: Connection closed 
    at com.ibm.ejs.jms.JMSConnectionHandle.checkOpen(JMSConnectionHandle.java:837) 
    at com.ibm.ejs.jms.JMSConnectionHandle.createSession(JMSConnectionHandle.java:1430) 
    at org.springframework.jms.support.JmsAccessor.createSession(JmsAccessor.java:196) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer.access$12(DefaultMessageListenerContainer.java:1) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.initResourcesIfNecessary(DefaultMessageListenerContainer.java:1091) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1070) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1063) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:960) 
    at java.lang.Thread.run(Thread.java:863) 

8/2/17 15:30:31:874 CEST]  FFDC Exception:javax.jms.IllegalStateException SourceId:com.ibm.ejs.jms.JMSConnectionHandle.stop ProbeId:477 Reporter:[email protected] 
javax.jms.IllegalStateException: Method stop not permitted 
    at com.ibm.ejs.jms.JMSCMUtils.methodNotPermittedException(JMSCMUtils.java:244) 
    at com.ibm.ejs.jms.JMSConnectionHandle.checkRestrictedMethod(JMSConnectionHandle.java:854) 
    at com.ibm.ejs.jms.JMSConnectionHandle.stop(JMSConnectionHandle.java:768) 
    at org.springframework.jms.listener.AbstractJmsListeningContainer.stopSharedConnection(AbstractJmsListeningContainer.java:460) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer.stopSharedConnection(DefaultMessageListenerContainer.java:791) 
    at org.springframework.jms.listener.AbstractJmsListeningContainer.doStop(AbstractJmsListeningContainer.java:326) 
    at org.springframework.jms.listener.AbstractJmsListeningContainer.stop(AbstractJmsListeningContainer.java:302) 
    at org.springframework.jms.listener.DefaultMessageListenerContainer.stop(DefaultMessageListenerContainer.java:582) 
    at org.springframework.context.support.DefaultLifecycleProcessor.doStop(DefaultLifecycleProcessor.java:223) 
    at org.springframework.context.support.DefaultLifecycleProcessor.access$2(DefaultLifecycleProcessor.java:207) 
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.stop(DefaultLifecycleProcessor.java:356) 
    at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:196) 
    at org.springframework.context.support.DefaultLifecycleProcessor.onClose(DefaultLifecycleProcessor.java:113) 
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1045) 
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1000) 
    at com.bnppf.ssc.imb.sf.fwk.mia.context.CloseableGenericWebApplicationContext.close(CloseableGenericWebApplicationContext.java:34) 
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:548) 
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142) 
    at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextDestroyed(WebApp.java:1765) 
    at com.ibm.ws.webcontainer.webapp.WebApp.destroy(WebApp.java:3131) 
    at com.ibm.ws.webcontainer.webapp.WebAppImpl.destroy(WebAppImpl.java:1551) 
    at com.ibm.ws.container.AbstractContainer.destroy(AbstractContainer.java:75) 
    at com.ibm.ws.webcontainer.webapp.WebGroup.destroy(WebGroup.java:228) 
    at com.ibm.ws.webcontainer.webapp.WebGroup.removeWebApplication(WebGroup.java:269) 
    at com.ibm.ws.webcontainer.VirtualHost.removeWebApplication(VirtualHost.java:296) 
    at com.ibm.ws.webcontainer.VirtualHostImpl.removeWebApplication(VirtualHostImpl.java:211) 
    at com.ibm.ws.webcontainer.WSWebContainer.removeWebApplication(WSWebContainer.java:820) 
    at com.ibm.ws.webcontainer.component.WebContainerImpl.uninstall(WebContainerImpl.java:458) 
    at com.ibm.ws.webcontainer.component.WebContainerImpl.stop(WebContainerImpl.java:729) 
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.stop(ApplicationMgrImpl.java:1218) 
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStop(DeployedApplicationImpl.java:1375) 
    at com.ibm.ws.runtime.component.DeployedModuleImpl.stop(DeployedModuleImpl.java:671) 
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.stop(DeployedApplicationImpl.java:1149) 
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.stopApplication(ApplicationMgrImpl.java:952) 
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.stopApplicationImpl(ApplicationMgrImpl.java:1488) 
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.stop(ApplicationMgrImpl.java:2249) 
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.stop(CompositionUnitMgrImpl.java:492) 
    at com.ibm.ws.runtime.component.CompositionUnitImpl.stop(CompositionUnitImpl.java:141) 
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$2.run(CompositionUnitMgrImpl.java:795) 
    at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5387) 
    at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5603) 
    at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255) 
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.stopCompositionUnit(CompositionUnitMgrImpl.java:830) 
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.stopCompositionUnit(CompositionUnitMgrImpl.java:736) 
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.stopApplication(ApplicationMgrImpl.java:1465) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) 
    at java.lang.reflect.Method.invoke(Method.java:620) 
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:88) 
    at sun.reflect.GeneratedMethodAccessor133.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) 
    at java.lang.reflect.Method.invoke(Method.java:620) 
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:292) 
    at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1261) 
    at java.security.AccessController.doPrivileged(AccessController.java:311) 
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:88) 
    at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1255) 
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1093) 
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:832) 
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:814) 
    at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335) 
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) 
    at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228) 
    at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181) 
    at com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:247) 
    at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:360) 
    at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:602) 
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175) 
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) 
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) 
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) 
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) 
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) 
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) 
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881) 

回答

0

看起來像當前的Spring配置正在消耗整個連接池。因此,無論哪種配置都不正確,或者您正在某個地方泄漏連接。

==> Performing default dump from com.ibm.ejs.j2c.DiagnosticModuleForJ2C :Tue Aug 01 13:41:03 2017 
Maximum number of connections has been reached, and the connection request has been waiting longer than:ConnectionWaitTime. Two possible solutions : increase the max number of connections, or increase the:ConnectionWaitTime.: 
    Maximum Connections   = :10 
    Current number of connections = :10 
    Connection Wait Timout  = :180 

所以無論是固定配置 - 也許用簡單的一個啓動和清除:

<property name ="maxConcurrentConsumers" value ="20"/> 
<property name="idleTaskExecutionLimit" value="10" /> 
<property name="idleConsumerLimit" value="5" /> 

或者只是使用普通的Java EE MDB的reciving消息,而不是今年春季的。

+0

我正在使用Spring,因爲Spring的DMLC支持併發消費者,它負責多線程。我想同時處理這些消息。所以我沒選擇Java EE MDB。正如你所說,我將修復配置。 –

+0

我還需要屬性maxConcurrentConsumers。我應該通過增加WAS中QueueConnectionFactory的連接池中的maximumConnections來嘗試嗎? –

+0

每個Java EE服務器都將允許MDB上的併發使用者,並且將爲此處理線程,所以這不是重點。是的,你可以嘗試增加QCF中的池大小,它肯定會有所幫助。 – Gas