Thanks Paul, the first workaround sounds better for me, I'm goin' to try
that, would be nice if jersey could threat that for me though.
Thanks.
On 10/21/09 9:05 AM, "Paul Sandoz" <Paul.Sandoz_at_Sun.COM> wrote:
> Hi,
>
> Felipe, this is not about injecting EJBs into resource classes [*]. It
> is about a resource class *being* an EJB, in this case a stateless
> session bean POJO.
>
> When looking up the reference to the SSB using JNDI a reference to the
> interface is returned instead of a reference to the POJO. Ken can
> confirm but that i think that is a spec requirement.
>
>
> You need to do the following:
>
> 1) declare the annotated methods on the interface; and
>
> 2) remove the annotations on the implementing methods.
>
> @Stateless
> @Path(³root²)
> public class RootResource implements IFace {
> public String get() { return ³lol²; }
> }
>
> public interface IFace {
> @GET
> public String get() { return ³lol²; }
> }
>
>
> Jersey uses the annotations on the Java method to determine what
> Method instance should be utilized for invocation. The returned
> reference, a proxy, from JNDI is not an instance of RootResource.
> Hence the error.
>
> I think Jersey can be modified in two ways:
>
> 1) Always use the Method instance from an interface (if present) for
> invocation; and
>
> 2) Log an error if the SSB class implements annotated methods that are
> not declared on an interface (if present).
>
> Paul.
>
> [*] If you are using the latest GF v3 and you annotate your resource
> class with @ManagedBean you will no longer require the custom EJB
> provider.
>
>
> On Oct 21, 2009, at 12:12 PM, glassfish_at_javadesktop.org wrote:
>
>> Yes, Jersey cannot inject EJBs.. you should use an EJB Provider...
>>
>> in my project I have an example:
>>
>> http://kenai.com/projects/puj/sources/arena/show/arena-http/src/main/java/com
>> /kenai/puj/arena/http
>> [Message sent by forum member 'felipegaucho' (fgaucho_at_gmail.com)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=368770
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>