title: Changing an EJB from 2.1 to 3.0
body: <p>I have an existing Web Application (Servlet) that remotely accesses an EJB currently written to the EJB 2.1 Specification (<code>EJBHome</code>, <code>EJBObject</code>, <code>SessionBean</code>, all configuration in <code>ejb-jar.xml</code>).  The servlet access the EJB via JNDI lookup, the JNDI name being specified in <code>weblogic-ejb-jar.xml</code>.</p>
  
  <p>I would like to update the EJB to EJB3.0, which will (hopefully) make it easier to add to the API.</p>
  
  <p>My issue is that I need to do it with a minimum of change to the existing servlet code.  In other words, I still need to:</p>
  
  <ol>
  <li>Access the EJB with a <em>simple</em>, global JNDI name (it is stored in a database, and the servlet can can change the name it looks up on the fly), and</li>
  <li><p>Be able to use the 2.1 style:</p>
  
  <pre><code>String jndiName = getJndiName();    // e.g. "BeanV2.0"
  BeanHome home = (BeanHome) PortableRemoteObject.narrow(
          jndiContext.lookup(jndiName), BeanHome.class);
  BeanRemote remote = home.create();
  remote.doBusiness();               // call business method
  </code></pre></li>
  </ol>
  
  <p>I have tried a stripped down version, applying <code>@RemoteHome</code>, but I keep getting errors during deployment.</p>
  
  <p>I am deploying (for development/production) on Weblogic, mostly 10.3.5 (11gR1), and am limited to EJB 3.0.  I am using Eclipse (with the Oracle Weblogic Pack) for development.</p>
  
  <p>Thanks.</p>