Why would you want to stop the application from being undeployed, when the server itself is being shutdown? And when you say shutdown, does it mean intentional shutdown or server going down for other reasons. Just trying to understand, whether you are thinking of making your application highly available, in which case you might look for clustering.
It is intentional shutdown.
I will elaborate why it may be required.
We have a ear of the application. After deploying some post configuration settings are required.
But if the Server undeploys the application everytime on server shutdown those post configuartions will be required on every startup.
Otherwise we need to have it pre-configured before preparing ear. i.e seperate ear for every deployment on new server, which is not the best way to do,
So was wondering there must be some configuration setting in JBoss that will not undeploy application when Server is stopped.
Please help me on this.
There's no such thing as avoiding undeployment of an application when the server is brought down(or atleast, i am not aware of such a option). What sort of post configuration are you doing in your application? Is it some manual file changes that you do. If this is the case then you wont have to worry about doing it again and again since whatever changes you might have done to the files wont be undone on server restart. If it is something else other than manual file changes, then you might think of doing those things in a MBean which will be invoked when your application is being deployed. So it all depends on what sort of post configurations you are doing.
How are you deploying your application? The diferent ways I know of are 1) via jmx-console, 2) copying to deploy directory, 3) via jsr-88 api.
We are using the scond approach i.e copyingthe ear to deploy directory
I was just making sure you were not using JSR-88 to deploy, and you are not, which is good.
Now I will echo the question that jaikiran already posted: What sort of post configuration are you doing in your application? And more importantly, how are you doing those changes (i.e., via MBEan operation calls)?
Ourapp ear inturn contains 2 wars , there are some properties files inside it.
Say these properties files stores some config information wrt the machine on which it is installed & deployed.
So after deployment we change this properties files either manually or through a script & everything works.
But as JBoss shutdown is undeploying the application those changes are lost when JBoss starts again.
Is it some way to avoid the undeploying of application ?
there is better way to handle post-configuration of files.
You say that you are changing the properties files after deployment. You are not by any chance changing those files in the tmp/deploy directory? That directory is a temporary working directory, not a permananent deployment location (yes, I know that other app servers "hide" deployed applications within wierdly named subdirectories, but JBoss is not among them - what you see in the "deploy" directory is what is deployed).
Try this - deploy your app as an exploded set of files within directories, rather than packaged up within war and ear files. For example, assume you have xxx.ear which contains aaa.war and bbb.war. Under the deploy directory, create a directory named xxx.ear. In that directory create two more directories aaa.war and bbb.war. Into those directories place the contents of the two war files. Also, in the xxx.ear directory place the rest of the contents that would have been in the ear file, such as the META-INF/application.xml file.
Now, you can, for instance, modify deploy/xxx.ear/aaa.war/WEB-INF/classes/log4j.properties and that change will persist across reboots of the app server.
Thanks for the tip.
ya i changed the ear to exploded stuff as suggested by u and it works.