You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

ActiveMQ 5.13.0报java.io.EOFException问题求助

Hey there, let's break down your issue step by step since you're new to ActiveMQ and Java—no worries, we'll get through this together!

First, let's recap your environment clearly:

  • ActiveMQ: 5.13.0 on CentOS7, using OpenJDK 1.8.0_131
  • Producer: Ruby script on CentOS6, connecting via AMQP to amqp://10.66.136.171:5672
  • Key ActiveMQ Config:
    • Default transport connectors (AMQP port 5672 with maxInactivityDuration=0)
    • Virtual topic setup: <virtualTopic name="VirtualTopic.eng.testing" prefix="VirtualQueueConsumer.*." />
  • Error: ActiveMQ logs throw java.io.EOFException for the producer connection, but the virtual topic appears in the web console.

What's causing this EOFException?

This error means the ActiveMQ broker tried to read data from the producer connection, but hit the end of the stream unexpectedly. Usually this happens because the connection was dropped mid-transfer—either from a protocol mismatch, network issue, or client-side problem. Let's go through the most likely fixes:

1. Check Ruby AMQP client compatibility with ActiveMQ's AMQP version

ActiveMQ 5.13.0's default AMQP transport uses AMQP 1.0 (powered by Qpid Proton under the hood). Many Ruby AMQP libraries (like bunny) are built for older AMQP 0.9.1, which won't work with ActiveMQ's default AMQP 1.0 endpoint. Here's how to fix this:

  • If you're using bunny or another 0.9.1-focused gem: Add a dedicated AMQP 0.9.1 transport to your activemq.xml:
    <transportConnector name="amqp-091" uri="amqp://0.0.0.0:5673?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600&amp;wireFormat=AMQP_0_9_1"/>
    
    Then update your Ruby script to connect to amqp://10.66.136.171:5673 instead of 5672.
  • Alternatively, switch your Ruby client to one that supports AMQP 1.0 (like proton-ruby), which will work with the existing 5672 port.

2. Rule out network/firewall issues

  • Verify the CentOS7 firewall allows traffic on port 5672:
    # Check if port is open
    sudo firewall-cmd --list-ports | grep 5672
    # If not, add it permanently
    sudo firewall-cmd --add-port=5672/tcp --permanent
    sudo firewall-cmd --reload
    
  • Test connectivity from the CentOS6 producer server:
    telnet 10.66.136.171 5672
    # Or use netcat if telnet isn't installed
    nc -zv 10.66.136.171 5672
    
    Even if the connection succeeds, intermittent drops could cause this error—check for network latency or NAT devices that might kill idle connections (even though you set maxInactivityDuration=0).

3. Get more detailed logs to pinpoint the issue

The current WARN log only shows the exception stack. Enable debug logging for the AMQP transport to see what's happening during handshake or message transfer:

  • Edit conf/log4j.properties in your ActiveMQ directory, add or modify this line:
    log4j.logger.org.apache.activemq.transport.amqp=DEBUG
    
  • Restart ActiveMQ, re-run your Ruby producer, then check data/activemq.log. The debug logs will show AMQP frame details, handshake steps, and exactly where the connection failed.

4. Simplify config to rule out virtual topic interference

Your web console sees the virtual topic, so that config is working—but let's confirm it's not indirectly causing the issue:

  • Temporarily comment out the <destinationInterceptors> block in activemq.xml, restart ActiveMQ.
  • Have your producer send to a plain topic (e.g., test) instead of the virtual topic. If the error goes away, the issue might be tied to virtual topic routing (though this is less likely for an EOF error).

5. Check JDK version edge cases

ActiveMQ 5.13.0 is compatible with OpenJDK 8, but older 1.8.0_131 has minor IO-related bugs. Try upgrading to a newer patch release of OpenJDK 8 (like 1.8.0_301) to rule out JDK-specific issues.


内容的提问来源于stack exchange,提问作者wlin

火山引擎 最新活动