Tomcat Warning: HTTP Status 500 – Internal Server Error

Error: 

 1 HTTP Status 500 – Internal Server Error
 2 Type Exception Report
 3 
 4 Message Error instantiating servlet class [Servlet.BeerSelect]
 5 
 6 Description The server encountered an unexpected condition that prevented it from fulfilling the request.
 7 
 8 Exception
 9 
10 javax.servlet.ServletException: Error instantiating servlet class [Servlet.BeerSelect]
11 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
12 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
13 org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
14 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
15 org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
16 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
17 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:791)
18 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417)
19 org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
20 java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
21 java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
22 org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
23 java.lang.Thread.run(Unknown Source)
24 Root Cause
25 
26 java.lang.UnsupportedClassVersionError: Servlet/BeerSelect has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0 (unable to load class [Servlet.BeerSelect])
27 org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2376)
28 org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:834)
29 org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1297)
30 org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
31 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
32 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
33 org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
34 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
35 org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
36 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
37 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:791)
38 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417)
39 org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
40 java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
41 java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
42 org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
43 java.lang.Thread.run(Unknown Source)
44 Note The full stack trace of the root cause is available in the server logs.

I didn’t take a close look at it at the beginning. I thought it was the wrong Tomcat directory structure. I searched the Internet for various methods, but they couldn’t solve it

Later, if you look at root cause carefully, it is caused by the Java runtime version. After thinking about it, I installed it

It is jdk10, and the default compiled version is also 10. The compiled version should be too high

solution:
just lower the compilation level

Similar Posts: