1

I'm developing java web application using birt, when I run the application from eclipse it works as expected, but when I run it from netbeans or when I deploy it manually on tomcat , it bugs

Caused by: java.lang.IllegalArgumentException: securityDomain should be null if setSecurityController() was never called
at org.mozilla.javascript.Context.compileImpl(Context.java:2340)
at org.mozilla.javascript.Context.compileString(Context.java:1359)
at org.mozilla.javascript.Context.compileString(Context.java:1348)
at org.eclipse.birt.report.engine.javascript.JavascriptEngine$3.run(JavascriptEngine.java:240)
at org.eclipse.birt.report.engine.javascript.JavascriptEngine$3.run(JavascriptEngine.java:1)

how to fix it please?

4 Answers 4

2

I reported this as critical bug 429944 a few days ago, you should vote for it in bugzilla.

As far as i know, there are 2 possible workarounds:

Option 1: If possible disable the security management of your Tomcat server. By default it is disabled, but it seems in your context it is not. Check if argument "-security" is used to start Tomcat, and try to remove it.

Option 2: as suggested in the bug description there are two methods that should be changed in the source code of birt for a quick fix.

Sign up to request clarification or add additional context in comments.

3 Comments

I disabled the security manager, but the open source library net.nicholaswilliams.java.licensing, that I use in my project create a new one, that's why the exception persist
In that case, since the securityManager cannot be disabled in this licensing library, im afraid you need to patch BIRT as mentionned in the bugzilla link i joined. Or may be patch the licensing library to prevent it to create a SecurityManager
I can confirm that following the recommendation on bug 429944 comment 7 works fine. I am using the exact same verson of the BIRT runtime JAR the OP indicated.
1

Try putting System.setSecurityManager(null); in to your code before you call the report. You should only need to do this once per JVM instance.

6 Comments

But you also need to consider the impact of setting it to null. See stackoverflow.com/questions/19487407/….
@radimpe - the link talks only about applets - I'd assumed that this was server side only. You're right though, if this is an applet, switching off the security manager is a bad idea. If it's server side, you still need to consider what effect ( if any ) explicitly switching off the security manager would have, but in my experience, the majority of web apps tend not to run with a security manager enabled
thanks for your reply, I'm trying your solution and now I've a new bug Caused by: java.lang.SecurityException: Setting a SecurityManager other than the LicenseSecurityManager is prohibited. at net.nicholaswilliams.java.licensing.LicenseSecurityManager.checkPermission(LicenseSecurityManager.java:260)
have you added the net.nicholaswilliams.java packages your self, or are they part of birt?
I've added it my self
|
0

I use birt runtime 4.2.2 instead of using the 4.3.1 version , every thing work fine now, even without disabling security manager. thank you, all of you for your help

Comments

0

you should not deactivate the security manager ! a hint here to bypass the error :

Context context = Context.enter( );
context.setSecurityController( ScriptUtil.createSecurityController( ) );

these two lines should resolve the issue. I found that in org.eclipse.birt.report.engine.javascript.JavascriptEngineFactory class file, so basically you would prefer a call directly to the class JavascriptEngineFactory to initialize everything in a good way.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.