R
Railway12mo 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
Percy12mo ago
Project ID: N/A
ٴٴٴ
ٴٴٴOP12mo ago
N/A
root
root12mo ago
Are you using Nixpacks or a custom Dockerfile?
ٴٴٴ
ٴٴٴOP12mo 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
root12mo ago
Are you building your app in the Dockerfile or manually?
ٴٴٴ
ٴٴٴOP12mo ago
manually
root
root12mo ago
Why?
ٴٴٴ
ٴٴٴOP12mo 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
root12mo 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.
ٴٴٴ
ٴٴٴOP12mo ago
one second
ٴٴٴ
ٴٴٴOP12mo ago
No description
root
root12mo ago
Oh, you're using Maven
ٴٴٴ
ٴٴٴOP12mo ago
yep
root
root12mo ago
that's a whole 'nother can of bean-shaped worms Would it be possible for you to use gradle?
ٴٴٴ
ٴٴٴOP12mo ago
i should refactor whole project 😭
root
root12mo 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
ٴٴٴ
ٴٴٴOP12mo ago
that is the problem with maven?
root
root12mo 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
ٴٴٴ
ٴٴٴOP12mo 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
root12mo ago
no problem
Want results from more Discord servers?
Add your server