root dir - procfile web: java $PORT $JAVA_OPTS -jar target/backend-0.0.1-SNAPSHOT.jar
resources dir - application.yml server: port: "${port:8080}"
I set above options but I found another ports Is there anyway?
CodePudding user response:
Don't pass the port to java
. The java
binary is trying to find a class with that name:
Error: Could not find or load main class 35913
So, remove it from your Procfile
:
web: java $JAVA_OPTS -jar target/backend-0.0.1-SNAPSHOT.jar
Java is a general-purpose programming language and does not know what to do with a port. It doesn't run a web server unless you tell it to. Instead, you need to pass it to whatever web server you are running.
You appear to be trying to do that in your application.yml
file, but make sure to use PORT
instead of port
:
server: port: "${PORT:8080}"
Environment variables are case-sensitive on most non-Microsoft systems.