JBoss Community

Re: Access EJB from different WAR in JBoss AS via injection

created by Robby Cornelissen in EJB3 - View the full discussion

I got it to work using the following approach:

 

  1. Define EJBs as resources using the @Produces annotation:

    
    public class Resources {
              @Produces
              @EJB(lookup = "java:global/.../WhateverService")
              private WhateverService whateverService;
    }
    

     

 

 

# Inject the EJB resources in your bean using the @Inject annotation: {code}// ...

 

@Inject

private WhateverService whateverService;

 

// ...

{code}

 

Works like a charm. I'm also using a similar CDI view scope approach.

Reply to this message by going to Community

Start a new discussion in EJB3 at Community