java web start InvocationTargetException with java 9 ea -
we have java web start application that's working on java 8, when running on java 9 crashes. application loads new javafx scene contains webview shows web page contains menu, menu contains different buttons, each button opens new window content uses thinlet. security reasons, we're encrypting jar. when run application replace classloader our own classloader first dencrypt encrypted classes of jar. on click of buttons use our own classloader call encrypted class using reflection , make default classloader of class our own, rest of classes able launched after dencrypt it. that's working fine until java 9. on running application on java 9, first time click of buttons application launched after every time click buttons i'm getting java.lang.reflect.invocationtargetexception caused java.lang.nullpointerexception @ jdk classes. trace different among different button there's common part, here exception on running simple sample:
java.lang.reflect.invocationtargetexception @ java.base/jdk.internal.reflect.nativemethodaccessorimpl.invoke0(native method) @ java.base/jdk.internal.reflect.nativemethodaccessorimpl.invoke(unknown source) @ java.base/jdk.internal.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.base/java.lang.reflect.method.invoke(unknown source) @ com.glt.cryptoclass.decryptingclassloader$privilegedlaunch.run(decryptingclassloader.java:56) @ java.base/java.security.accesscontroller.doprivileged(native method) @ com.glt.cryptoclass.decryptingclassloader.launch(decryptingclassloader.java:179) @ com.glt.replace.browser$1.call(browser.java:58) @ com.glt.replace.browser$1.call(browser.java:42) @ javafx.graphics/javafx.concurrent.task$taskcallable.call(unknown source) @ java.base/java.util.concurrent.futuretask.run(unknown source) @ java.base/java.lang.thread.run(unknown source) caused by: java.lang.nullpointerexception @ java.desktop/java.awt.window.addtowindowlist(unknown source) @ java.desktop/java.awt.window.init(unknown source) @ java.desktop/java.awt.window.<init>(unknown source) @ java.desktop/java.awt.frame.<init>(unknown source) @ com.thinlet.framelauncher.<init>(framelauncher.java:32) @ com.glt.replace.start.miau(start.java:32) @ com.glt.replace.start.main(start.java:22) ... 12 more i've been reasearching long time , i've seen maybe had open , export modules in order make work. i've open , export @ jnlp next modules:
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" java-vm-args="--add-opens=java.management/sun.management=all-unnamed --add-opens=java.base/java.lang=all-unnamed --add-opens=java.base/java.util=all-unnamed --add-opens=java.base/java.security=all-unnamed --add-opens=java.base/java.lang.reflect=all-unnamed --add-opens=java.base/java.util.concurrent=all-unnamed --add-opens=java.base/java.io=all-unnamed --add-opens=java.desktop/java.awt=all-unnamed --add-exports java.management/sun.management=all-unnamed --add-exports java.base/java.lang=all-unnamed --add-exports java.base/java.util=all-unnamed --add-exports java.base/java.security=all-unnamed --add-exports java.base/java.lang.reflect=all-unnamed --add-exports java.base/java.util.concurrent=all-unnamed --add-exports=java.desktop/java.awt=all-unnamed --add-modules=java.xml.ws"/> moreover, i've ran jdep -jdkinternals command see if i'm using conflictive library i'm not getting anything.
furthermore, if run application without encryptation, or encryptation locally, works properly. can point me doing wrong? or has idea of why behaving different on running remotly whith jnlp when run locally?
i add code helpfull: main class(contains web engine):
public void start(stage primarystage) throws exception { this.stage = primarystage; swingutilities.invokelater(this); } public void run() { initandshowgui(); } /** * invokes platform run later start application * on event dispatcher */ private void initandshowgui() { platform.runlater(new runnable() { public void run() { initfx(stage); } }); } /** * initialise stage parameter * @param stage stage initialise */ private void initfx(stage stage){ // browser = new browser(); browser = new browser(); scene = new scene(browser,1050,700,color.web("#666970")); stage.setscene(scene); stage.settitle("test"); scene.getstylesheets().add("webviewsample/browsertoolbar.css"); stage.show(); //edit action on close stage.setoncloserequest(new eventhandler<windowevent>() { @override public void handle(windowevent event) { // try { // //warning uninstall javaws applications todo fin way know jnlp path // runtime.getruntime().exec("javaws -uninstall"); // } catch (ioexception ex) { // ex.printstacktrace(); // } system.out.println("info: stage closing..."); platform.exit(); system.exit(0); } }); } /** * class extends region , implements handler * html content home applet web page * @param args */ public static void main(string[] args){ string base = ""; system.out.println("telekey.telekeyjnlp.main(). debug: reading arguments."); for(string arg : args){ system.out.println("telekey.telekeyjnlp.main(). debug: argument: " + arg); if(arg.contains(base_url) || arg.contains(short_base_url)){ system.out.println("telekey.telekeyjnlp.main(). debug: argument found."); string []parts = arg.split(argument_separator); if(parts.length > 1){ system.out.println("telekey.telekeyjnlp.main(). debug: setting base url."); base = parts[1]; } } } if(base.isempty()){ system.out.println("telekey.telekeyjnlp.main(). debug: base url empty, setting base url " + default_tk); base = default_tk; } launch(args); } our own webengine:
public void launch(final string classname, final string[] args) { try { initwebview(); //start new thread new window javafx.concurrent.task configtask = new javafx.concurrent.task<void>() { @override protected void call() { //modconfig.main(args) // modbrowser.main(args); try { if (dcl == null) { keygetter key = new keygetter("https://www.telekey.nl/", "getreplacekeydetails.jsp"); // key.fetchkeydetails(); system.out.println(".actionperformed(): debug. key details: " + key.getalgorithm() + "\n" + key.getcypherdesc() + "\n" + key.getrawkey()); dcl = new decryptingclassloader(key); } class[] partypes = {string[].class}; dcl.launch(classname, "main", args, partypes, true); } catch (exception ex) { ex.printstacktrace(); } { return null; } } }; new thread(configtask).start(); } catch (exception ex) { ex.printstacktrace(); } } public void processnewlocation(string newlocation){ string []args = null; if(newlocation != null && !newlocation.equals("https://www.google.nl/")){ launch("com.glt.replace.start", args); } } public void initwebview() { if (getchildren().contains(browser)) { getchildren().remove(browser); } browser = null; browser = new webview(); webengine = browser.getengine(); //set user agent indicate on java fx webview webengine.setuseragent(webengine.getuseragent() + " javafx-webview"); webengine.setjavascriptenabled(true); webengine.locationproperty().addlistener((observablevalue<? extends string> observable, string oldlocation, string newlocation) -> { processnewlocation(newlocation); }); webengine.load("https://www.google.nl/"); // works not have style getchildren().add(browser); } the class run on change search on google(change location):
public static void main(string[] args) { start s = new start(); s.miau(); } private void miau() { framelauncher f = new framelauncher("secundary", new thinlet(), 300, 300); system.out.println("com.glt.main.start.main(). debug: miau!!"); f.setvisible(true); } update:
i've found problem coming on set security manager. if comment line, simple program works. however, have replace classloader in order have permissions. know reason of why cannot set security manager @ javafx9 application? or, doing wrong? application signed using jarsigner.
update 1: i've send bug request java here url it: https://bugs.openjdk.java.net/browse/jdk-8186568
Comments
Post a Comment