Reputation: 135
I am building an application that uploads files to Postgres with a Gradle Kotlin Spring Boot Backend. I build it locally and everything worked fine now I wanted to deploy the backend to Heroku. I added the Heroku Postgres Ressources and updated my application.properties and tested the DB connection with IntelliJ and it seems to be working.
Now when I deploy it and open my URL I get an Application error. In my console I see
GET https://unsplasy-backend.herokuapp.com/ 503 (Service Unavailable)
favicon.ico:1 GET https://unsplasy-backend.herokuapp.com/favicon.ico 503 (Service Unavailable)
After running heroku logs --tail I get the following output
2021-04-19T11:08:01.056208+00:00 app[web.1]: at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
2021-04-19T11:08:01.126263+00:00 heroku[web.1]: Process exited with status 1
2021-04-19T11:08:01.203810+00:00 heroku[web.1]: State changed from starting to crashed
2021-04-19T11:08:03.074812+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=unsplasy-backend.herokuapp.com request_id=58e31d19-484f-44e5-b5b0-ba39931a10c4 fwd="45.86.203.98" dyno= connect= service= status=503 bytes= protocol=https
2021-04-19T11:08:03.513057+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=unsplasy-backend.herokuapp.com request_id=256e63d5-77de-46f9-9062-f21880e2c964 fwd="45.86.203.98" dyno= connect= service= status=503 bytes= protocol=https
2021-04-19T11:08:10.824894+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=unsplasy-backend.herokuapp.com request_id=2225a1d2-28fd-4d21-b9f9-6017da94540e fwd="45.86.203.98" dyno= connect= service= status=503 bytes= protocol=https
2021-04-19T11:08:11.203409+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=unsplasy-backend.herokuapp.com request_id=b4861295-84c0-4393-9869-8ba9ca1eb5d0 fwd="45.86.203.98" dyno= connect= service= status=503 bytes= protocol=https
2021-04-19T11:08:23.000000+00:00 app[api]: Build succeeded
2021-04-19T11:09:22.000000+00:00 app[api]: Build started by user [email protected]
2021-04-19T11:10:17.835261+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=unsplasy-backend.herokuapp.com request_id=b4c155c0-ba77-4796-b570-d61e6b5c7582 fwd="45.86.203.98" dyno= connect= service= status=503 bytes= protocol=https
2021-04-19T11:10:18.234507+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=unsplasy-backend.herokuapp.com request_id=21e5b9d2-ba5f-4b56-9733-1120855e7831 fwd="45.86.203.98" dyno= connect= service= status=503 bytes= protocol=https
2021-04-19T11:10:29.554184+00:00 app[api]: Deploy 808fbdd5 by user [email protected]
2021-04-19T11:10:29.554184+00:00 app[api]: Release v11 created by user [email protected]
2021-04-19T11:10:30.764211+00:00 heroku[web.1]: State changed from crashed to starting
2021-04-19T11:10:34.769023+00:00 heroku[web.1]: Starting process with command `java -Dserver.port=7456 $JAVA_OPTS -jar build/libs/*.jar`
2021-04-19T11:10:37.737112+00:00 app[web.1]: Create a Procfile to customize the command used to run this process: https://devcenter.heroku.com/articles/procfile
2021-04-19T11:10:37.754141+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2021-04-19T11:10:37.757609+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2021-04-19T11:10:38.302494+00:00 app[web.1]: Exception in thread "main" java.lang.UnsupportedClassVersionError: mbraun/unsplasy/UnsplasyApplicationKt has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
2021-04-19T11:10:38.302797+00:00 app[web.1]: at java.lang.ClassLoader.defineClass1(Native Method)
2021-04-19T11:10:38.302798+00:00 app[web.1]: at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
2021-04-19T11:10:38.302799+00:00 app[web.1]: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
2021-04-19T11:10:38.302800+00:00 app[web.1]: at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
2021-04-19T11:10:38.302836+00:00 app[web.1]: at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
2021-04-19T11:10:38.302883+00:00 app[web.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
2021-04-19T11:10:38.302918+00:00 app[web.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
2021-04-19T11:10:38.302993+00:00 app[web.1]: at java.security.AccessController.doPrivileged(Native Method)
2021-04-19T11:10:38.303057+00:00 app[web.1]: at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
2021-04-19T11:10:38.303149+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
2021-04-19T11:10:38.303225+00:00 app[web.1]: at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
2021-04-19T11:10:38.303316+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
2021-04-19T11:10:38.303318+00:00 app[web.1]: at java.lang.Class.forName0(Native Method)
2021-04-19T11:10:38.303413+00:00 app[web.1]: at java.lang.Class.forName(Class.java:348)
2021-04-19T11:10:38.303415+00:00 app[web.1]: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:46)
2021-04-19T11:10:38.303461+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
2021-04-19T11:10:38.303548+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
2021-04-19T11:10:38.303608+00:00 app[web.1]: at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
2021-04-19T11:10:38.367928+00:00 heroku[web.1]: Process exited with status 1
2021-04-19T11:10:38.426299+00:00 heroku[web.1]: State changed from starting to crashed
2021-04-19T11:10:38.816929+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=unsplasy-backend.herokuapp.com request_id=0d92e58d-9078-4909-9997-d8a806d124bd fwd="45.86.203.98" dyno= connect= service= status=503 bytes= protocol=https
2021-04-19T11:10:39.184155+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=unsplasy-backend.herokuapp.com request_id=ab885968-5f0c-4a7d-b844-1d9074b4ab45 fwd="45.86.203.98" dyno= connect= service= status=503 bytes= protocol=https
2021-04-19T11:11:03.000000+00:00 app[api]: Build succeeded
2021-04-19T11:16:52.131964+00:00 heroku[web.1]: State changed from crashed to starting
2021-04-19T11:16:56.540255+00:00 heroku[web.1]: Starting process with command `java -Dserver.port=38647 $JAVA_OPTS -jar build/libs/*.jar`
2021-04-19T11:16:58.584422+00:00 app[web.1]: Create a Procfile to customize the command used to run this process: https://devcenter.heroku.com/articles/procfile
2021-04-19T11:16:58.600495+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2021-04-19T11:16:58.603888+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2021-04-19T11:16:59.012658+00:00 app[web.1]: Exception in thread "main" java.lang.UnsupportedClassVersionError: mbraun/unsplasy/UnsplasyApplicationKt has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
2021-04-19T11:16:59.012878+00:00 app[web.1]: at java.lang.ClassLoader.defineClass1(Native Method)
2021-04-19T11:16:59.012976+00:00 app[web.1]: at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
2021-04-19T11:16:59.013043+00:00 app[web.1]: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
2021-04-19T11:16:59.013109+00:00 app[web.1]: at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
2021-04-19T11:16:59.013188+00:00 app[web.1]: at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
2021-04-19T11:16:59.013259+00:00 app[web.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
2021-04-19T11:16:59.013329+00:00 app[web.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
2021-04-19T11:16:59.014247+00:00 app[web.1]: at java.security.AccessController.doPrivileged(Native Method)
2021-04-19T11:16:59.014248+00:00 app[web.1]: at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
2021-04-19T11:16:59.014248+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
2021-04-19T11:16:59.014249+00:00 app[web.1]: at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
2021-04-19T11:16:59.014249+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
2021-04-19T11:16:59.014250+00:00 app[web.1]: at java.lang.Class.forName0(Native Method)
2021-04-19T11:16:59.014251+00:00 app[web.1]: at java.lang.Class.forName(Class.java:348)
2021-04-19T11:16:59.014350+00:00 app[web.1]: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:46)
2021-04-19T11:16:59.014351+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
2021-04-19T11:16:59.014351+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
2021-04-19T11:16:59.014351+00:00 app[web.1]: at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
2021-04-19T11:16:59.228371+00:00 heroku[web.1]: Process exited with status 1
2021-04-19T11:16:59.327826+00:00 heroku[web.1]: State changed from starting to crashed
2021-04-19T11:16:59.332351+00:00 heroku[web.1]: State changed from crashed to starting
2021-04-19T11:17:04.242879+00:00 heroku[web.1]: Starting process with command `java -Dserver.port=17021 $JAVA_OPTS -jar build/libs/*.jar`
2021-04-19T11:17:07.238276+00:00 app[web.1]: Create a Procfile to customize the command used to run this process: https://devcenter.heroku.com/articles/procfile
2021-04-19T11:17:07.268382+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2021-04-19T11:17:07.272732+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2021-04-19T11:17:07.767002+00:00 app[web.1]: Exception in thread "main" java.lang.UnsupportedClassVersionError: mbraun/unsplasy/UnsplasyApplicationKt has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
2021-04-19T11:17:07.767483+00:00 app[web.1]: at java.lang.ClassLoader.defineClass1(Native Method)
2021-04-19T11:17:07.767673+00:00 app[web.1]: at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
2021-04-19T11:17:07.767796+00:00 app[web.1]: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
2021-04-19T11:17:07.767953+00:00 app[web.1]: at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
2021-04-19T11:17:07.768085+00:00 app[web.1]: at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
2021-04-19T11:17:07.768273+00:00 app[web.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
2021-04-19T11:17:07.768415+00:00 app[web.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
2021-04-19T11:17:07.768819+00:00 app[web.1]: at java.security.AccessController.doPrivileged(Native Method)
2021-04-19T11:17:07.768945+00:00 app[web.1]: at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
2021-04-19T11:17:07.769079+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
2021-04-19T11:17:07.769225+00:00 app[web.1]: at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
2021-04-19T11:17:07.769353+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
2021-04-19T11:17:07.769510+00:00 app[web.1]: at java.lang.Class.forName0(Native Method)
2021-04-19T11:17:07.769607+00:00 app[web.1]: at java.lang.Class.forName(Class.java:348)
2021-04-19T11:17:07.769982+00:00 app[web.1]: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:46)
2021-04-19T11:17:07.770117+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
2021-04-19T11:17:07.770257+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
2021-04-19T11:17:07.770377+00:00 app[web.1]: at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
2021-04-19T11:17:07.830915+00:00 heroku[web.1]: Process exited with status 1
2021-04-19T11:17:07.943553+00:00 heroku[web.1]: State changed from starting to crashed
2021-04-19T11:18:13.716974+00:00 app[api]: Starting process with command `java -version` by user [email protected]
2021-04-19T11:18:17.924110+00:00 heroku[run.3775]: State changed from starting to up
2021-04-19T11:18:17.990783+00:00 heroku[run.3775]: Awaiting client
2021-04-19T11:18:18.323617+00:00 heroku[run.3775]: Starting process with command `java -version`
2021-04-19T11:18:22.915722+00:00 heroku[run.3775]: Process exited with status 0
2021-04-19T11:18:22.975840+00:00 heroku[run.3775]: State changed from up to complete
I am not quite sure where to start and what the best practice is after doing some research and not finding a solution. Also, I am wondering because I am not using the favicon.icon anywhere and not quite sure where it comes from and if this is the problem?
Do I have to change my Java Runtime version and if so why and what would be the best practice be? Or is there another mistake.
Upvotes: 0
Views: 684
Reputation: 13943
The error points out to the Java version you use: the app requires Java 11 but Heroku runs by default with Java 8
Exception in thread "main" java.lang.UnsupportedClassVersionError
mbraun/unsplasy/UnsplasyApplicationKt has been compiled by a more recent
version of the Java Runtime (class file version 55.0), this version of the Java
Runtime only recognizes class file versions up to 52.0
In the root folder create a file called system.properties
:
java.runtime.version=11
Upvotes: 1