Source:OCP JavaEE 6 EJB Developer Study Notes by Ivan A Krizsan,Version: April 8, 2012
Hi All,
Below is the Code for Singleton Session Bean and Client Servlet that accesses the Bean.
Singleton Session Bean
Client Servlet
Below is the messages logged server.log:
Request Issued:
http://localhost:8080/BusinessMethodInterceptors/
http://localhost:8080/BusinessMethodInterceptors/test.do
Here,BusinessMethodInterceptors is the name of Web Project.
As per my understanding,Singletion Session Bean is instantiated once per application per class.
However, in the server.log I see that it is Instantiated(Created) twice in application (See message "INFO: *** SingletonSessionBeanA - Created" is displayed twice)
Please advise if my understanding is incorrect.