title: Could not resolve @EJB reference:
body: <p>I am trying to implement EJBs in my project but keep getting the same error when deploying to JBoss AS 6 (Final).</p>
  
  <p>I have two classes:</p>
  
  <pre><code>@Stateless
  @Local(ForecastReturnService.class)
  @TransactionAttribute(TransactionAttributeType.REQUIRED)
  public class ForecastReturnServiceImpl implements ForecastReturnService {
  
  private static final Logger logger = LoggerFactory
          .getLogger(ForecastReturnServiceImpl.class);
  
  @PersistenceContext
  protected EntityManager em;
  }
  </code></pre>
  
  <p>and the other EJB:</p>
  
  <pre><code>@Stateless
  public class CacheManagementServiceImpl implements CacheManagementService {
  
  @EJB
  private ForecastReturnService forecastReturnService;
  }
  </code></pre>
  
  <p>The error message is with regards to 'forecastReturnService' bean that I am trying to inject:</p>
  
  <pre><code>DEPLOYMENTS IN ERROR:
    Deployment "vfs:///C:/jboss/jboss-6.0.0.Final/server/default/deploy/webui.war" is in error due to the following reason(s): java.lang.RuntimeException: Could not resolve @EJB reference: [EJB Referenc
  e: beanInterface 'com.ls.forecast.jpa.ForecastReturnService', beanName 'null', mappedName 'null', lookupName 'null', owning unit 'ComponentDeploymentContext@16939526{org.jboss.metadata.ejb.jboss.JBoss
  EnterpriseBeanMetaData.CacheManagementServiceImpl}'] for environment entry: env/com.ls.forecast.webui.business.CacheManagementServiceImpl/forecastReturnService in unit ComponentDeploymentContext@16939
  526{org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData.CacheManagementServiceImpl}
  
      at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.0.GA]
      at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.0.GA]
      at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.0.0.Final]
      at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:107) [:0.2.2]
      at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:135) [:6.0.0.Final]
      at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]
      at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
      at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
      at java.lang.Thread.run(Thread.java:619) [:1.6.0_20]
  </code></pre>
  
  <p>I noticed the following message in the JBoss console:</p>
  
  <pre><code>13:34:27,681 WARN  [MappedReferenceMetaDataResolverDeployer] Unresolved references exist in JBossMetaData:[#CacheManagementServiceImpl:AnnotatedEJBReferenceMetaData{name=com.ls.forecast.webui.business
  .CacheManagementServiceImpl/forecastReturnService,ejb-ref-type=null,link=null,ignore-dependecy=false,mapped/jndi-name=null,resolved-jndi-name=null,beanInterface=interface com.ls.forecast.jpa.ForecastR
  eturnService}, #EntityForecastReturnResultServiceImpl:AnnotatedEJBReferenceMetaData{name=com.ls.forecast.webui.business.EntityForecastReturnResultServiceImpl/entityForecastReturnProcessor,ejb-ref-type
  </code></pre>
  
  <p>Any help would be much appreciated! Seems like I am missing something in the plumbing...</p>
  
  <p>I would like to add that if I add the following to the @EJB annotation, it seems to get rid of the error:  </p>
  
  <pre><code>@EJB(lookup="com.ls.forecast.jpa.ForecastReturnService/local")
  private ForecastReturnService forecastReturnService;
  </code></pre>
  
  <p>Not sure why I would have to specify the local interface since I have seen many examples/tutorials with @EJB only.  Why would I need to specify the local interface?</p>