Announcement Announcement Module
Collapse
No announcement yet.
RabbitMQ Configuration failing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RabbitMQ Configuration failing

    I'm attempting to connect to a remote RabbitMQ service I created and deployed. My client is using Spring AMQP and I've created the following RabbitConfiguration class:

    Code:
    public class RabbitConfiguration {
        @Bean
        public ConnectionFactory connectionFactory() {
            CachingConnectionFactory connectionFactory = new CachingConnectionFactory("10.46.xxx.xxx");
            connectionFactory.setPort(10001);
            connectionFactory.setUsername("uEejUKacRGvjO");
            connectionFactory.setPassword("pKlyhpd6K4go3");
            connectionFactory.setVirtualHost("/ve2b460e7e6b24b5da88c935df63c4e86");
            return connectionFactory;
        }
    
        @Bean
        public AmqpAdmin amqpAdmin() {
            return new RabbitAdmin(connectionFactory());
        }
    
        @Bean
        public RabbitTemplate rabbitTemplate() {
            RabbitTemplate templ = new RabbitTemplate(connectionFactory());
    //        templ.setQueue("queue-dogtag");
            return templ;
        }
    
        @Bean
        public AMQP.Queue myQueue() {
            return new AMQP.Queue();
        }
    }
    My code then uses this class to send a message as follows:

    Code:
            try {
                ApplicationContext context = new AnnotationConfigApplicationContext(RabbitConfiguration.class);
                amqpTemplate = context.getBean(AmqpTemplate.class);
                amqpTemplate.convertAndSend("queue-dogtag", "Hello");
            }
            catch (Exception e) {
                e.printStackTrace();
            }
    However, when this code runs, I consistently get the following exception:

    Code:
    Caused by: java.io.IOException
    	at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106)
    	at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102)
    	at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:124)
    	at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:381)
    	at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:516)
    	at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:545)
    	at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:160)
    	... 44 more
    Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; reason: java.io.EOFException
    	at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
    	at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33)
    	at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:343)
    	at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:216)
    	at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)
    	... 48 more
    Caused by: java.io.EOFException
    	at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:273)
    	at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:95)
    	at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:131)
    	at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:508)
    Any idea why this is happening?

    TIA!

  • #2
    EOFException indicates the server closed the connection. Is there anything interesting in the server logs?

    Googling "rabbitmq readFrom eofexception" turns up some posts where the Rabbit guys are pointing to network problems and suggest trying locally.

    Comment


    • #3
      I set up wireshark on my client and have tcpdump running on the server. On the server I see several checksums not validating as follows:

      Code:
      16:26:11.806196 IP (tos 0x0, ttl 124, id 24778, offset 0, flags [DF], proto TCP (6), length 52)
          10.52.xxx.54863 > 10.46.xxx.10001: Flags [S], cksum 0x7a8d (correct), seq 3646566756, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
      16:26:11.806242 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 52)
          10.46.xxx.10001 > 10.52.xxx.54863: Flags [S.], cksum 0xcc89 (incorrect -> 0x00ff), seq 844639775, ack 3646566757, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 6], length 0
      16:26:11.806965 IP (tos 0x0, ttl 124, id 24779, offset 0, flags [DF], proto TCP (6), length 40)
          10.52.xxx.54863 > 10.46.xxx.10001: Flags [.], cksum 0x79d8 (correct), seq 1, ack 1, win 256, length 0
      16:26:11.829480 IP (tos 0x0, ttl 124, id 24781, offset 0, flags [DF], proto TCP (6), length 48)
          10.52.xxx.54863 > 10.46.xxx.10001: Flags [P.], cksum 0xde29 (correct), seq 1:9, ack 1, win 256, length 8
      16:26:11.829504 IP (tos 0x0, ttl 64, id 22357, offset 0, flags [DF], proto TCP (6), length 40)
          10.46.xxx.10001 > 10.52.xxx4.54863: Flags [.], cksum 0xcc7d (incorrect -> 0x79eb), seq 1, ack 9, win 229, length 0
      16:26:11.829891 IP (tos 0x0, ttl 64, id 22358, offset 0, flags [DF], proto TCP (6), length 375)
          10.46.xxx.10001 > 10.52.xxx.54863: Flags [P.], cksum 0xcdcc (incorrect -> 0x9af3), seq 1:336, ack 9, win 229, length 335
      16:26:11.922274 IP (tos 0x0, ttl 124, id 24783, offset 0, flags [DF], proto TCP (6), length 383)
          10.52.xxx.54863 > 10.46.xxx.10001: Flags [P.], cksum 0xdd67 (correct), seq 9:352, ack 336, win 255, length 343
      16:26:11.922641 IP (tos 0x0, ttl 64, id 22359, offset 0, flags [DF], proto TCP (6), length 60)
          10.46.xxx.10001 > 10.52.xxx.54863: Flags [P.], cksum 0xcc91 (incorrect -> 0x3f4b), seq 336:356, ack 352, win 245, length 20
      16:26:11.930087 IP (tos 0x0, ttl 124, id 24785, offset 0, flags [DF], proto TCP (6), length 60)
          10.52.xxx.54863 > 10.46.xxx.10001: Flags [P.], cksum 0x3e2d (correct), seq 352:372, ack 356, win 255, length 20
      16:26:11.931843 IP (tos 0x0, ttl 124, id 24786, offset 0, flags [DF], proto TCP (6), length 89)
          10.52.8xxx54863 > 10.46.xxx.10001: Flags [P.], cksum 0x7ac9 (correct), seq 372:421, ack 356, win 255, length 49
      16:26:11.932006 IP (tos 0x0, ttl 64, id 22360, offset 0, flags [DF], proto TCP (6), length 40)
          10.46.xxx.10001 > 10.52.xxx.54863: Flags [.], cksum 0xcc7d (incorrect -> 0x76dc), seq 356, ack 421, win 245, length 0
      
      >>>>> Here’s where the disconnect happens and sends this response
      
      16:26:14.933074 IP (tos 0x0, ttl 64, id 22361, offset 0, flags [DF], proto TCP (6), length 40)
          10.46.xxx.10001 > 10.52.xxx.54863: Flags [F.], cksum 0xcc7d (incorrect -> 0x76db), seq 356, ack 421, win 245, length 0
      16:26:14.935598 IP (tos 0x0, ttl 124, id 24796, offset 0, flags [DF], proto TCP (6), length 40)
          10.52.xxx54863 > 10.46.xxx.10001: Flags [.], cksum 0x76d1 (correct), seq 421, ack 357, win 255, length 0
      16:26:14.943023 IP (tos 0x0, ttl 124, id 24798, offset 0, flags [DF], proto TCP (6), length 40)
          10.52.xxx.54863 > 10.46.xxx.10001: Flags [F.], cksum 0x76d0 (correct), seq 421, ack 357, win 255, length 0
      16:26:14.943043 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
          10.46.xxx10001 > 10.52.xxx.54863: Flags [.], cksum 0x76da (correct), seq 357, ack 422, win 245, length 0
      Localhost works fine, so I'm looking into this network issue further.

      Comment


      • #4
        This issue is nothing to do with the network afterall...it was confiruration.

        There should be no forward slash in this line:

        Code:
        connectionFactory.setVirtualHost("/ve2b460e7e6b24b5da88c935df63c4e86");
        I had just copied it from the URL of the server and neglected to pull that off. On localhost, I didn't have virtual host, so that explains why it worked there.

        Comment


        • #5
          Cool; thanks for the update; I am sure it will help someone in the future.

          Comment

          Working...
          X