我正在使用Tomcat 6,我只是注意到了一件奇怪的事情 - 在它启动后,它会加载我的Login.jsp
页面。在我看来,它应该没有理由这样做,并且谷歌搜索这个问题我什么都没找到。任何帮助将不胜感激。
线索&注意:
Login.jsp
而不是其他内容的原因很可能是我的web.xml
将其列为唯一的<welcome-file>Login.jsp</welcome-file>
。如果我在Login.jsp
中打印堆栈跟踪,我会得到:
java.lang.Exception
at org.apache.jsp.Login_jsp._jspService(Login_jsp.java:64)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.mycompany.StartupFilter.doFilter(StartupFilter.java:33)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:722)
您会注意到有一个自定义StartupFilter
,但它可能不是原因。到目前为止,这看起来就像浏览器引起的任何其他网页加载一样。
remoteAddr
和remoteHost
是127.0.0.1
。 remotePort
是-1
,这真的很奇怪。请求中没有参数。 (还有什么我应该关注的吗?)开始日志如下所示:
Nov 07, 2013 6:45:17 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/vektor/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Nov 07, 2013 6:45:17 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:RealPadWeb' did not find a matching property.
Nov 07, 2013 6:45:17 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Nov 07, 2013 6:45:18 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8443
Nov 07, 2013 6:45:18 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 931 ms
Nov 07, 2013 6:45:18 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Nov 07, 2013 6:45:18 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
Nov 07, 2013 6:45:19 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Nov 07, 2013 6:45:19 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8443
Nov 07, 2013 6:45:19 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Nov 07, 2013 6:45:19 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/18 config=null
Nov 07, 2013 6:45:19 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1622 ms
<here I found logged my System.out.println() I put in Login.jsp>
当我打开Access Log Valve时,我会看到这一行:127.0.0.1 - - [07/Nov/2013:19:01:54 +0100] "GET / HTTP/1.1" 200 5136
这是我得到的。任何帮助将非常感激。如果您需要查看任何其他配置文件,请告诉我们!
在折叠下:详情
答案 0 :(得分:2)
Tomcat不这样做。 Eclipse的Tomcat插件就是这样做的。 Tomcat声称成功启动后,Eclipse Tomcat插件会在/
上触发请求,以检查是否为真。由于您显然已将您的Web应用程序部署在上下文根/
上,因此将隐式打开其<welcome-file>
。请注意,当您的Web应用程序部署在固定的上下文路径上时,不会发生这种情况。
忽略它。这是完全无害的。此外,这在实际生产中不会发生(当然,我假设生产服务器不会无意中仅使用Eclipse来启动Tomcat服务器实例)。
答案 1 :(得分:1)
也许您可以设置断点来暂停参与请求的线程,并使用netstat命令或其他工具查看它来自何处。如果它来自同一个进程,你应该挂起整个JVM并找出发出请求的线程以及原因。