Log4j dependency keeps crashing rabbitmq

173 views
Skip to first unread message

Asal Jalilvand

unread,
May 12, 2019, 2:32:50 AM5/12/19
to rabbitmq-users
I have a spring-boot application which works with a rabbitmq running on the same server. Had no problem until I had to add log4j2 dependencies to my project and I kept getting `access to vhost '/' refused for user 'guest': vhost '/' is down ` error.

After checking the rabbit server status, making sure it's up and running and the given vhost exists,and playing around with different dependencies, I noticed the error only happens after inserting the log4j2 dependencies. 

*** When I use a rabbitmq installed on a different server, the error is gone and the program works fine. But I need to have them both on the same server and I'm absolutely clueless why this error happens and how should I fix it. Also trying out different versions and respecting the version compatibility between them was no help either. 

I have to note that log4j2 is crusial for one of the components of the project and I don't have the option of replacing it.

here are the dependencies which I assume are conflicting:

Rabbitmq
<dependency>
            <groupId>org.springframework.amqp</groupId>
            <artifactId>spring-amqp</artifactId>
            <version>1.7.0.RELEASE</version>
</dependency>

<dependency>
            <groupId>org.springframework.amqp</groupId>
            <artifactId>spring-rabbit</artifactId>
            <version>1.7.0.RELEASE</version>
</dependency>


Logging
<dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.10.0</version>
</dependency>

<dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.10.0</version>
</dependency>


and here is the dependency which I think may be related:

<dependency>           
             <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>1.5.1.RELEASE</version>
</dependency>


I would really apprecieate it if you helped me out with this situation. Thank you in advance!

Martin Schröder

unread,
May 12, 2019, 6:32:08 AM5/12/19
to rabbitm...@googlegroups.com
Am So., 12. Mai 2019 um 08:32 Uhr schrieb Asal Jalilvand
<asal.ja...@gmail.com>:
> I have a spring-boot application which works with a rabbitmq running on the same server. Had no problem until I had to add log4j2 dependencies to my project and I kept getting `access to vhost '/' refused for user 'guest': vhost '/' is down ` error.

Most likely your Java application and RabbitMQ try to work on the same port.
Set the server port of your Java application to something different.

Best
Martin

PS: Questions like these are AFAIK inappropriate for this list; try
stackoverflow instead.

Asal Jalilvand

unread,
May 13, 2019, 12:19:32 AM5/13/19
to rabbitmq-users
Thank you for your response,
when I remove log4j dependency, rabbitmq works fine on the same server the application is running. I think if it was the matter of identical ports, it should have reported an error in the first place. My application runs on port 9020 whereas rabbitmq (ampq for spring) is listening on 5672. I also commented out rabbitmq configuration in the application and ran it with log4j, while rabbit was still listening to port 5672, and no errors occurred. Access error only happens when I want to use rabbit and log4j together and I'm not an expert in neither of them to know what's going on in the background that's causing this problem.

Arnaud Cogoluègnes

unread,
May 13, 2019, 8:58:09 AM5/13/19
to rabbitm...@googlegroups.com
Please post a full pom.xml and some steps to reproduce the problem.
> --
> You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
> To post to this group, send email to rabbitm...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/492ea3ec-7e4e-45a6-8dea-dfbaac26dcf3%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Asal Jalilvand

unread,
May 14, 2019, 1:08:40 AM5/14/19
to rabbitmq-users
Recently I upgraded elasticsearch 2.4 to 7.0, and had to add log4j dependencies to have it working. Unfortunately, I keep getting exceptions (attached) regarding vhost. When I comment out log4j, ampq works perfectly fine. All this happen when I'm trying to run everything on one server. When I change ampq's default settings to connect to another rabbitmq server on another host (that is, server, port, username, password), I can have everything work properly without a problem.  

Regarding the exception, I have checked the list of vhosts and rabbitmq status and everything's up and running.

Sorry about asking spring related problems here, I've already asked on Stackoverflow but didn't receive any response. Thank you for your time.


On Monday, May 13, 2019 at 5:28:09 PM UTC+4:30, Arnaud Cogoluègnes wrote:
Please post a full pom.xml and some steps to reproduce the problem.

On Mon, May 13, 2019 at 6:19 AM Asal Jalilvand
<asal.ja...@gmail.com> wrote:
>
> Thank you for your response,
> when I remove log4j dependency, rabbitmq works fine on the same server the application is running. I think if it was the matter of identical ports, it should have reported an error in the first place. My application runs on port 9020 whereas rabbitmq (ampq for spring) is listening on 5672. I also commented out rabbitmq configuration in the application and ran it with log4j, while rabbit was still listening to port 5672, and no errors occurred. Access error only happens when I want to use rabbit and log4j together and I'm not an expert in neither of them to know what's going on in the background that's causing this problem.
>
> On Sunday, May 12, 2019 at 3:02:08 PM UTC+4:30, Martin Schröder wrote:
>>
>> Am So., 12. Mai 2019 um 08:32 Uhr schrieb Asal Jalilvand
>> <asal.ja...@gmail.com>:
>> > I have a spring-boot application which works with a rabbitmq running on the same server. Had no problem until I had to add log4j2 dependencies to my project and I kept getting `access to vhost '/' refused for user 'guest': vhost '/' is down ` error.
>>
>> Most likely your Java application and RabbitMQ try to work on the same port.
>> Set the server port of your Java application to something different.
>>
>> Best
>>     Martin
>>
>> PS: Questions like these are AFAIK inappropriate for this list; try
>> stackoverflow instead.
>
> --
> You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rabbitm...@googlegroups.com.
pom.xml
ApplicationConfiguration.java
rabbitmq exception.txt

Michael Klishin

unread,
May 14, 2019, 3:32:08 AM5/14/19
to rabbitmq-users
> access to vhost '/' refused for user 'guest'

is the line you are looking for. See [1] and `rabbitmqctl list_permissions`.


To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.

To post to this group, send email to rabbitm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Asal Jalilvand

unread,
May 14, 2019, 3:40:54 AM5/14/19
to rabbitmq-users
guest user has all permissions.

Listing permissions for vhost "/" ...
user configure write read
guest .* .* .*

I had searched for solutions to the given exception, and giving all permissions was one of them. however, the problem still persists.

Michael Klishin

unread,
May 14, 2019, 3:54:09 AM5/14/19
to rabbitmq-users
I see

> access to vhost '/' refused for user 'guest': vhost '/' is down

in the original message now. A virtual host is unavailable due to an exception (server logs would reveal what it is). The easiest option is to restart  the node.

To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.

To post to this group, send email to rabbitm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Asal Jalilvand

unread,
May 15, 2019, 1:40:18 AM5/15/19
to rabbitmq-users
I've tried rabbitmqctl stop and rabbitmqctl start_app and it didn't help.

I noticed spring-rabbit requires a log4j , I'm wondering whether it conflicts with the log4j2 I've added to my dependencies. Do you think the versions all conflicting? Should I exclude log4j from spring-rabbit? I'm suspecting this conflict the most because rabbitmq only reports access errors when log4j2 is added to pom.xml

Michael Klishin

unread,
May 15, 2019, 3:21:24 AM5/15/19
to rabbitmq-users
The exception is from a stateful component inside RabbitMQ server. Log4J versions cannot possibly affect this.

`rabbitmqctl start_app` won't start a completely stopped node (including the runtime). Use the service manager or sbin/rabbitmq-server if running
with a generic binary build.

I cannot suggest much more without server logs. Consider sharing them.

To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.

To post to this group, send email to rabbitm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages