On Windows, deploying an application using --precompilejsp=true can
lock JAR files in the application, causing later undeployment or redeployment
to fail.
If you request precompilation of JSPs when you deploy an application
on Windows, later attempts to undeploy that application or to redeploy it
(or any application with the same module ID) will not work as expected. The
problem is that JSP precompilation opens JAR files in your application but
does not close them, and Windows prevents the undeployment from deleting those
files or the redeployment from overwriting them.
Note that undeployment succeeds to a point, in that the application
is logically removed from the Application Server. Also note that no error
message is returned by the asadmin utility, but the application's
directory and the locked jar files remain on the server. The server's log
file will contain messages describing the failure to delete the files and
the application's directory.
Attempts to redeploy the application after undeploying fail because
the server tries to remove the existing files and directory, and these attempts
also fail. This can happen if you try to deploy any application that uses
the same module ID as the originally deployed application, because the server
uses the module ID in choosing a directory name to hold the application's
files.
Attempts to redeploy the application without undeploying it first will
fail for the same reasons.
Diagnostics
If you attempt to redeploy the application or deploy it after undeploying
it, the asadmin utility returns an error similar to the one below.
An exception occurred while running the command. The exception
message is: CLI171 Command deploy failed : Deploying application in
domain failed; Cannot deploy. Module directory is locked and can't
be deleted.
|
Solution
If you specify --precompilejsps=false (the default setting)
when you deploy an application, then this problem will not occur. Be aware
that the first use of the application will trigger the JSP compilation, so
the response time to the first request will be longer than for later requests.
Note also that if you do precompile, you should stop and restart the
server before undeploying or redeploying the application. The shutdown frees
the locked JAR files so the undeployment or redeployment after the restart
can succeed.
|