users@jersey.java.net

[Jersey] Re: Running jersey-test under Maven

From: Ryan Stewart <rds6235_at_gmail.com>
Date: Wed, 23 Mar 2011 14:33:35 -0500

Yes, afaik, the ResourceConfig classes only tell Jersey how to locate your
resource and provider classes. I believe there's some code somewhere that
adds the built-in stuff on startup. The provider that you mentioned wasn't
one of the built-ins, though:
com.sun.jersey.samples.jmaki.config.JAXBContextResolver. That's one of the
sample provider classes.

On Wed, Mar 23, 2011 at 12:19 PM, Gili <cowwoc_at_bbs.darktech.org> wrote:

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> I think I might be misunderstanding ResourceConfig. Does Jersey
> automatically find all the built-in providers (JSON, JAXB, etc) if they're
> on the classpath or am I expected to ensure that the ResourceConfig locates
> them? If ResourceConfig is only there to locate user classes then I
> completely agree with you.
>
> Thank you,
> Gili
>
>
> On 23/03/2011 1:05 PM, zzantozz [via Jersey] wrote:
>
> On the contrary, I can have the jmaki sample run with a
> ClasspathResourceConfig just fine. Just change this:
> public JMakiBackendWebappTest() throws Exception {
> super(new WebAppDescriptor.Builder("com.sun.jersey.samples.jmaki")
> .contextPath("/jMakiBackend")
> .servletPath("/webresources")
> .build());
> }
>
> to this:
> public JMakiBackendWebappTest() throws Exception {
> super(new WebAppDescriptor.Builder()
> .initParam(ServletContainer.RESOURCE_CONFIG_CLASS,
> ClasspathResourceConfig.class.getName())
> .initParam(ClasspathResourceConfig.PROPERTY_CLASSPATH,
> "target/classes")
> .contextPath("/jMakiBackend")
> .servletPath("/webresources")
> .build());
> }
>
> I'm not sure why you'd want to do this instead of just using a
> PackagesResourceConfig, though. It seems much less intuitive and binds you
> to the file system instead of using the classpath directly, as is normally
> done in Java.
>
> On Tue, Mar 22, 2011 at 4:27 PM, Gili <[hidden email]<http://user/SendEmail.jtp?type=node&node=6201030&i=0&by-user=t&by-user=t>
> > wrote:
>
>>
>> Srinivas Naresh Bhimisetty wrote:
>> >
>> > Gili,
>> >
>> > jersey-test should run without any issues under Maven, when you
>> invoke
>> > the package goal which creates the war file.
>> >
>> > May be you can refer the jmaki-backend jersey sample, which has some
>> > Provider classes. The test which runs on the Grizzly web container does
>> > run
>> > without any issue. BTW, which test container are you trying this with?
>> Did
>> > you try that with the grizzly web test container?
>>
>> Hi Naresh,
>>
>> I am using the Grizzly web container. The JMaki sample you referred to
>> isn't
>> the best example because it uses the package ResourceConfig. What I am
>> saying is that if you try using the ClasspathResourceConfig it will not
>> find
>> the built-in Jersey providers. In fact, the JMaki example suffers from the
>> same problem. If you run it, you will notice it says:
>>
>> INFO: Provider classes found:
>> class com.sun.jersey.samples.jmaki.config.JAXBContextResolver
>>
>> Notice how none of the built-in providers show up.
>>
>> Gili
>>
>> --
>> View this message in context:
>> http://jersey.576304.n2.nabble.com/Running-jersey-test-under-Maven-tp6191134p6198030.html<http://jersey.576304.n2.nabble.com/Running-jersey-test-under-Maven-tp6191134p6198030.html?by-user=t&by-user=t>
>> Sent from the Jersey mailing list archive at Nabble.com.
>>
>
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://jersey.576304.n2.nabble.com/Running-jersey-test-under-Maven-tp6191134p6201030.html<http://jersey.576304.n2.nabble.com/Running-jersey-test-under-Maven-tp6191134p6201030.html?by-user=t>
> To unsubscribe from Running jersey-test under Maven, click here<http://jersey.576304.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=6191134&code=Y293d29jQGJicy5kYXJrdGVjaC5vcmd8NjE5MTEzNHwxNTc0MzIxMjQ3&by-user=t>.
>
>
>
>
> ------------------------------
> View this message in context: Re: Running jersey-test under Maven<http://jersey.576304.n2.nabble.com/Running-jersey-test-under-Maven-tp6191134p6201089.html>
>
> Sent from the Jersey mailing list archive<http://jersey.576304.n2.nabble.com/>at Nabble.com.
>