harishr
harishr

Reputation: 18055

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?

Upvotes: 0

Views: 817

Answers (2)

harishr
harishr

Reputation: 18055

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>

Upvotes: 0

Tim Bish
Tim Bish

Reputation: 18356

You are using two different AMQP JMS client library dependencies on your project so I've no idea what's really going on, but my first guess is that you end up using the legacy 'qpid-amqp-1-0-client-jms' client which is not supported and definitely not going to work. I'd remove that and try to get things going with just the Qpid JMS 0.26.0 client library, although I believe there's some other URI options you might need as azure has some specific requirements in order to connect.

Upvotes: 1

Related Questions