問題描述:
使用activemq過程當中,出現了以下的問題,日誌信息如:html
vm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: org.apache.activemq.transport.InactivityIOException: Channel was inactive for too (>30000) long: /127.0.0.1:49494 jvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: org.apache.activemq.transport.InactivityIOException: Channel was inactive for too (>30000) long: /127.0.0.1:50226 jvm 1 | INFO | Transport failed: org.apache.activemq.transport.InactivityIOException: Channel was inactive for too (>30000) long: /127.0.0.1:50225 jvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: org.apache.activemq.transport.InactivityIOException: Channel was inactive for too (>30000) long: /127.0.0.1:50213 jvm 1 | INFO | Transport failed: java.io.EOFExceptionjvm 1 | INFO | Transport failed: java.io.EOFException
在tomcat中獲得的日誌爲:java
java.lang.OutOfMemoryError: Java heap space Exception in thread "ActiveMQ Task" java.lang.OutOfMemoryError: Java heap space Exception in thread "ActiveMQ Task" java.lang.OutOfMemoryError: Java heap space Exception in thread "ActiveMQ Task" java.lang.OutOfMemoryError: Java heap space Exception in thread "ActiveMQ Task" java.lang.OutOfMemoryError: Java heap space Exception in thread "ActiveMQ Task" 2014-2-19 16:55:13 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor processChildren 嚴重: Exception invoking periodic operation: java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space Exception in thread "ActiveMQ Task" java.lang.OutOfMemoryError: Java heap space Exception in thread "ActiveMQ Task" java.lang.OutOfMemoryError: Java heap space Exception in thread "ActiveMQ Task" java.lang.OutOfMemoryError: Java heap space Exception in thread "ActiveMQ Task" java.lang.OutOfMemoryError: Java heap space
解決方法:
查看配置,在activemq的 conf/activemq.xml 裏設置了InactivityMonitor的鏈接超時時間致使,如:web
<transportConnectors> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?wireFormat.maxInactivityDuration=30000"/> </transportConnectors>
經過設置鏈接URL的屬性: tcp:/ / localhost:61616 ? wireFormat.maxInactivityDuration = 30000,表示若是30秒沒有數據被讀取,接InactivityMonitor假定有一個鏈接的問題。 InactivityMonitor拋出一個InactivityIOException和關閉相關的轉換鏈接.
解決方式之一:禁用InactivityMonitor . apache
即將 tomcat
uri="tcp://0.0.0.0:61616?wireFormat.maxInactivityDuration=30000"
修改成jvm
uri="tcp://0.0.0.0:61616?wireFormat.maxInactivityDuration=0"
相關的內容參考:http://activemq.apache.org/activemq-inactivitymonitor.htmltcp