title: Is it possible to use ejb annotation and CDI in a legacy project where all the existing EJB are configured in ejb-jar.xml
body: <p>There is a legacy code base with the oldest EJB, where all the existing EJBS are configured in <code>ejb-jar.xml</code></p>
  
  <pre><code>&lt;ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1"&gt;
      &lt;session&gt;
          &lt;ejb-name&gt;ABean&lt;/ejb-name&gt;
          &lt;home&gt;com.bla.api.RemoteBeanHome&lt;/home&gt;
          &lt;remote&gt;com.bla.api.RemoteBean&lt;/remote&gt;
          &lt;ejb-class&gt;com.bla.api.ABean&lt;/ejb-class&gt;
          &lt;session-type&gt;Stateless&lt;/session-type&gt;
          &lt;transaction-type&gt;Container&lt;/transaction-type&gt;
      &lt;/session&gt;
  ....
  </code></pre>
  
  <p>This works by means of searching through JNDI. However, the server was upgraded to <em>Weblogic 12.2</em>, where <em>Java EE 7</em> is supported. So when injecting new <strong>local EJB</strong> to the remote session bean, <code>ABean</code>, I am thinking of using merely annotation, <code>@EJB</code>, without touching the existing XML deployment descriptor.</p>
  
  <p>However, there is the following error:</p>
  
  <pre><code>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.bla.api.NewBean" interface. Link or map this ejb-ref to its target EJB 
  and ensure the interfaces declared in the ejb-ref are correct.
  </code></pre>
  
  <p>The new local stateless ejb code is the following:</p>
  
  <pre><code>@Stateless
  public class TestEJB {
      public void test() {
          System.out.println("I am the first EJB injected with CDI");
      }
  }
  </code></pre>
  
  <p>Question: In this case, is it still possible to add new EJBs with annotation instead of <code>ejb-jar.xml</code>? </p>