1

While Connecting to a Sonic Broker i do like below which works fine,

        TopicConnectionFactory factory = new progress.message.jclient.TopicConnectionFactory(brokerURL);
        TopicConnection connection = factory.createTopicConnection(brokerUserName, brokerPassword);

        javax.jms.TopicSession subSession = (TopicSession) connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

        javax.jms.Topic topic = subSession.createTopic(topicNameToListen);
        MessageConsumer subscriber = subSession.createSubscriber(topic);
        subscriber.setMessageListener(msgListener);
        connection.start();

So while doing it using spring boot i did,

@Bean
TopicConnectionFactory connectionFactory() throws JMSException {
    TopicConnectionFactory factory = new progress.message.jclient.TopicConnectionFactory(brokerURL);
    TopicConnection connection = factory.createTopicConnection(brokerUserName, brokerPassword);
    connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
    return factory;
}

@Bean
JmsListenerContainerFactory<?> myJmsContainerFactory(ConnectionFactory connectionFactory) {
    SimpleJmsListenerContainerFactory factory = new SimpleJmsListenerContainerFactory();
    factory.setConnectionFactory(connectionFactory);
    return factory;
}

@JmsListener(destination = "topic.name.for.receiving.message", containerFactory = "myJmsContainerFactory")
public void messageReceiver(String message) {
    LogService.info(this.getClass().getName(), "A Message Received");
    LogService.info(this.getClass().getName(), message);
}

But if i run this, i get Exception,

javax.jms.JMSSecurityException: Inauthentic Client
at progress.message.jimpl.JMSExceptionUtil.createJMSSecurityException(JMSExceptionUtil.java:134)
at progress.message.jimpl.JMSExceptionUtil.createJMSSecurityException(JMSExceptionUtil.java:117)
at progress.message.jimpl.JMSExceptionUtil.createJMSSecurityException(JMSExceptionUtil.java:103)
at progress.message.jimpl.Connection.<init>(Connection.java:836)
at progress.message.jclient.ConnectionFactory.createConnection(ConnectionFactory.java:2110)
at progress.message.jclient.ConnectionFactory.createConnection(ConnectionFactory.java:2083)

Note: I have checked credentials many times and also ran it with the previous code, it works fine.Also i have added sonic_Client.jar, sonic_Crypto.jar and sonic_XMessage.jar. If i try with spring boot i get this error.

What can be the cause of this?

cahen
  • 15,807
  • 13
  • 47
  • 78
Rajkishan Swami
  • 3,569
  • 10
  • 48
  • 68
  • The second bean is useless. We'll just bind to whatever `ConnectionFactory` is available. The first bean is very weird. You're creating a connection and a session and then you don't do anything with it. You need to set the `spring.jms.pub-sub-domain=true` since it's a topic. The authentication issue has nothing to do with Spring Boot. You need to look closely at your code. – Stephane Nicoll Aug 14 '15 at 12:16
  • @StéphaneNicoll : I removed the unnecessary bean and the application starts now. But timed jms connection refresher cannot not resolve the destination. I think i misunderstood `destination`. I took it for a topic name.. How wrong i am? – Rajkishan Swami Aug 14 '15 at 12:35
  • is that the name of your topic? I don't know how SonicMQ resolves its destination. Maybe you need to define a `DestinationResolver`? Anyway, your original question does not match your situation so you should probably rephrase it. – Stephane Nicoll Aug 14 '15 at 14:13

0 Answers0