title: Is inheritance allowed for EJB3 Stateless Session Beans?
body: <p>Suppose I have a stateless bean:</p>
  
  <pre><code>@Stateless(name = "fooBean")
  @LocalBean
  public class Foo {
  ...
  }
  </code></pre>
  
  <p>I want to create a mock for testing (with CDI)</p>
  
  <pre><code>@Alternative @Specializes
  public class FooMock extends Foo {
  ...
  }
  </code></pre>
  
  <p>I register the mock in <code>beans.xml</code>, and when I run it with OpenEJB, I get the following exception:</p>
  
  <pre><code>...
  Caused by: javax.naming.NameAlreadyBoundException:
  openejb/Deployment/fooBean/com.company.Foo!LocalBeanHome
  </code></pre>
  
  <p>It seems to me that the container creates an interface for <code>Foo</code> because of <code>@LocalBean</code> which is now implemented by <code>FooMock</code>, too. OpenEJB tries to bind the two classes with the with same name of same generated interface, which is not possible.</p>
  
  <p>Of course, if I comment out <code>@Stateless</code> and <code>@LocalBean</code> in <code>Foo</code> class, it works fine.</p>
  
  <p>Any idea or suggestion to solve this?</p>