JBAS014544: No EJB found with interface

前端 未结 2 1872
我寻月下人不归
我寻月下人不归 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: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.

提交回复
热议问题