2016-07-15 2 views
0

Я пытаюсь получить очень простой веб-сервис Джерси работать на Weblogic 12.2.1.x, но я терпеть неудачуДжерси 1,13 веб-сервис на Weblogic 12.2.1.x

В моем web.xml У меня есть следующий

<?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> 

И сам вебсервис ресурса очень просто

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 dependecies в моем П

<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> 

Война развертывается нормально, но при попытке получить доступ к веб-сервиса, я просто получить не нашли ответа (тот же URI кстати работает, когда это будет развернут на WebLogic 12.1.3 или Glassfish 3/4)

Одна вещь, которую я заметил, я вижу следующее в журналах сервера (я не вижу каких-либо исключений)

<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, работающий в weblogic 12.2.1.x?

ответ

1

Похоже, что проблема совместимости с 12.2.1.x.

Вы имеете возможность понижая свою версию WebLogic, или переоснащение Джерси 2 (почему вы не используете Джерси 2, кстати?)

https://community.oracle.com/thread/3923266?start=0&tstart=0

+0

Да, я видел этот пост я не был» Если бы это было официальное заявление не поддерживалось или нет. Что касается того, почему Джерси 1, это веб-сервис, разработанный несколько лет назад, это просто простой пример, который даст ту же проблему, что и настоящая. – PDStat

Смежные вопросы