Here is the situation.
I\'ve got the following interfaces:
public interface Parent { }
public interface ChildOne extends Parent { }
public interf
Better late than never:
Annotating the SLSB aditionally with @LocalBean
works for me with JBoss AS 7.1.1. I don't like the idea of creating the interface for no added value.
Using your example:
@Stateless
@LocalBean
public class FirstBean implements ChildOne { }
@Stateless
@LocalBean
public class SecondBean implements ChildTwo { }
Have you tried using @EJB annotation rather then the CDI @inject annotation?
E.g.
@Named
@SessionScoped
public class TestController implements Serializable {
@EJB
private FirstBean firstBean;
@EJB
private SecondBean secondBean;
}
I just played around with your construct, read a bit of the weld docu and found out the following.
You are using EJBs that implement an interface, so the no-interface view is not possible anymore (obviously), but you are trying to directly access the implementation. As soon as you declare it as an EJB you have to keep in mind the conventions. So, if you define an interface you have to use it to get access to the EJB. Changing it to the following, should work out:
@Inject
private ChildOne firstBean;
Accessing the implementation even though an interface is defined is just possible for plain CDI Managed Beans (classes without the @Stateless/@Stateful annotations). So get rid of your annotation and it will work out.
Just for your information, if you are using Glassfish. If you stick to your EJBs and try to access the parent interfaces method you will run into this bug / exception.