Unsatisfied dependencies for type […] with qualifiers [@Default] at injection point (using @Stateful EJB with CDI)

前端 未结 5 845
被撕碎了的回忆
被撕碎了的回忆 2021-01-03 23:56

I have the following code to manage two kinds of repositories. Both repository classes inherit an interface to allow reinitialization of their resources.

pub         


        
5条回答
  •  攒了一身酷
    2021-01-04 00:30

    I had the same problem with this misleading exception...

    By adding @Stateful to UserRepository you expose EJB methods of the CachingRepository interface without having a no-interface view declared. Add @LocalBean to UserRepository to activate the no-interface view. See EJB 3.1 Specification, Section 4.9.8 "Session Bean's No-Interface View"

    The bean class must designate that it exposes a no-interface view via its bean class definition or in the deployment descriptor. The following rules apply:

    • ...
    • If the bean exposes at least one other client view, the bean designates that it exposes a no-interface view by means of the @LocalBean annotation on the bean class or in the deployment descriptor.
    • ...

    I also refer to this stackoverflow answer for more information about no-interface views.

提交回复
热议问题