2016-06-22 5:28 GMT+02:00 rvinjamu <rvinj...@opentext.com>:

> I am not able to get things working with Jersey unless I place all my
> Jersey
> Libraries in EAR/lib - and to my discomfiture even the REST resources jar
> of
> my WebApp to EAR/lib.  For now I have decided to adopt an alternate
> approach
> - I have created an extension of LazyStopLoader and as a Classloader
> delegate using a custom extension of TomEEWebappClassLoader that just
> overrides the getResources method the way Jersey expects it (In-fact I too
> feel that way - the resource URI as returned by the classloader should not
> have a trailing '/' - the / does not make it a precise URI - though Jersey
> could have handled it as a robust measure). I now set this custom loader in
> context.xml of Tomcat ( right now I am setting it at server level - but I
> would move it to the Webapp level). This works fine for me. Jersey is now
> able to identify all resources - The REST app works fine without me having
> to bundle Jersey libraries or the REST resources jar in EAR/lib.
>
> Two points in my opinion favor making the modification in
> TomEEWebappClassLoader.
>
> 1. The TomEE TempClassLoader which loads the classes in EAR/lib behaves
> just
> fine - returns the resource URIs without any trailing '/'. Then why not
> TomEEWebappClassLoader
> 2. A resource URI should be precise. In my opinion, the trailing '/' does
> not make it precise.
>
>
Well this is actually a standard handling on windows by the JVM

We can surely have a flag to activate your workaround if too specific - if
you want to share it - but there is a simpler altenative: don't use
scanning from jersey there (either providing classes in
Application#getClasses() or generating this class at build time) and it
should work fine.


>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Classloading-issues-integrating-Jersey-2-16-and-apache-tomee-plus-7-0-0-tp4678794p4678993.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.
>

Reply via email to