users@jersey.java.net

Re: [Jersey] Specification question regarding packaging

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 22 Apr 2010 11:47:32 +0200

On Apr 21, 2010, at 11:59 PM, Laird Nelson wrote:

> I am putting together an .ear file.
>
> The JAX-RS specification says that a JAX-RS application must place its
> resource classes inside a .war file as a jar in WEB-INF/lib (or as
> classes in WEB-INF/classes).
>

https://jsr311.dev.java.net/nonav/releases/1.1/spec/spec.html
2.3.2 Servlet

A JAX-RS application is packaged as a Web application in a .war file.
The application classes are packaged in WEB-INF/classes or WEB-INF/lib
and required libraries are packaged in WEB-INF/lib. See the Servlet
specification for full details on packaging of web applications.



The above is only referring to a servlet and not in general to an EE 6
container.


> Does the specification mandate this?

No it can be different depending on the container.


> Or if I include such classes in
> my ear file's lib directory will they also be considered during
> classpath scanning?
>

Yes, classes in the ear will be scanned. So it should be possible to
have no-interface view SSBs that are resource classes in the ear.


> And what about--for JAXB purposes--the objects my resource classes
> return? Must they also be in WEB-INF/lib? What if I wish to share
> them throughout my ear file?
>

To be honest i am not sure of the class loading isolation, if any,
between an ear and war. That is a quesiton better targeted to the
GlassFish users list. I would expect it to work.

In EE 6 there seems to be much less need for an ear, Do you require it?

Paul.