0

I have SpringBoot Application in which dealing with RabbiMQ. It is basically Apache Camel project on top of SpringBootApplication.

SpringBoot application is packaged and given to us as .jar

In src/main/resources I have a config. file by name,- queue-config-per-pod.json there I have a configurability for RabbiMQ. You can see that over here.

{
    "stageln": {
        "ip": "xx.xx.xx.xxx",
        "port": "5672",
        "user": "anand",
        "password": "system123lfy$"
    },
    "www9": {
        "ip": "10.10.6.63",
        "port": "5672",
        "user": "",
        "password": ""
    }
}

Now, I have problem in deleting default guest account. If I do so I am getting following Warning in my SpringBoot startup and consecutively SpringBootApplication also stops running, what could be the issue.

[WARNING] 
java.lang.reflect.InvocationTargetException
    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.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:496)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.context.ApplicationContextException: Failed to start bean 'container'; nested exception is org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startup
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:176)
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51)
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346)
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149)
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:879)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)
    at com.sellerworx.Application.main(SourceFile:34)
    ... 6 more
Caused by: org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startup
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doStart(SimpleMessageListenerContainer.java:846)
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.start(AbstractMessageListenerContainer.java:551)
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:173)
    ... 19 more
Caused by: org.springframework.amqp.rabbit.listener.exception.FatalListenerStartupException: Authentication failure
    at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:476)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1306)
    ... 1 more
Caused by: org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
    at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:65)
    at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:306)
    at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:547)
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:90)
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:140)
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:76)
    at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:472)
    ... 2 more
Caused by: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
    at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:349)
    at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:62)
    at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:99)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:911)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:870)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:828)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:996)
    at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:297)
    ... 7 more
Dev Anand Sadasivam
  • 699
  • 7
  • 21
  • 49
  • Initially I was able connect with `IP`, which I got using `ipconfig`. Later I wasn't able connect since when I deleted `guest` account then I configured `loopback` in `etc/rabbitmq.conf`, and I brought back `guest` with password `guest`, it works that time. But without `guest` I am not sure why it is not working. As my code is in jar in obfuscated form, I am not able to explore much weather Authentication Mechanism followed for given json configuration. However as per my observation without `guest` account, my `SpringBootApplication` raise the above error on console & stops working apparently. – Dev Anand Sadasivam May 04 '18 at 10:35
  • By default, the `guest` user is prohibited from connecting to the broker remotely; it can only connect over a `loopback` interface (i.e. `localhost`). This applies both to `AMQP 0-9-1` and to any other protocols enabled via plugins. Any other users you create will not (by default) be restricted in this way. This [excerpt](https://www.rabbitmq.com/access-control.html) I got from RabbitMQ [site](https://www.rabbitmq.com/access-control.html). Its simple as that port `15672` not been exposed over the net, which `Admin Console`,- `port` of `RabbitMQ`. – Dev Anand Sadasivam May 09 '18 at 05:55
  • At oversight I left off not looking at `application.yml`,- spring boot configuration file as it is one time authentication in a `context`. In fact it has `guest/guest` at `localhost` under `rabbitmq:` section, under the `exchange` we were working on. However configuring that over as like `json` didn't turn up as fix. However it could be my scenario or something wan't at the pact of `spring boot context`. – Dev Anand Sadasivam May 15 '18 at 09:08
  • Now I have `guest` account deleted. By mistake I'd corrected `target\classes\application.yml` instead from `src/main/resources`. – Dev Anand Sadasivam May 15 '18 at 09:20

0 Answers0