users@glassfish.java.net

JAX-RS in GF 2.1 and EJB injection?

From: <glassfish_at_javadesktop.org>
Date: Mon, 19 Apr 2010 14:20:13 PDT

I just started to implement a JAX-RS REST service in GF 3.
My implementation need to access EJBs which are deployed in the surrounding EAR of my WAR file.
To use the dependency injection (@EJB) I read about the need to add a @stateless annotation to my RESTservice class :

@Path("/workflow")
@Produces( { "application/xml","application/json" })
[b]@Stateless[/b]
public class WorkflowServiceHandler {
        [b]@EJB
        org.imixs.workflow.jee.ejb.WorkflowService workflowService;[/b]
        
        @GET
        @Path("/worklist/")
        public EntityCollection getWorkList(@DefaultValue("0") @QueryParam("start") int start,_at_DefaultValue("10") @QueryParam("count") int count ) {
                Collection<ItemCollection> col = null;
                try {
                        col = workflowService.getWorkList(null, start, count);
                        return buildEntityCollection(col);
                        
                } catch (Exception e) {
                        e.printStackTrace();
                }
                return new EntityCollection();
        }
...

This works as expected in Glassfish V3.
But now I try to get this run on a GF V2.1 server. I have added the jersey-core-1.1.5.1 and jersey-server-1.1.5.1 jars. So basically I have the functionality of jersey up and runing.

But the problem is the injected EJB in my code example. As I understand this will only work in GF 3 Server.

Now I want to ask if anybody have a solution for such a problem? I found this blog about a possible solution in GF 2.1:
http://blogs.sun.com/sandoz/entry/ejb_injection

But my problem is that I did not finally understand what I should do to get things run in GF 2.1.
Did anybody solved this situation yet?
Is it necessary/recommended to implement a EJB Provider class subclassed from the com.sun.jersey.spi.inject.InjectableProvider ?
 
I still did not found any working solution :(
Thanks for any help

Ralph
[Message sent by forum member 'rsoika']

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