I am working with
EJB 3.0 in which we don't require deployment descriptors... EJB 3.0 has given a feature of dependency injection which will automatically inject the dependeny if you try to look up a JNDI or resource present in the same EAR....
But i am not able to call a EJB from a EJB resides in the other EAR package...
I have 2 EAR packages....
SampleEJB301
+ com.ibm.sample
IEchoSample301
EchoSample301 (Implementation of the IEchoSample301)
+ META-INF
ejb-jar.xml
weblogic-ejb.jar.xml
SampleEcho301 & SampleEcho2Client has been packaged into a EAR SampleEAR1
---------------------------------------------------------------------------
SampleEcho2Client
+ com.ibm.sample
IEchoSample302
SampleEJB302
+ com.ibm.sample
EchoSample302 (Implementation of the IEchoSample302)
+ META-INF
ejb-jar.xml
weblogic-ejb.jar.xml
SampleEcho2Client & SampleEcho302 EJB has been packaged into a EAR SampleEAR2
Now i want to call EchoSample302 from EchoSample301...
Can anybody help me to find the solution for this.. I tried to find a lot on google but not able to find any solution....
Error resolving ejb-ref 'echoSample302' from module 'SampleEJB301.jar' of application 'SampleEARa'. The ejb-ref does not have an ejb-link and the JNDI name of the target bean has not been specified. Attempts to automatically link the ejb-ref to its target bean failed because no EJBs in the application were found to implement the 'com.ibm.sample.IEchoSample303' interface. Please link or map this ejb-ref to its target EJB and ensure the interfaces declared in the ejb-ref are correct.
My Code
------
@Stateless(name="echoSample301")
public class EchoSample301 implements IEchoSample301 {
@EJB(name="echoSample302")
private IEchoSample302 echoSample302;
public void setEchoSample302(IEchoSample302 echoSample302){
this.echoSample302 = echoSample302;
}
public IEchoSample302 getEchoSample302(){
return echoSample302;
}
public void echo301() {
System.out.println("Hello Echo301");
echoSample302.echo302();
}
}
@Stateless(name="echoSample302")
public class EchoSample302 implements IEchoSample302 {
public void echo302() {
System.out.println("Hello Echo302");
}
}