我正在尝试将基于REst的Web服务部署到Weblogic 12C上。 部署战争时,我收到以下警告,部署后无法访问ping服务(或任何其他服务)。
警告讯息
<Apr 17, 2017 1:03:14 PM EET> <Warning> <JAXRSIntegration> <BEA-2192510> <Cannot add Jersey servlet for application class org.glassfish.jersey.server.ResourceConfig because ApplicationPath annotation is not set on it.>
<Apr 17, 2017 1:03:14 PM EET> <Warning> <JAXRSIntegration> <BEA-2192510> <Cannot add Jersey servlet for application class org.glassfish.jersey.server.ResourceConfig$WrappingResourceConfig because ApplicationPath annotation is not set on it.>
<Apr 17, 2017 1:03:14 PM EET> <Warning> <JAXRSIntegration> <BEA-2192510> <Cannot add Jersey servlet for application class org.glassfish.jersey.server.ResourceConfig$RuntimeConfig because ApplicationPath annotation is not set on it.>
以下是其他文物。
的web.xml:
<servlet>
<servlet-name>jersey</servlet-name>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.test.service.service</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jersey</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
ResourceConfig子类:
@ApplicationPath("/custom")
public class TestPageService extends ResourceConfig {
/*Register JAX-RS application components.*/
public TestPageService () {
packages("com.test.service.service");
}
}
服务类:
@Path("/testpageservice")
public class TestServiceImpl{
@Path("/ping")
@GET
public String ping() {
String responseStr = "This is Test web Service";
}
的pom.xml:
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.25.1</version>
</dependency>
<!-- Required only when you are using JAX-RS Client -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.25.1</version>
</dependency>
我也尝试在weblogic.xml中为com.sun.jersey放置prefer-application-packages,但没有帮助。
请告知如何解决问题。