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
In my case I accidentally had these imports in the EJB after some copy-pasting:
import javax.ejb.*;
import javax.inject.Singleton;
The EJB looked like this:
@Singleton
public class MyService {
Maven build went thru but the class was not deployed as EJB. After removing import javax.inject.Singleton;
it worked fine.
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
.