On Sep 5, 2008, at 7:50 AM, ericp56 wrote:


I have an EJB that is successfully injected into my web service application:

package com.abc.ivr.scheduler;
@Stateless
public class CallScheduler implements ICallScheduler


it contains an EJB annotation for another EJB:

@EJB
private SysErrorEmail sysErrorEmail;


This ejb is in the same application in a different package:

package com.abc.ivr.common;
@Stateless
public final class SysErrorEmail implements ISysErrorEmail

There should be a warning prior to this that says the reference was not resolved.

You just need to update your ref from pointing at the bean class

  @EJB
  private SysErrorEmail sysErrorEmail;

To instead point at the business interface like so:

  @EJB
  private ISysErrorEmail sysErrorEmail;

In EJB 3.1 you will be able to refer to beans using the bean class itself, but in EJB 3.0 you must use a business interface.

We could definitely add a validation check to see if any refs didn't resolve for this reason and warn more explicitly about the mistake.

Note, with the above change you shouldn't need any openejb-jar.xml descriptor data, the annotation data will be enough for us to find the bean with the ISysErrorEmail interface.

-David

Reply via email to