Spring application on Metal keeps crashing
ricardomello
HOBBYOP

10 months ago

Hi, I migrated my spring application to Metal a couple of weeks ago and now the deployment keeps crashing with this error:

org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.micrometer.core.instrument.binder.system.ProcessorMetrics]: Factory method 'processorMetrics' threw exception with message: Cannot invoke "jdk.internal.platform.CgroupInfo.getMountPoint()" because "anyController" is null.

The same code was running without any issues on the legacy servers, since I can't go back to the legacy servers my application is now unavailable. Is there a different config needed for Metal? Thanks.

Solved$10 Bounty

Pinned Solution

10 months ago

I would recommend upgrading to at least Java 21. 21 is latest LTS, so you should probably be on it anyway. I see many people with this issue on this image of Java 17 and none on Java 21.

9 Replies

10 months ago

Hey! Are you using your own dockerfile or any of the railway included builders like Nixpacks or Railpack?w


ricardomello
HOBBYOP

10 months ago

I'm using my own dockerfile


10 months ago

Looks like its trying to get a controller that doesn't exist, which is what I think is for performance instrumentation. Do you have any more logs?


ricardomello
HOBBYOP

10 months ago

This is the only relevant part of the log, it repeats itself a couple of times.

I've tried removing all the performance related dependencies, and disabling spring's performance metrics with:

management.metrics.enable.processor: false

But it doesn't change anything


10 months ago

Can you share your Dockerfile? I see a few reports of this happening with outdated version of JDK.


ricardomello
HOBBYOP

10 months ago

This is the dockerfile:

FROM gradle:8.2.1 AS build
COPY --chown=gradle:gradle . /home/gradle/src
WORKDIR /home/gradle/src
RUN gradle bootJar

FROM openjdk:17-jdk-slim-buster
EXPOSE 8080
COPY --from=build /home/gradle/src/build/libs/backend-1.0.0.jar /app/
RUN bash -c 'touch /app/backend-1.0.0.jar'
ENTRYPOINT ["java","-jar","/app/backend-1.0.0.jar"]

10 months ago

I would recommend upgrading to at least Java 21. 21 is latest LTS, so you should probably be on it anyway. I see many people with this issue on this image of Java 17 and none on Java 21.


ricardomello
HOBBYOP

10 months ago

That solved it, thanks!


10 months ago

Glad to hear it!


Status changed to Solved medim 10 months ago


Loading...