JBAS014544: No EJB found with interface

前端 未结 2 1871
我寻月下人不归
我寻月下人不归 2021-02-09 23:51

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

相关标签:
2条回答
  • 2021-02-10 00:14

    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.

    0 讨论(0)
  • 2021-02-10 00:25

    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.

    0 讨论(0)
提交回复
热议问题