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?