users@jersey.java.net

Re: [Jersey] Jersey provider-detection fails under Tomcat?

From: Gili <cowwoc_at_bbs.darktech.org>
Date: Mon, 5 Jan 2009 07:59:35 -0800 (PST)

On Dec 24, 2008, at 3:10 AM, Gili wrote:
An error will be logged at the level of CONFIG. This will occur when
the class is attempted to be loaded. The reason for using CONFIG is
some what historical but also related to using jersey-bundle that may
contain many providers that are not needed but are instantiated and
errors will result because the dependencies are deliberately not
included.
</config>

Why couldn't you omit these from jersey-bundle? Can you go into more details
of why they are instantiated in the first place?


Paul Sandoz wrote:
>
> Note that it is not necessary for all providers to be annotated with
> @Provider. Infrastructure-based providers are registered using META-
> INF/services, thus there is no need to class scan and instead
> registration occurs because the jar is in the class path.
>

Yes, but unless you treat this strictly you will break compatibility with
the JSR311 standard. Users migrating from Jersey to another implementation
and back will see different behavior. Furthermore, this isn't simply a hole
in the specification, they explicitly write that @Provider is required.


Paul Sandoz wrote:
>
> Did you configure class scanning (file or package) to the multipart
> providers? I presume you did.
>

No, I just had jersey-multipart in my classpath. How would you configure
class scanning as you mention?


Paul Sandoz wrote:
>
> I don't understand why the error occurs when the class is instantiated
> rather than when the class is loaded. Namely the code to instantiate a
> provider class registered via META-INF/services or annotated with
> @Provider and scanned is the same.
>

The error is probably occurring at the same time. The difference is that I
am using the default logging level, which ignores CONFIG. Looking at the
logging levels, this definitely sounds like it should be logged using WARN
instead of CONFIG.

Gili
-- 
View this message in context: http://n2.nabble.com/Jersey-provider-detection-fails-under-Tomcat--tp1688690p2113452.html
Sent from the Jersey mailing list archive at Nabble.com.