简体   繁体   English

Java Web服务“HTTP状态404” - Eclipse,Apache,Tomcat

[英]Java web service “HTTP status 404” - Eclipse, Apache, Tomcat

I'm really new to Java web services and Apache Tomcat. 我是Java Web服务和Apache Tomcat的新手。 I created a dynamic web project and developed a simple application, and created a web service which uses the Tomcat v7 server. 我创建了一个动态Web项目并开发了一个简单的应用程序,并创建了一个使用Tomcat v7服务器的Web服务。 When I run the application on the server it gives me error 404. 当我在服务器上运行应用程序时,它给出了错误404。

"http://localhost:8080" this root URL works fine. "http://localhost:8080"这个根URL工作正常。 Only the projects that I created not working at all. 只有我创建的项目根本不起作用。

UPDATE: This is the URL I'm trying to access "http://localhost:8080/Testing/" which will call the add method which will take 2 integer values. 更新:这是我试图访问"http://localhost:8080/Testing/"的URL,它将调用add方法,该方法将采用2个整数值。

This is the web.xml file 这是web.xml文件

 <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>Testing</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <display-name>Apache-Axis Servlet</display-name>
    <servlet-name>AxisServlet</servlet-name>
    <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/servlet/AxisServlet</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>*.jws</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>Axis Admin Servlet</display-name>
    <servlet-name>AdminServlet</servlet-name>
    <servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class>
    <load-on-startup>100</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>AdminServlet</servlet-name>
    <url-pattern>/servlet/AdminServlet</url-pattern>
  </servlet-mapping>
</web-app>

Justin 贾斯汀

If you access address http://localhost:8080/Testing/ and get 404 error, you can try if this address work for you: http://localhost:8080/Testing/services 如果您访问地址http:// localhost:8080 / Testing /并获得404错误,您可以尝试此地址是否适合您: http:// localhost:8080 / Testing / services

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

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