views:

455

answers:

2

Hey guys,

I have the following setup:

JBoss 4.2.3
under that i have:

 
--> Project A  (Wich is not SEAM 2.1.2GA based)
    EJBs:
       * beanA (JNDI = beanA/remote)
       * beanB (JNDI = beanB/remote)

--> Project B  (SEAM based)
    EJBs / Components:
       * ComponentX
       * ComponentY

On component X i have the current piece of code:

@Scope(ScopeType.CONVERSATION)
@Name("ComponentX")
public class ComponentX implements java.io.Serializable { 
...
@EJB
beanAInterface beanA;
....
public foo(){
    beanA.bar();  // <--------- beanA is null, even with mapped name and etc, only works
                  //            if i direct lookup with Context().lookup("beanA/remote")
}

Any ideias on how to solve this?

Thanks in advance.

}

+2  A: 

Your ComponentX class is not an EJB, so you cannot use the @EJB annotation to inject them. You have a few options. Convert your ComponentX to EJB adding @Stateless or @Statefull and an interface @Local or @Remote, in this way the AS will notice ComponentX is an EJB and will know what to do with the desired injection. The other option is let the ComponentX as simply a component and use InitialContext#lookup for obtaining the reference to "beanA/remote" by hand.

diega
Worked like a charm, thanks!
Kamia
A: 

Do you have any working example with this solution??

Thx

Question