私は、WebLogic 12.2.1.x上で実行するために非常に単純なジャージーWebサービスを取得しようとしていますが、私は私のweb.xml
私は、次のしているでは無残ジャージー1.13 Webサービス
を失敗しています
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd">
<display-name>jersey1test</display-name>
<servlet>
<servlet-name>ServletAdaptor</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.jersey1test</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ServletAdaptor</servlet-name>
<url-pattern>/srv/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
そしてWebサービスのリソース自体
はimport javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("jersey1test")
public class Jersey1Resource
{
@Path("hello")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response helloJersey()
{
return Response.status(Response.Status.OK).entity("Hello from Jersey 1").build();
}
}
非常にシンプルで、私は私のポンポンで排他的ジャージー1.13の依存性を持っている
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.13</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.13</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>1.13</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
そしてこのoracle pageで示唆したように、私は私のweblogic.xmlで、次の私の戦争
<wls:container-descriptor>
<wls:prefer-application-packages>
<!— jersey-bundle-*.jar->
<wls:package-name>com.sun.jersey.*</wls:package-name>
<wls:package-name>com.sun.research.ws.wadl.*</wls:package-name>
<wls:package-name>com.sun.ws.rs.ext.*</package-name>
<!— Jackson-*.jar ->
<wls:package-name>org.codehaus.jackson.*</wls:package-name>
<!— jettison-*.jar ->
<wls:package-name>org.codehaus.jettison.*</wls:package-name>
<!— jsr311*.jar ->
<wls:package-name>javax.ws.rs.*</wls:package-name>
<!— asm.jar ->
<wls:package-name>org.objectweb.asm.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
戦争が細かい展開で展開しているが、Webサービスにアクセスしようとしたとき、私はちょうど見つからない応答を受信私は(私はすべての例外を見ることができない)
サーバーログに次のように表示され気づいた一つのこと(これは、12.1.3またはGlassfishの3/4をWebLogicへのデプロイされたときと同じURIがところで作品)
<15-Jul-2016 08:39:55 o'clock BST> <Warning> <JAXRSIntegration> <BEA-2192509> <Changing servlet class from com.sun.jersey.spi.container.servlet.ServletContainer (web.xml) to org.glassfish.jersey.servlet.ServletContainer.>
<15-Jul-2016 08:39:55 o'clock BST> <Warning> <JAXRSIntegration> <BEA-2192510> <Cannot add Jersey servlet for application class com.sun.jersey.api.core.ResourceConfig because ApplicationPath annotation is not set on it.>
<15-Jul-2016 08:39:55 o'clock BST> <Warning> <JAXRSIntegration> <BEA-2192510> <Cannot add Jersey servlet for application class com.sun.jersey.api.core.ApplicationAdapter because ApplicationPath annotation is not set on it.>
<15-Jul-2016 08:39:55 o'clock BST> <Warning> <JAXRSIntegration> <BEA-2192510> <Cannot add Jersey servlet for application class com.sun.jersey.server.impl.application.DeferredResourceConfig because ApplicationPath annotation is not set on it.>
<15-Jul-2016 08:39:55 o'clock BST> <Warning> <JAXRSIntegration> <BEA-2192510> <Cannot add Jersey servlet for application class com.sun.jersey.api.core.ClassNamesResourceConfig because ApplicationPath annotation is not set on it.>
<15-Jul-2016 08:39:55 o'clock BST> <Warning> <JAXRSIntegration> <BEA-2192510> <Cannot add Jersey servlet for application class com.sun.jersey.api.core.DefaultResourceConfig because ApplicationPath annotation is not set on it.>
<15-Jul-2016 08:39:55 o'clock BST> <Warning> <JAXRSIntegration> <BEA-2192510> <Cannot add Jersey servlet for application class com.sun.jersey.api.core.PackagesResourceConfig because ApplicationPath annotation is not set on it.>
<15-Jul-2016 08:39:55 o'clock BST> <Warning> <JAXRSIntegration> <BEA-2192510> <Cannot add Jersey servlet for application class com.sun.jersey.api.core.servlet.WebAppResourceConfig because ApplicationPath annotation is not set on it.>
<15-Jul-2016 08:39:55 o'clock BST> <Warning> <JAXRSIntegration> <BEA-2192510> <Cannot add Jersey servlet for application class com.sun.jersey.api.core.ClasspathResourceConfig because ApplicationPath annotation is not set on it.>
<15-Jul-2016 08:39:55 o'clock BST> <Warning> <JAXRSIntegration> <BEA-2192510> <Cannot add Jersey servlet for application class com.sun.jersey.api.core.ScanningResourceConfig because ApplicationPath annotation is not set on it.>
私には、私がweblogic.xml
に設定したものを無視していると示唆しているようです。私は間違って何をしていますか? jersey 1のWebサービスをweblogic 12.2.1.xで動作させることは可能ですか?
はい、私は「wasnその記事を見ましたそれが公式ではないかどうかは、サポートされていないかどうかを確認してください。なぜJersey 1は数年前に開発されたWebサービスなのですが、上記は実際の問題と同じ問題を起こす単純な例です。 – PDStat