users@jersey.java.net

[Jersey] Re: Test Grizzly 2 not picking up Provider classes

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Thu, 05 May 2011 11:40:44 +0200

Hello,

your project is kind of difficult to reproduce locally, its impossible
to build it without access to your local network resources so I tried to
strip it down but that didn't go well too..

I looked into source code and I saw this in your tests base class:

     public BaseTixContainerTest() {

       super(new
WebAppDescriptor.Builder("org.fracturedatlas.athena.web.resource")
         .contextPath("tix")
         .contextParam("contextConfigLocation",
"classpath:testApplicationContext.xml")
         .servletClass(SpringServlet.class)
         .contextListenerClass(ContextLoaderListener.class)
         .contextParam("javax.ws.rs.Application",
"org.fracturedatlas.athena.web.config.AthenaWebConfig")
         .build());

your providers are in
org.fracturedatlas.athena.web.(exception|serialization).. so you need to
add these packages too (Jersey scans recursively from
"org.fracturedatlas.athena.web.resource" thus it should not ever reach
your providers (they are not part of this or sub packages).

I'm just wondering how is possible that it works with grizzly 1..
testcase would be really great.

Anyway, if you add mentioned packages to Builder inicialization, it
should work with grizzly 2 too.

       super(new
WebAppDescriptor.Builder("org.fracturedatlas.athena.web.resource",
"org.fracturedatlas.athena.web.exception",
"org.fracturedatlas.athena.web.serialization")
         .contextPath("tix")
         .contextParam("contextConfigLocation",
"classpath:testApplicationContext.xml")
         .servletClass(SpringServlet.class)
         .contextListenerClass(ContextLoaderListener.class)
         .contextParam("javax.ws.rs.Application",
"org.fracturedatlas.athena.web.config.AthenaWebConfig")
         .build());

Please let me know whethet it helped.

Thanks,
Pavel


On 5/4/11 5:03 PM, Gary Moore wrote:
> No test case yet, but here are more details:
>
> My AppConfig class, POM, Test setup, and console output for Jersey 1.6
> with Grizzly 1. All tests pass. The provider classes get picked up
> fine here.
>
> https://gist.github.com/955347
>
> The POM and console output for Jersey 1.6 with Grizzly 2. None of the
> providers get picked up here. The only change is changing
> jersey-test-framework-grizzly->jersey-test-framework-grizzly2
>
> https://gist.github.com/955359
>
> An example of one of our providers:
>
> https://github.com/fracturedatlas/ATHENA/blob/master/core/web-resources/src/main/java/org/fracturedatlas/athena/web/serialization/JsonTicketSerializer.java
>
> Thanks,
> Gary
>
> On Tue, May 3, 2011 at 10:32 AM, Pavel Bucek<pavel.bucek_at_oracle.com> wrote:
>> It might be a big deal for us though..
>>
>> Testcase would be perfect, thanks in advance for it (I want to have this
>> clarified/fixed before we release 1.7).
>>
>> Regards,
>> Pavel
>>
>>
>> On 5/3/11 2:41 PM, Gary Moore wrote:
>>> Pavel,
>>>
>>> Thanks for the reply. I was just checking to see if anything had
>>> changed that I missed. I'm out of the office today but I'll post a
>>> test case tomorrow. For now, we just rolled back to the Grizzly 1
>>> framework so it isn't a big deal.
>>>
>>> Thanks,
>>> Gary
>>>
>>> On Tue, May 3, 2011 at 8:04 AM, Pavel Bucek<pavel.bucek_at_oracle.com>
>>> wrote:
>>>> btw, I just found HttpHeadersTest in jersey-apache-client, which uses
>>>> grizzly2 to start and uses @Provider and passes, so.. I'm not sure what
>>>> is
>>>> wrong/can't reproduce.
>>>>
>>>> Pavel
>>>>
>>>> On 5/3/11 1:46 PM, Pavel Bucek wrote:
>>>>> Hello Gary,
>>>>>
>>>>> Are you using Jersey test framework or just jersey-grizzly2 module? Can
>>>>> you share more details/testcase?
>>>>>
>>>>> Thanks,
>>>>> Pavel
>>>>>
>>>>> On 5/2/11 7:39 PM, Gary Moore wrote:
>>>>>> We just moved to Jersey 1.6 this morning. Jersey is find, and our
>>>>>> Jersey Test container classes all pass with Grizzly 1. Grizzly 2,
>>>>>> however, doesn't pick up any of our MessageBodyWriters/Readers and
>>>>>> responds to everything with 415 - Unsupported Media Type. Anyone have
>>>>>> details on how to initialize the Test Grizzly 2 container with our
>>>>>> Provider classes?
>>>>>>
>>>>>> Thanks,
>>>>>> Gary
>>>>>>
>>>
>>
>
>