我的web.xml文件中如下:Wildfly 10 + Rest輕鬆的網絡服務。爲獲取完整路徑錯誤無法找到資源
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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">
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
我的應用程序配置類如下:
@ApplicationPath("/api/catalogManagement/v2")
public class ApplicationConfig extends ResourceConfig
我休息服務等級如下表所示:
@Stateless
@Path("/catalog")
public class CatalogFacadeREST extends AbstractFacadeREST<CatalogEntity> {
@GET
@Produces({MediaType.APPLICATION_JSON})
public Response find(@QueryParam("depth") int depth, @Context UriInfo uriInfo) throws BadUsageException {
}
}
我打電話此休息服務:http://localhost:8080/DSPRODUCTCATALOG2/rest/api/catalogManagement/v2/catalog?depth=5
但我得到:
21:17:53,739 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-1) RESTEASY002010: Failed to execute: javax.ws.rs.NotFoundException: RESTEASY: Could not find resource for full path: http://localhost:8080/DSPRODUCTCATALOG2/rest/api/catalogManagement/v2/catalog?depth=5
at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:75)
at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48)
at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:445)
我使用澤西類,如:import org.glassfish.jersey.server.ResourceConfig;在ApplicationConfig Java文件中。但Wildfly 10默認使用Rest Easy。這是否導致問題? – user3921892