users@glassfish.java.net

Re: JAX-RS on Glassfish 3.1: _at_EJB injection?

From: <glassfish_at_javadesktop.org>
Date: Wed, 16 Jun 2010 09:42:36 PDT

> > I am not sure what all the bugs are. I will say
> that I followed the
> > publishing guidelines in the JAX-RS specification
> to the letter.
> > The only "gray area" that I know of involves
> packaging resource
> > classes in the lib directory, which appears to be
> permitted by the
> > specifications, but does not work here.
> >
>
> This is indeed a gray area but since you can do this:
>
> @ApplicationPath("/frobnication")
> public class Application extends
> javax.ws.rs.core.Application {
> public Set<Class<?>> getClasses() {
> return Collections.<Class<?
> ingleton(FrobnicatorResource.class);
> }
> would expect it to work.

Yes. The problem is that this is for a big application where, by design, we don't know what all the modules are for a given .ear file until deployment time. So we're going to rely on scanning, as I believe the specification implies we can. (If you return an empty set from both getClasses() and getSingletons() the classpath (there's the gray area) is scanned, as you know--the issue here is: is the classpath limited to the war file's lib and classes directories, or, instead, should it incorporate the ear/lib directory as well? As we've already discussed we both suspected that ear/lib should work; it doesn't.)

> > Will you, Paul, file the requisite bugs?
>
> Blimey where to start... this is gonna take some time
> for me as it
> will require precise reproducible test cases, and
> time is a scarce
> resource for me...

I didn't mean to push work on you; I just meant that you seem to already have a faint suspicion of where the problems lie. It's not a big deal; I can submit bugs and you can correct/edit them where I've made mistakes. I am currently planning on filing them against the webservices component, although I don't see your name on the CC list so that may not be the right component.

> BTW I suspect it may be much easier if you avoid
> using an ear. With
> EJB 3.1 it is not always necessary to use an ear.

Need the .ear file because of a resource adapter among other reasons.

Best,
Laird
[Message sent by forum member 'ljnelson']

http://forums.java.net/jive/thread.jspa?messageID=474535