在使用netbeans测试API调用时作为本地主机运行

时间:2014-07-21 19:02:22

标签: java apache rest tomcat servlets

我正在尝试通过Netbeans 7.4进行REST API通话。所以,我在Java Web包中创建了一个TestAPI项目,即restapi和一个Java程序,在那里我指定了我在运行Java程序时要执行的URL。但是,每次运行程序时,我都会被定向到以下URL:

http://localhost:8080/TestAPI/

它是Hello World,它将显示在浏览器输出中。谁能告诉我我做错了什么?

我的web.xml如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
  <!--  <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>-->
</web-app>

因此,当我运行Java文件Test_Authenticate.java时,我在窗口中收到以下消息:

enter image description here

然后,我最终在我的网络浏览器上收到以下错误。

HTTP Status 404 - /TestAPI/Test_Authenticate

type Status report

message /TestAPI/Test_Authenticate

description The requested resource is not available.
Apache Tomcat/6.0.41

0 个答案:

没有答案