无法理解错误,但创建了具有以下方面的动态网络项目:
运行时:Websphere Application Server Liberty Profile。
这不是我的第一个具有这种配置的项目,到目前为止一切都还不错。在此项目中,尝试执行任何RESTful请求时收到以下错误:
[ERROR ] SRVE0271E: Uncaught init() exception created by servlet [javax.ws.rs.core.Application] in application [EscapeRoom]: javax.servlet.ServletException: At least one provider or resource class should be specified for application class "javax.ws.rs.core.Application
at com.ibm.ws.jaxrs20.server.LibertyJaxRsServerFactoryBean.doInit(LibertyJaxRsServerFactoryBean.java:303)
at [internal classes]
[ERROR ] SRVE0276E: Error while initializing Servlet [javax.ws.rs.core.Application]: javax.servlet.ServletException: At least one provider or resource class should be specified for application class "javax.ws.rs.core.Application
at com.ibm.ws.jaxrs20.server.LibertyJaxRsServerFactoryBean.doInit(LibertyJaxRsServerFactoryBean.java:303)
at [internal classes]
[ERROR ] SRVE0271E: Uncaught init() exception created by servlet [javax.ws.rs.core.Application] in application [EscapeRoom]: javax.servlet.ServletException: At least one provider or resource class should be specified for application class "javax.ws.rs.core.Application
at com.ibm.ws.jaxrs20.server.LibertyJaxRsServerFactoryBean.doInit(LibertyJaxRsServerFactoryBean.java:303)
at [internal classes]
[ERROR ] SRVE0315E: An exception occurred: java.lang.Throwable: javax.servlet.ServletException: At least one provider or resource class should be specified for application class "javax.ws.rs.core.Application
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4898)
at [internal classes]
Caused by: javax.servlet.ServletException: At least one provider or resource class should be specified for application class "javax.ws.rs.core.Application
at com.ibm.ws.jaxrs20.server.LibertyJaxRsServerFactoryBean.doInit(LibertyJaxRsServerFactoryBean.java:303)
... 1 more
我的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<display-name>EscapeRoom</display-name>
<servlet>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
我的jax-rs课程:
@Path("/test")
public class TestGet {
@GET
public String getTest(){
return "OK!";
}
}
非常简单。
试图在同一工作区创建另一个项目,它工作正常。
实际上我可以将我的所有前端内容从一个项目复制到另一个项目,但我不喜欢这种解决方法,并希望找到它不起作用的原因,我想我错过了一些东西明显。