AdoptOpenJDK / IcedTea-Web

The new home for IcedTea-Web
Other
225 stars 87 forks source link

Not able to open the JNLP with Java 11 from IcedTea-Web #863

Open bvenkate opened 2 years ago

bvenkate commented 2 years ago

Dear Team,

We are facing issue while opening JNLPs from desktop with the combination of IcedTea + Oracle Java 11. The below is the error. Can you please check and give us pointers to fix this issue? Please let me know for further information. Thanks!

java.lang.reflect.InvocationTargetException
        at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1367)
        at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1342)
        at net.sourceforge.swing.SwingUtils.callOnAppContext(SwingUtils.java:149)
        at net.sourceforge.jnlp.runtime.AppletEnvironment.startApplet(AppletEnvironment.java:194)
        at net.sourceforge.jnlp.Launcher.launchApplet(Launcher.java:658)
        at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:949)
Caused by: java.lang.NoSuchMethodError: java.lang.SecurityManager.checkTopLevelWindow(Ljava/lang/Object;)Z
        at oracle.ewt.util.ClipboardProxy.getSystemClipboard(Unknown Source)
        at oracle.forms.engine.Runform.initClipboard(Unknown Source)
        at oracle.forms.engine.Runform.startRunform(Unknown Source)
        at oracle.forms.engine.Main.createRunform(Unknown Source)
        at oracle.forms.engine.Main.start(Unknown Source)
        at net.sourceforge.jnlp.runtime.AppletEnvironment$2.run(AppletEnvironment.java:202)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
janakmulani commented 2 years ago

I have JAVA_HOME pointing to Oracle 11.0.11. Starting icedtea-web javaws.exe works out of the box.

Does your application use a class that is missing in Java 11. In that case you may have ot add --add-export module to the itw-modularjdk.args file in the \icedtea-web-image\bin directory.

bvenkate commented 2 years ago

thanks for your reply.

I have added the below in itw-modulearjdk.args file. How do we create the below packages to be available for running application? Can you please provide any example on how to add the modules?

--add-exports=java.desktop/java.awt.event=ALL-UNNAMED,java.desktop
--add-exports=java.base/java.security=ALL-UNNAMED,java.security
--add-exports=java.base/java.lang=ALL-UNNAMED,java.desktop
--add-exports=java.base/java.net=ALL-UNNAMED,java.desktop
--add-exports=java.base/java.security=ALL-UNNAMED,java.desktop
janakmulani commented 2 years ago

Caused by: java.lang.NoSuchMethodError: java.lang.SecurityManager.checkTopLevelWindow(Ljava/lang/Object;)

Your application is using Oracle Forms which is using SecurityManager Some methods have been removed in Java 11. You will need to port you app to run with JRE 11.

marcolinuxbr commented 2 years ago

Hi! I am facing a similar issue. My jar is a multi-release jar.

Works in terminal (both java8 and java11).

But dont work when called from jnlp/webStart, with icedtea/javaws. It seems that javaws ignore the correct version of the class or disable multi-release jars (always use the java8 version of the class).

PS: the original app works fine with javaws from oracle (java8) and with icedtea-web.

marcolinuxbr commented 2 years ago

More info (edited/simplified):

------------------ version icedtea-web 1.8.8 (archlinux)

------------------ unzip main.jar

2138 2022-05-06 12:25 META-INF/versions/9//sig/ProviderJv8_9.class 1289 2022-05-06 12:25 sig/ProviderJv8_9.class

------------------ script1

#works with: java8, java11

#export JAVA_HOME=/java/8-local
export JAVA_HOME=/java/11-local

$JAVA_HOME/bin/java -classpath app/main.jar:\
libs/bcastle/bcprov-jdk15-1.46.jar:libs/bcastle/bcmail-jdk15-1.46.jar \
app.Signer

------------------ script2


#work: java8
#dont work: java11

#export JAVA_HOME=/java/8-local
export JAVA_HOME=/java/11-local

javaws http://localhost:8080/web123/javaApp.jnlp

------------------ exception [ITW-JAVAWS][MESSAGE_DEBUG][Fri May 05 12:41:22 BRT 2022][net.sourceforge.jnlp.jdk89acesses.JarIndexAccess.(JarIndexAccess.java:27)] NETX Thread# c5ba4f5, name yyyyy Running jdk9+ ?

Using java11 but still using the java8 version of the class:

Exception in thread "AWT-EventQueue-1" java.lang.NoSuchMethodError: 'void sun.security.pkcs11.SunPKCS11.(java.io.InputStream)' at sig.ProviderJv8_9.getProvider(ProviderJv8_9.java:18)

------------------ jnlp

javaApp-edited.jnlp
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<jnlp codebase="http://localhost:8080/" href="/web123/javaApp.jnlp"
        spec="1.0+">
        <information>
                <title>App1</title>
                <vendor>Vendor2</vendor>
                <homepage href="http://www.example.org" />
                <description>Desc App </description>
        </information>

        <security>
                <all-permissions />
        </security>

        <resources>
                <jar href="/app/main.jar" main="true" eager="true" />
                <jar href="/libs/bcastle/bcprov-jdk15-1.46.jar" />
                <jar href="/libs/bcastle/bcmail-jdk15-1.46.jar" />
        </resources>

        <application-desc main-class="app.Signer">
                <argument>xxxxxxx</argument>
        </application-desc>

</jnlp>
sclassen commented 2 years ago

There is a known issue with multi release jars. It has been fixed on the 2.x branch. Unfortunately there is no release available.

You can try openwebstart. It is using the 2.x branch to offer basically the same as icedtea-web.

marcolinuxbr commented 2 years ago

Thanks man, it worked! Tested with:

windows 10 - OpenWebStart_windows-x32_1_5_2.exe archlinux - OpenWebStart_linux_1_5_2.deb (dpkg in archlinux!)

After install, go to itw-settings (make sure it is the openWebStart version), and use [find all] JVMs. Or let it download one.

I also changed my-other-app.jnlp: from: j2se version="1.8.0_181" (last usable orcl version) to: j2se version="1.8+"

Thanks again. Hope that helps!