Search code examples
javaamqpwindows-serverservicebus

Socket closed when connecting windows service bus using amqp from Java


I am trying to connect to service bus for windows server using the Java example which is provided on Microsoft website.

Below are the libraries I am using for this POC

     <dependency>
        <groupId>org.apache.qpid</groupId>
        <artifactId>qpid-jms-client</artifactId>
        <version>0.26.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.qpid</groupId>
        <artifactId>qpid-amqp-1-0-client-jms</artifactId>
        <version>0.32</version>
    </dependency>

Below is the connection string format I am using

  return "amqps://" + SbSharedKey + ":" + SbSharedSecret + "@" + SbDomain + "/" + SbNamespace;

I have the exact same code as is there on the website, but is giving below error

Initial setup Creating context Creating connection factory Creating connection

Creating session Exception creating session/producer

java.net.SocketException: Socket Closed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) javax.jms.JMSException: class java.net.SocketException: Connection closed by remote hostclass java.net.SocketException: Connection closed by remote host at java.net.SocketInputStream.read(SocketInputStream.java:170) at java.net.SocketInputStream.read(SocketInputStream.java:141) at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) at

Process finished with exit code 0

I tried to do SSLPoke and it is giving a success,

So issue is only with AMQP side it seems.

Can you please point me to the correct version of libraries to use when connecting to a Windows server service bus using amqp from Java?


Solution

  • I was able to solve the issue using below versions of jar's

        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-jms_1.1_spec</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.qpid</groupId>
            <artifactId>qpid-amqp-1-0-client-jms</artifactId>
            <version>0.22</version>
        </dependency>