Tag Archives: HTTP Status 500 – Internal Server Error

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

Springmvc Error: HTTP Status 500 – Could not write content: No serializer

HTTP Status 500 – Could not write content: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: com.pbc.rsms.entity.UserInfo_$$_jvstcc6_0[“handler”]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: com.pbc.rsms.entity.UserInfo_$$_jvstcc6_0[“handler”])

Reason: 

The problem is that with load method you get just a proxy but not the real object. The proxy object doesn’t have the properties already loaded so when the serialization happens there are no properties to be serialized. With the get method you actually get the real object, this object could in fact be serialized.

Method 1:

Add to the entity class generated by hibernate.

@JsonIgnoreProperties({“hibernateLazyInitializer”, “handler”})

Method 2: 

load to get

I think that the problem is the way that you retrieve the entity.

Maybe you are doing something like this:

Person p = (Person) session.load(Person.class, new Integer(id));
Try using the method get instead of load

Person p = (Person) session.get(Person.class, new Integer(id));
The problem is that with load method you get just a proxy but not the real object. The proxy object doesn’t have the properties already loaded so when the serialization happens there are no properties to be serialized. With the get method you actually get the real object, this object could in fact be serialized.