“找不到相关资源:/index.html”表示您的应用正在尝试将index.html挖掘为RESTful资源而不是静态文件。
没有看到你的web.xml,我猜你有一个 <servlet-mapping> 处理所有URL模式的条目;这样的事情:
<servlet-mapping>
<servlet-mapping> <servlet-name>My RESTful servlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping>
要解决这个问题, 这个SO 看起来很有帮助,这实质上建议在资源路径中添加额外的令牌,例如:
<url-pattern>/service/*</url-pattern>
这意味着您必须访问您的Query资源 http://localhost:8080/Test/service/Query?key=Hello%20World 。
http://localhost:8080/Test/service/Query?key=Hello%20World