users@jersey.java.net

[Jersey] Re: Jersey REST Resource Config

From: Robert Middleton <osfan6313_at_gmail.com>
Date: Fri, 11 Dec 2015 16:36:05 -0500

Well, I have figured it out! I'm confused as to why this is the case, but
here is what I have figured out(all of the code here is in my constructor):

Fails:
register( new Object() );
property( ServerProperties.PROVIDER_CLASSPATH, "com.blahblah" );

Works:
register( new Object() );
packages( "com.blahblah" );

Works:
property( ServerProperties.PROVIDER_CLASSPATH, "com.blahblah" );

Where I originally saw the problem, I noticed that I had a typo in my code,
so it was something like this:

Works:
packages( "com.blahblah.api" );

Fails:
register( new Object() );
packages( "com.blahblah.api" );

It turns out that I had a typo in my packages line, so to fix it I did the
following:
register( new Object() );
packages( "com.blahblah.web.api" );

It still seems strange to me that it would have worked properly the first
time, since the packages that I set were not in the proper namespace. Does
Jersey scan everything by default unless you register() something?

-Robert Middleton


On Fri, Dec 11, 2015 at 3:20 PM, Robert Middleton <osfan6313_at_gmail.com>
wrote:

> There's nothing obvious in the log, it looks exactly the same no matter
> what my code is. Is there a special log level/logger that has to be set in
> order to see more information?
>
> If it helps, I have a small project(only two classes) that I've been using
> to try and figure this out.
>
> -Robert Middleton
>
> On Fri, Dec 11, 2015 at 2:20 PM, Bobby Bissett <bbissett_at_gmail.com> wrote:
>
>>
>> I think I was a little unclear in my question. I don't want to actually
>>> turn on logging, that was just a convenient example. I'm attempting to
>>> configure Genson for use with Jersey, but whenever I call the register()
>>> method on my Application class I always get a 404 error when attempting to
>>> get a value from a REST endpoint. I just tried it again, and even doing
>>> the following causes the REST endpoints to no longer work:
>>> [...]
>>>
>>
>> Any errors from the Jersey code in the Tomcat server log? If there's
>> something going wrong such that Jersey can't run, then you'll get more info
>> there, and it would explain the 404 -- there might be no resource there
>> because Jersey isn't understanding it.
>>
>> Cheers,
>> Bobby
>>
>>
>