josh
josh

Reputation: 21

in a J2EE application when does a listener get called?

I have a J2EE app and it has a listener in web.xml.

Listener contains a method called contextInitialized

I want to know when does contextInitialized actually get called?

From my reading I understand that it gets called when deploying the application. Can there be situations/scenario's where it could be called after the application has been deployed? Say that I am in a Clustered GlassFish app server environment. Could it be called after the application has been deployed?

Upvotes: 1

Views: 1010

Answers (1)

ZZ Coder
ZZ Coder

Reputation: 75456

It's called once when the application is first deployed. It shouldn't get called again if the application stays deployed.

However, the application may go through the undeploy/deploy cycle while the server is running. For example, you can set it up so that the application is redeployed when a file is changed in the directory.

Upvotes: 2

Related Questions