Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.7
-
None
-
Windows/Linux
Description
We are getting exception while exporting chart SVG string to JPEG file.
Batik Version : 1.7
Exception :
java.lang.SecurityException: The application cannot install or remove a security manager when there is already one it place that it did not install.
Root cause:
In my webapplication, we already installed the security manager to perform some checks.Now when we try to export chart to JPEG we are invoking batik with arguments "-scriptSecurityOff".it is failed to pass the security checks due to my application is already installed security manager.
We are invoking batik Main.execute() method by passing arguments.
String[] inputArr =
{ "-scriptSecurityOff", "-m","JPEG", inputFileName };
(new org.apache.batik.apps.rasterizer.Main(inputArr)).execute();
After debugging the exception, we came to know there are security checks happening in ApplicationSecurityEnforcer.java.
Class Name : ApplicationSecurityEnforcer.java
Method Name : enforceSecurity(boolean enforce) {
if (sm != null && sm != lastSecurityManagerInstalled) {
// Throw a Security exception: we do not want to override
// an 'alien' SecurityManager with either null or
// a new SecurityManager.
throw new SecurityException
(Messages.getString(EXCEPTION_ALIEN_SECURITY_MANAGER));
}
Please let us know , how to resolve the issue without commenting above code in ApplicationSecurityEnforcer.java, when security Manager is already installed.
find the link somebody got the same kind of exception, but we don't have any solution in below link.
https://community.oracle.com/thread/1546085?start=0&tstart=0