users@jersey.java.net

[Jersey] Re: Jersey 2.0-m08: troubleshooting and dependencies

From: Jan Algermissen <algermissen1971_at_mac.com>
Date: Fri, 12 Oct 2012 14:06:21 +0200

On Oct 12, 2012, at 1:56 PM, Marek Potociar wrote:

>
> On Oct 12, 2012, at 12:54 PM, Jan Algermissen <algermissen1971_at_mac.com> wrote:
>
>>
>> On Oct 12, 2012, at 12:39 PM, Marek Potociar wrote:
>>
>>>
>>> On Oct 12, 2012, at 6:04 AM, Arul Dhesiaseelan <aruld_at_acm.org> wrote:
>>>
>>>> I am able to suck in the 2.0-SNAPSHOT dependencies just fine with your maven coordinates. You don't need to include javax.ws.rs dependency in your POM as this is a transitive dependency of jersey modules.
>>>
>>> You're right, the JAX-RS API dependencies should transitively resolve via Jersey dependencies.
>>
>> Makes sense, yes.
>>
>> However - I still have no luck. There must be some class shadowing another or whatever.
>>
>> I am pulling in
>>
>> javaee-web-api 6.0
>>
>> jersey-client 2.0-SNAPSHOT
>> jersey-common 2.0-SNAPSHOT
>> jersey-server 2.0-SNAPSHOT
>>
>> And the compiler still sees a version of javax.ws.rs.core.Response
>> that does not exhibit some methods that IMHO should be there, e.g.
>>
>> getEntity(java.lang.Class)
>> getCookies()
>>
>> Any ideas how to fix that or where to start?
>
> Stop pulling the javaee-web-api. It seems that it may contain JAX-RS 1.1 (although I'm not sure).

Well, it should, given that JAX-RS is part of Java EE6, ... ?

I expected Jersey to shadow the JAX-RS 1.1 classes

The point then is .... how do I use JAX-RS 2 with Java EE6? - Which is what I am actually up to.

Jan



>
> Marek
>
>>
>> Jan
>>
>>
>>
>>
>> <dependencies>
>> <dependency>
>> <groupId>javax</groupId>
>> <artifactId>javaee-web-api</artifactId>
>> <version>6.0</version>
>> <scope>provided</scope>
>> </dependency>
>>
>> <dependency>
>> <groupId>org.glassfish.jersey.core</groupId>
>> <artifactId>jersey-client</artifactId>
>> <version>2.0-SNAPSHOT</version>
>> </dependency>
>> <dependency>
>> <groupId>org.glassfish.jersey.core</groupId>
>> <artifactId>jersey-common</artifactId>
>> <version>2.0-SNAPSHOT</version>
>> </dependency>
>> <dependency>
>> <groupId>org.glassfish.jersey.core</groupId>
>> <artifactId>jersey-server</artifactId>
>> <version>2.0-SNAPSHOT</version>
>> </dependency>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>>
>>> Marek
>>>
>>>>
>>>> I have also noticed some times in intellij, it does not sync snapshots while updating POM in the IDE, I endup doing mvn install from command line which fixes this.
>>>>
>>>> On Thu, Oct 11, 2012 at 11:19 AM, Jan Algermissen <algermissen1971_at_mac.com> wrote:
>>>> Hi Marek,
>>>>
>>>> On Oct 11, 2012, at 11:08 PM, Marek Potociar wrote:
>>>>
>>>>> Hi Jan,
>>>>>
>>>>> Please don't use the SNAPSHOT JAX-RS 2.0 API with Jersey. Always use the stable milestone version of the JAX-RS API that we depend on in Jersey (even in snapshots). We currently depend on JAX-RS 2.0-m11 and should soon (tomorrow) depend on 2.0-m12 in our Jersey snapshot.
>>>>>
>>>>> The reason for this fixed milestone dependency is that we need to be able to introduce breaking changes in the JAX-RS API without actually breaking Jersey code.
>>>>>
>>>>
>>>> Excuse my apparent lack of understanding best practices - but can you tell me what dependencies I have to use (with Glassfish) in order to track you latest developments in JAX-RS?
>>>>
>>>> I now have:
>>>>
>>>> <dependency>
>>>> <groupId>javax.ws.rs</groupId>
>>>> <artifactId>javax.ws.rs-api</artifactId>
>>>> <version>2.0-m11</version>
>>>> </dependency>
>>>>
>>>>
>>>> <dependency>
>>>> <groupId>org.glassfish.jersey.core</groupId>
>>>> <artifactId>jersey-client</artifactId>
>>>> <version>2.0-SNAPSHOT</version>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>org.glassfish.jersey.core</groupId>
>>>> <artifactId>jersey-common</artifactId>
>>>> <version>2.0-SNAPSHOT</version>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>org.glassfish.jersey.core</groupId>
>>>> <artifactId>jersey-server</artifactId>
>>>> <version>2.0-SNAPSHOT</version>
>>>> </dependency>
>>>>
>>>> Which also does not give me the right Response class it seems.
>>>>
>>>> Jan
>>>>
>>>>
>>>>
>>>>> HTH,
>>>>> Marek
>>>>>
>>>>>
>>>>> On Oct 11, 2012, at 9:54 PM, Jan Algermissen <algermissen1971_at_mac.com> wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I am also having troubles since today (though it might be due to a lack of mvn mastery). Here is my POM
>>>>>>
>>>>>> <repositories>
>>>>>> <repository>
>>>>>> <id>snapshot-repository.java.net</id>
>>>>>> <name>Java.net Snapshot Repository for Maven</name>
>>>>>> <url>https://maven.java.net/content/repositories/snapshots/</url>
>>>>>> <layout>default</layout>
>>>>>> </repository>
>>>>>> </repositories>
>>>>>>
>>>>>> <dependencies>
>>>>>> <dependency>
>>>>>> <groupId>javax</groupId>
>>>>>> <artifactId>javaee-web-api</artifactId>
>>>>>> <version>6.0</version>
>>>>>> <scope>provided</scope>
>>>>>> </dependency>
>>>>>>
>>>>>> <dependency>
>>>>>> <groupId>javax.ws.rs</groupId>
>>>>>> <artifactId>javax.ws.rs-api</artifactId>
>>>>>> <version>2.0-SNAPSHOT</version>
>>>>>> </dependency>
>>>>>> <dependency>
>>>>>> <groupId>org.glassfish.jersey.core</groupId>
>>>>>> <artifactId>jersey-client</artifactId>
>>>>>> <version>2.0-SNAPSHOT</version>
>>>>>> </dependency>
>>>>>> </dependencies>
>>>>>>
>>>>>> I am having, for example, problems with getCookies on Response:
>>>>>>
>>>>>> [ERROR] symbol : method getCookies()
>>>>>> [ERROR] location: class javax.ws.rs.core.Response
>>>>>>
>>>>>>
>>>>>> Jan
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Oct 11, 2012, at 9:42 PM, Marko Asplund wrote:
>>>>>>
>>>>>>> hi,
>>>>>>>
>>>>>>> I started testing Jersey 2.0-m08 milestone release.
>>>>>>> My resource classes are returning JAXB classes that Jersey serializes to XML or JSON depending on the Accept-header value.
>>>>>>> At some point request processing was failing due to application bugs: the JAXB class was missing a no-arg constructor and later the JSON jars required by Jersey were missing.
>>>>>>> I configured Jersey to log at FINEST level via java.util.logging but I couldn't find any clues from the log.
>>>>>>> The application was failing silently in these cases which made troubleshooting a bit difficult.
>>>>>>> The problem is solved now but how do you have any troubleshooting tips for this sort of issues?
>>>>>>> I think it might be good to add a few notes about configuring Jersey logging to a troubleshooting section of the user guide.
>>>>>>>
>>>>>>> Which Jersey dependencies should I specify for my application in Maven?
>>>>>>> The following specification seems to be working but is it optimal?
>>>>>>> I'm deploying the app to a Servlet 3.0 container (Jetty 8.1).
>>>>>>>
>>>>>>> <dependency>
>>>>>>> <groupId>javax.ws.rs</groupId>
>>>>>>> <artifactId>javax.ws.rs-api</artifactId>
>>>>>>> <version>${jax-rs-api.version}</version>
>>>>>>> <scope>compile</scope>
>>>>>>> </dependency>
>>>>>>>
>>>>>>> <dependency>
>>>>>>> <groupId>org.glassfish.jersey</groupId>
>>>>>>> <artifactId>jax-rs-ri</artifactId>
>>>>>>> <version>${jersey.version}</version>
>>>>>>> <scope>runtime</scope>
>>>>>>> </dependency>
>>>>>>>
>>>>>>> <dependency>
>>>>>>> <groupId>org.glassfish.jersey.core</groupId>
>>>>>>> <artifactId>jersey-common</artifactId>
>>>>>>> <version>${jersey.version}</version>
>>>>>>> <scope>runtime</scope>
>>>>>>> </dependency>
>>>>>>>
>>>>>>> <dependency>
>>>>>>> <groupId>org.glassfish.jersey.media</groupId>
>>>>>>> <artifactId>jersey-media-json-jackson</artifactId>
>>>>>>> <version>${jersey.version}</version>
>>>>>>> <scope>runtime</scope>
>>>>>>> </dependency>
>>>>>>>
>>>>>>>
>>>>>>> marko
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>