Error content:
org.apache.coyote.http11.AbstractHttp11Processor.process Error processing request java.lang.NullPointerException at org.apache.tomcat.util.buf.CharChunk.append(CharChunk.java:308) at org.apache.catalina.mapper.Mapper.map(Mapper.java:683) at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:900) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:523) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1100) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2497) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748)
Today, I also had such a problem with Tomcat on the server. I found that it was a null pointer exception reported by the bottom layer of Tomcat. It was said that it was the append method of charchunk class. I was confused for a while. Finally, I looked at the charchunk source code and found that
The error is reported only when the S parameter here is null,
The reason why s is null is that the defaulthostname called from here is null, that is, the method host.Isnull()
The return value is true. If there is no “host” header for an HTTP/1.0 request, host is
Null, and our current Tomcat is basically http/1.1, so this request is unusual and strange. I don’t know when to call it, but it can be solved. It needs to be in server.xml
<Engine name="Catalina" defaultHost="localhost">
Configure one under tab
<Host name="localhost" > </Host>
In this way, the value of defaulthost will not be ignored and the defaulthostname will have a value, which solves the problem that Tomcat reports a NullPointerException from time to time.
Similar Posts:
- JavaWeb Error:java.lang.NumberFormatException: null
- [Solved] Tomcat10 Error: jakarta.servlet.ServletException: Class com.kuang.servlet.HelloServlet is not a servlet
- Tomcat Warning: HTTP Status 500 – Internal Server Error
- [Solved] JSP Use MySQL database Error: java.lang.classnotfoundexception: com.mysql.jdbc.driver
- [Solved] Invalid character found in method name. HTTP method names must be tokens
- HTTP status 500 – servlet. Init () [How to Solve]
- Web Project Error: javax.servlet.ServletException: Circular view path [registerForm]
- java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path
- [Solved] Cannot call sendError() after the response has been committed
- [Solved] springboot thymeleaf property is empty error: el1007e