Tajib Smajlović
Tajib Smajlović

Reputation: 79

"Can't start redis server" exception occurs when trying to run Spring Boot on my MacBook M1 (Sonoma 14.0)

When I try to run my Spring Boot app using IntelliJ IDE, everything builds properly and no warning and errors are show. Once the app starts running the following runtime exception occurs:

Can't start redis server. Check logs for details. Redis process log:

This is the line where the exception is thrown:

enter image description here

The funny thing is that outputStringBuffer.toString() returns empty string.

Now, I am running Redis via the Docker. Now to be sure that the Redis is indeed up and running and that there is no issue with the Docker, I added Redis as a database in IntelliJ IDE and when I execute the following command: SET 'foo' 'bar' the appropriate key/value data was added successfully.

enter image description here

I even tried to install and run Redis locally but nothing changed, I still received the same error as above.

I double checked that every possible configuration is OK and indeed it is. I can connect to Redis via IntelliJ and DBeaver but I cannot connect it from my Spring Boot appplication.

Upvotes: 2

Views: 6066

Answers (3)

Andrea Leganza
Andrea Leganza

Reputation: 477

In my case on Mac OS (on different versions) the solution was simply: restart the computer. It fixed my problem always with working copies of the project which stopped to start without a reason reporting that error.

I tried some time to change the port number but it didn't fix, so restarting fixed, at least for project where the project did worked without any change/upgrade.

Upvotes: 0

Bojan Trajkovski
Bojan Trajkovski

Reputation: 1176

After upgrading to MacOS Sonoma (v14.x) I've had the same issue. Its a common problem which is reported here

Fix that worked for me is to use different and upgraded repo for Redis embedded server: com.github.codemonstur:embedded-redis:1.0.0

Link to mvnrepostiory

Upvotes: 5

dean7
dean7

Reputation: 23

Did you configure the application.yml file to load your redis server's host, port and password? For example:

Spring:
  redis:
    host: 192.168.150.123
    port: 6379
    password: abcdef
    database: 2
    timeout: 30000ms
    lettuce:
      pool:
        max-active: -1
        max-idle: 500

Upvotes: 1

Related Questions