我有一台Tomcat 7服务器,收到很多GET-requests。这在一段时间内效果很好,然后突然停止工作(7-8小时后)。
Tomcat 7
GET
当它停止工作时,我收到此错误:
mai 06,2015 12:47:58 AM org.apache.coyote.http11.AbstractHttp11Processor进程INFO:解析HTTP请求标头时出错注意:HTTP头解析错误的进一步发生将记录在DEBUG级别。
此后所有其他错误都是一样的。我试图停止获取请求,但是一段时间后它崩溃了。你有什么想法?
这是在崩溃之前就可以了:
[06 / May / 2015:10:47:11 +0200]“ GET / ListenerServlet?request = getLastChanged&_ = 1430852558104 HTTP / 1.1” 200 32
崩溃后:
[06 / May / 2015:10:47:14 +0200]“ GET / ListenerServlet?request = getLastChanged&_ = 1430902035081 HTTP / 1.1” 500 1674
崩溃后,Servlet无法获得请求参数..抛出此空指针:
SEVERE: Servlet.service() for servlet [RoomServlet] in context with path [] threw exception java.lang.NullPointerException at factory.Factory.initEditMode(Factory.java:37) at factory.Factory.init(Factory.java:20) at factory.TabsFactory.<init>(TabsFactory.java:19) at servlet.RoomServlet.getTabs(RoomServlet.java:285) at servlet.RoomServlet.doGet(RoomServlet.java:46) at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
其次是:
mai 07, 2015 9:58:00 AM org.apache.catalina.core.StandardContext listenerStop SEVERE: Exception sending context destroyed event to listener instance of class websocket.drawboard.DrawboardContextListener java.lang.NoClassDefFoundError: javax/websocket/Endpoint at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2944) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569) at websocket.drawboard.DrawboardContextListener.contextDestroyed(DrawboardContextListener.java:32) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5014) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5659) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232) at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1575) at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1564) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: javax.websocket.Endpoint at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569) ... 17 more
如果还有其他需要添加的信息,请告诉我!我真的很感激。
编辑:今天是美好的一天,我遇到了一个新的错误!这可能与JDBC有关。
从服务器成功收到的最后一个数据包是33921291毫秒之前。成功发送到服务器的最后一个数据包是在1毫秒前。连接关闭后,不允许进行任何操作。
我几乎是随机找到解决方案。
没有任何相关内容:
org.apache.coyote.http11.AbstractHttp11Processor进程
但这是一个JDBC问题。.8小时后连接关闭,为此我在Servlet中没有任何错误。
对我来说,解决方案是在应用程序的上下文中添加一些行:
我补充说:
url="jdbc:mysql://127.0.0.1:3306/test?autoReconnect=true" dontTrackOpenResources="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="300000"
现在是我的完整上下文:
<Context> <Resource name="jdbc/test" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="100" maxWait="30000" username="test" password="bestpassword" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://127.0.0.1:3306/test?autoReconnect=true" removeAbandoned="true" removeAbandonedTimeout="10" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" fairQueue="true" dontTrackOpenResources="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="300000" /> </Context>
我的服务器已经一周没有崩溃了,我相信它不会再崩溃了。