Surendra Babu Kunka created BATIK-1079:
------------------------------------------

             Summary: SecurityException while generating JPEG from SVG string 
using batik
                 Key: BATIK-1079
                 URL: https://issues.apache.org/jira/browse/BATIK-1079
             Project: Batik
          Issue Type: Bug
          Components: SVG Rasterizer
    Affects Versions: 1.7
         Environment: Windows/Linux
            Reporter: Surendra Babu Kunka


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



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-h...@xmlgraphics.apache.org

Reply via email to