This is code for connection rabbitmq server:------------
try {
LOGGER.info("Connecting with RabbitMQ...host {} : port {}",this.host,this.port);
this.factory = new ConnectionFactory();
this.factory.setHost(this.host);
if(StringUtils.isNotBlank(this.port)){
this.factory.setPort(Integer.parseInt(this.port));
}
this.factory.setUsername(this.userName);
this.factory.setPassword(this.password);
this.connection = this.factory.newConnection();
} catch (NumberFormatException e) {
LOGGER.error(String.format("Invalid Port Number %s in Configuration",this.port), e);
System.exit(1);
} catch (Exception e){
LOGGER.error("Could not Initialise PublisherConnectionFactory for RabPubSub", e);
System.exit(1);
}
Exception:---------
java.io.IOException: null
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.AMQConnection.start(AMQConnection.java:347)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:516)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:533)
at com.wiziq.pubsub.publisher.core.provider.RabbitMQPublisherProvider.init(RabbitMQPublisherProvider.java:75)
at com.wiziq.pubsub.publisher.Publisher.<init>(Publisher.java:25)
at com.wiziq.pubsub.publisher.PublisherFactory.getPublisher(PublisherFactory.java:22)
at com.wiziq.insight.service.PublishEventServiceImpl.init(PublishEventServiceImpl.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:366)
ect-----------
but will be login on browser UI.