R
Railway6mo ago
ٴٴٴ

Java Spring Boot deployment error

I have deployed my back-end, first it was java version 20, and i get error of unsuported version i changed it to 19, now i get errors regarding lombook anotation example: /app/src/main/java/org/example/Barter/BarterDTO.java:[34,25] cannot find symbol #10 14.59 [ERROR] symbol: method builder() #10 14.59 [ERROR] location: class org.example.Barter.BarterDTO #10 14.59 [ERROR] /app/src/main/java/org/example/Barter/BarterDTO.java:[35,27] cannot find symbol #10 14.59 [ERROR] symbol: method getId() #10 14.59 [ERROR] location: variable barter of type org.example.Barter.Barter #10 14.59 [ERROR] /app/src/main/java/org/example/Barter/BarterDTO.java:[36,63] cannot find symbol #10 14.59 [ERROR] symbol: method getOfferedId()
20 Replies
Percy
Percy6mo ago
Project ID: N/A
ٴٴٴ
ٴٴٴ6mo ago
N/A
root
root6mo ago
Are you using Nixpacks or a custom Dockerfile?
ٴٴٴ
ٴٴٴ6mo ago
Custom dockerfile:
FROM openjdk:19
ADD ./docker-spring-boot.jar docker-spring-boot.jar
ENTRYPOINT ["java", "-jar", "docker-spring-boot.jar"]
FROM openjdk:19
ADD ./docker-spring-boot.jar docker-spring-boot.jar
ENTRYPOINT ["java", "-jar", "docker-spring-boot.jar"]
root
root6mo ago
Are you building your app in the Dockerfile or manually?
ٴٴٴ
ٴٴٴ6mo ago
manually
root
root6mo ago
Why?
ٴٴٴ
ٴٴٴ6mo ago
I am new in docker and deployment it's my first time, so idk how to do it correctly, just what i see in youtube and documentation ( Can we get a call? if it's possible?
root
root6mo ago
Please don't do that. Here's a Dockerfile that should work out of the box:
FROM eclipse-temurin:19-jdk AS build
COPY . /app
WORKDIR /app
RUN ./gradlew bootJar
RUN mv -f build/libs/*.jar app.jar

FROM eclipse-temurin:19-jre
ARG PORT
ENV PORT=${PORT}
COPY --from=build /app/app.jar .
RUN useradd runtime
USER runtime
ENTRYPOINT [ "java", "-Dserver.port=${PORT}", "-jar", "app.jar" ]
FROM eclipse-temurin:19-jdk AS build
COPY . /app
WORKDIR /app
RUN ./gradlew bootJar
RUN mv -f build/libs/*.jar app.jar

FROM eclipse-temurin:19-jre
ARG PORT
ENV PORT=${PORT}
COPY --from=build /app/app.jar .
RUN useradd runtime
USER runtime
ENTRYPOINT [ "java", "-Dserver.port=${PORT}", "-jar", "app.jar" ]
Also, you shouldn't be getting unsupported version errors with Java 20 - it's perfectly well supported.
ٴٴٴ
ٴٴٴ6mo ago
one second
ٴٴٴ
ٴٴٴ6mo ago
No description
root
root6mo ago
Oh, you're using Maven
ٴٴٴ
ٴٴٴ6mo ago
yep
root
root6mo ago
that's a whole 'nother can of bean-shaped worms Would it be possible for you to use gradle?
ٴٴٴ
ٴٴٴ6mo ago
i should refactor whole project 😭
root
root6mo ago
I'm afraid I can't really help you if you're using maven, I don't know much about it and I don't really want to touch it
ٴٴٴ
ٴٴٴ6mo ago
that is the problem with maven?
root
root6mo ago
It's very slow and kind of outdated You should be able to start a new Spring Boot project with either https://railway.app/template/Wm9zSM or Spring Initializr and then copy your source files in, and it should basically work Using Gradle shouldn't really require code changes
ٴٴٴ
ٴٴٴ6mo ago
Oh, nice thanks, i will still try to do it with maven, but next projects i will use gradle, thank you a lot
root
root6mo ago
no problem