I am new to Java EE and am using JBoss 7 to create my first project. I have an EAR project, an EJB project, WEB project and a JPA project in my workspace. The ejb created in the
Your file structure looks alright.
So, where is the problem ?
@Localbean
should be used inside your EJB bean only when your EJB is not extending interface. @Local
can be used for interface and then extending your EJB with the interface or using @Local
straingh inside your no-interface EJB. But @Localbean
is only used for no-interface EJB. So, what you are doing is not right.
Since you are extending interface, do as below:
Interface
@Local
public interface StockManagementBeanJpa
{
....
}
EJB
@Stateless
public class StockManagementBeanJpaBean implements StockManagementBeanJpa
{
....
}
Do this for all EJBs.
I want to point out 1 more thing that @Local
will work in your case because you are calling EJBs from the same application (same EAR). This will not work in the case of cross application call(different EAR, WAR ...) or remote client calling your EJB. In this case, you will need @Remote
.