[jboss-user] [EJB 3.0] - Re: How to inject sessionbean from sessionbean from another

j-n00b do-not-reply at jboss.com
Tue Jan 27 04:53:49 EST 2009


Hey there!

I have a similar question, but the @RemoteBinding Solution doesn't work. 

My JBoss AS 5.0.0.GA runs in "all" mode, because I need clustering capabilities. I have a usual EJB_JAR in folder "deploy" and a SAR in "deploy-hasingleton". The SAR contains an MBean which uses a SLSB defined in the EJB-JAR:
public class Master implements MasterMBean {
  | 
  | @Resource(mappedName = Calculator.JNDI_NAME)
  | private Calculator additionBean;
  | 
  | // ... MBean stuff

The Bean is just a simple Calculator, which adds the given numbers:
@Clustered
  | @Stateless(mappedName = Calculator.JNDI_NAME)
  | @Remote(Calculator.class)
  | public class CalculatorBean implements Calculator {
  | 
  |   public long add(int... summands) {
  |     long result = 0;
  | 
  |     for (int i : summands) {
  |       result += (long) i;
  |     }
  |     return result;
  |   }
  | }

When starting the server, the MBean can't use the Calculator, behause it was not injected. But the injection works pretty fine for a SLSB defined in a second EJB-JAR.

Is this a problem with the two different deploy folders? Or am I doing something wrong?

Thanks,
Andre

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4204918#4204918

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4204918



More information about the jboss-user mailing list