[英]Tomcat. Works in Eclipse, but does not work when deployed
I have a project on tomcat that works well when I run it "on server" via Eclipse. 我在tomcat上有一个项目,当我通过Eclipse在“服务器上”运行它时,该项目运行良好。 However, when I exported the WAR file and deployed it, the servlets don't work. 但是,当我导出WAR文件并对其进行部署时,这些servlet不起作用。 Only my JSP pages work. 只有我的JSP页面有效。 Here's part of the web XML: 这是Web XML的一部分:
<display-name>CandC3</display-name>
Then, the <welcome-file-list>
section and then servlets and mappings. 然后, <welcome-file-list>
部分,然后是servlet和映射。 Here's one: 这是一个:
<servlet>
<description></description>
<display-name>LoginServlet</display-name>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>candc3.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>
Now, when I try to access this servlet as someserver:8080/CandC3/LoginServlet?param1=val1 I get an error 404: Servlet LoginServlet is not available 现在,当我尝试以someserver:8080 / CandC3 / LoginServlet?param1 = val1的身份访问此Servlet时,出现错误404:Servlet LoginServlet不可用
Any ideas? 有任何想法吗? Am I missing something obvious? 我是否缺少明显的东西? Shouldn't an export from eclipse work seamlessly in a server ;) eclipse的导出不应该在服务器上无缝运行;)
More info: catalina.out 更多信息:catalina.out
INFO: Deploying web application archive CandC3.war
Apr 24, 2013 11:10:34 PM org.apache.catalina.startup.HostConfig deployWAR
Also, after I restart tomcat, the first time I try to use the Servlet I get: 另外,在重新启动tomcat之后,我第一次尝试使用Servlet:
javax.servlet.ServletException: Wrapper cannot find servlet class candc3.LoginServlet or a class it depends on
and as the root cause: 并作为根本原因:
java.lang.ClassNotFoundException: candc3.LoginServlet
After that, on subsequent tries I get error 404: Servlet LoginServlet is not available
之后,在随后的尝试中,我得到error 404: Servlet LoginServlet is not available
Do you have a web application under your tomcat/webapps directory named CandC3? 在tomcat / webapps目录下是否有一个名为CandC3的Web应用程序? Does it have a directory under it named WEB-INF with a "classes" directory or similar under it? 它下面是否有一个名为WEB-INF的目录,下面有一个“类”目录或类似目录? Otherwise, can you physically locate your servlet class candc3.LoginServlet at all anywhere under the CandC3 directory? 否则,您是否可以在CandC3目录下的所有位置实际找到servlet类candc3.LoginServlet?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.