@Singleton, @Startup, @PostConstruct doesn't work on EJB3.1 and Glassfishv3.0.1

前端 未结 1 1840
我寻月下人不归
我寻月下人不归 2020-12-19 08:57

I have a problem with this setup and I can\'t even view the logs.

This is my @Singleton @Startup EJB:

@Singleton
@Startup
@         


        
相关标签:
1条回答
  • 2020-12-19 09:43

    You have invalid type of bean as an attribute of @DependsOn. DependsOn is for expressing dependency between two Singleton session beans, not between Singleton and Stateless. You should change SchedulerEJB to be Singleton or remove dependency.

    If you decide change SchedulerEJB to Singleton, then @DepensOn is also not needed, because (from EJB 3.1 specification):

    Note that if one Singleton merely needs to invoke another Singleton from its PostConstruct method, no explicit ordering metadata is required. In that case, the first Singleton would merely use an ejb reference to invoke the target Singleton. There, the acquisition of the ejb reference (either through injection or lookup) does not necessarily imply the actual creation of the corresponding Singleton bean instance.

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