Why an EJB Singleton Bean can be deployed twice
Issue
- EJB3 Singleton Beans with @Singleton annotation no singleton?
- Our application contain a bean annotated with @Singleton, @Startup and @PostConstruct and @PreDestroy methods in this class. This class is packaged into two different jar-files within the same EAR-file.
Why deploying this ear leeds to the fact that the @PostConstruct method is invoked twice. Undeploying will invoke the @PreDestroy annotated method twice? - I have an application which contains one SingletonBean implementation, but I see more instances of this bean if the server is started, what is the reason for this?
- Within EJB 3.1 specification singleton session beans are defined as: "... A Singleton session bean is a session bean component that is instantiated once per application. ..." but we have more instances of the same class!
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.