-1

I've been having this problem for days now. I deploy my server using tomcat7, try to acess it and it gives me a Status 500 - Internal Server Error. https://justpaste.it/3xw20

It has nothing to do with the code as this works on a mac. I have tried to downgrade my java to java11 and I think I have it but I'm not sure? As further down the error is "(...) has been compiled by a more recent version of Java Runtime (...)

I've literally tried so many things... mvn clean, restarting everything, environment variables, dependencies, etc... The only thing that comes to mind is possibly different versions of Intellij, java? But I don't know how to fix that.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • Make sure the JDK used to run Tomcat is the same as was used to build your code. – CrazyCoder Dec 13 '19 at 22:58
  • @CrazyCoder How do I check that and change it to the same one? I've searched everywhere... As I show in the image I think my jdk is the same version as where I created the project, unless that's not where I change it. – Karolis Vaitkevicius Dec 14 '19 at 15:19
  • JDK version/language level used to build can be changed as shown on the screenshots in this answer: https://stackoverflow.com/a/12900859/104891. JDK version used to run Tomcat will be the project JDK by default, but it's possible that it got overridden either in the run/debug configuration JRE field or in your Tomcat startup script. Try a vanilla Tomcat installation in the latter case. – CrazyCoder Dec 14 '19 at 15:22

1 Answers1

0

By "this works on a mac" if you mean that it works locally then try updating the version of Java on the server that you are running your Tomcat 7 and you application on.

UnsupportedClassVersionError occurs when you compile with one version of Java and execute with an older version. You can try this out by maven installing with one java version and setting your intellij preferences to run the app on an older version.

  • It works on the mac where I created the project which has jdk 11. When I import project and run the server on my windows this is the error I get. Sorry, I don't understand what you mean by maven installing with one version... – Karolis Vaitkevicius Dec 14 '19 at 15:17
  • Check the java installed on your Windows. It is likely a version lesser than 11. If so, upgrade your Windows to Java 11 and restart your Tomcat so it is now running with 11 and then re-import your project. – theintergalacticat Dec 15 '19 at 00:27