Unable to finish WS call if shutdown is in progress - because of
ExceptionInInitializerError in TempFileManager.createTempFile
------------------------------------------------------------------------------------------------------------------------------
Key: AXIS2-4995
URL: https://issues.apache.org/jira/browse/AXIS2-4995
Project: Axis2
Issue Type: Improvement
Components: kernel
Affects Versions: 1.5.4
Environment: Windows XP, Java HotSpot(TM) Client VM (build 19.0-b09,
mixed mode)
Reporter: Dmitriy Lapko
Priority: Minor
Sometimes in order to have consistant data processing, it is important to
finish WS communication before system shutdown.
But in case, if axis2 configuration was not yet initialized before system was
requested to shutdown, an error occures during modules deployment:
org.apache.axis2.AxisFault: The system is attempting to engage a module that is
not available
When info logging is enabled for org.apache.axis2.deployment package, next
stack trace is shown in logs:
java.lang.ExceptionInInitializerError
at java.io.File.deleteOnExit(Unknown Source)
at
org.apache.axis2.deployment.util.TempFileManager.createTempFile(TempFileManager.java:88)
at org.apache.axis2.deployment.util.Utils.createTempFile(Utils.java:224)
at
org.apache.axis2.deployment.util.Utils.getURLsForAllJars(Utils.java:165)
at
org.apache.axis2.deployment.util.Utils.createClassLoader(Utils.java:899)
at
org.apache.axis2.deployment.repository.util.DeploymentFileData.setClassLoader(DeploymentFileData.java:115)
at
org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:65)
at
org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at
org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:659)
at
org.apache.axis2.deployment.RepositoryListener.init(RepositoryListener.java:251)
at
org.apache.axis2.deployment.RepositoryListener.init2(RepositoryListener.java:68)
at
org.apache.axis2.deployment.RepositoryListener.<init>(RepositoryListener.java:63)
at
org.apache.axis2.deployment.DeploymentEngine.loadRepository(DeploymentEngine.java:147)
at
org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:133)
at
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
at
dk.gov.oiosi.communication.client.AxisMercuryDispatcher.<init>(AxisMercuryDispatcher.java:166)
at
dk.gov.oiosi.communication.client.IAxisDispatcher$Factory.getDispatcher(IAxisDispatcher.java:90)
at dk.gov.oiosi.communication.Request.createProxy(Request.java:259)
at dk.gov.oiosi.communication.Request.getResponse(Request.java:298)
at
dk.gov.oiosi.raspprofile.communication.RaspRequest.getResponse(RaspRequest.java:160)
at dk.truelink.nemhandel.client.send.Sender.sendDocument(Sender.java:35)
at
dk.truelink.nemhandel.client.send.SendManagerThread.run(SendManagerThread.java:103)
Caused by: java.lang.IllegalStateException: Shutdown in progress
at java.lang.Shutdown.add(Unknown Source)
at java.lang.System$2.registerShutdownHook(Unknown Source)
at java.io.DeleteOnExitHook.<clinit>(Unknown Source)
So, the problem is in TempFileManager.createTempFile method, where temp folder,
to which modules are copied during deployment, is marked for JVM as requiring
delete on exit:
// Set the lock file to delete on exit so it is properly cleaned
// by the JVM. This will allow the TempFileManager to clean
// the overall temp directory next time.
lockFile.deleteOnExit();
What if this method will be surrounded with try/catch by
ExceptionInInitializerError with warning
Cannot mark folder to delete on exit because it is requested to be created
during shutdown process. It will not be cleared automatically. Folder:
"+lockFile.getAbsolutePath()
?
Like:
try {
lockFile.deleteOnExit();
} catch (ExceptionInInitializerError e) {
String warnMessage = "Cannot mark folder to delete on exit because it
is requested to be created during shutdown process. It will not be cleared
automatically. Folder: "+lockFile.getAbsolutePath();
Logger.getLogger(TempFileManager.class.getName()).warning(warnMessage);
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]