简体   繁体   English

从Eclipse运行应用程序时在tomcat中获取错误404

[英]Getting error-404 in tomcat while running application from eclipse

I am trying to run a spring3 application from the eclipse(indigo) by using tomcat6.0. 我正在尝试使用tomcat6.0从eclipse(indigo)运行spring3应用程序。 Right click on the project -> run on server -> gives me error 404(The requested source is not available). 右键单击项目->在服务器上运行->给我错误404(请求的源不可用)。

Edit from comments 根据评论 编辑

<!-- Dispatcher Servlet Mapping --> 
<servlet>   
  <servlet-name>SNBServlet</servlet-name>
  <servlet-class>org.springfr‌​amework.web.servlet.DispatcherServlet</servlet-class>
  <load-on-startup>1</load-on-‌​startup>
</servlet>
<servlet-mapping>
  <servlet-name>SNBServlet</servlet-name>
  <url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
  <listener-class>org.springframework.web.util.Log4jC‌​onfigListener</listener-class>
</listener> 
<!-- Welcome File --> 
<welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

Check the URL that is being hit in the browser. 检查在浏览器中被击中的URL。 Most probably it will be something like http://somehost:port/yourApplicationContext/ which means it is attempting to access a resource on the root of the application that is not present or configured by you. 很有可能是类似http://somehost:port/yourApplicationContext/ ,这意味着它正在尝试访问应用程序根目录上您不存在或未配置的资源。

Either configure some welcome-file in the deployment descriptor of the application or simply request a resource that is already present. 在应用程序的部署描述符中配置一些欢迎文件,或者只是请求一个已经存在的资源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM