karakun / OpenWebStart

Run Web Start based applications after the release of Java 11
https://openwebstart.com
Other
417 stars 48 forks source link

NoClassDefFoundError since v.1.10.0 #583

Closed AlBundy33 closed 3 months ago

AlBundy33 commented 4 months ago

A customer updated OWS to 1.10.0 and could start our application. Our jnlp contains a href-Attribute in the jnlp-tag to the remote jnlp-file and the customer has a configured pac-file in the windows-proxy-settings (OWD is set to system).

After checking the console I found this two Errors:

Could not download resource [l=https://foo.bar/jnlp.jnlp v=null s=I] from any of theses urls [https://foo.bar/jnlp.jnlp] caused byExecutionException: java.lang.NoClassDefFoundError: Could not initialize class net.adoptopenjdk.icedteaweb.shaded.mozilla.javascript.JavaMembers caused by NoClassDefFoundError: Could not initialize class net.adoptopenjdk.icedteaweb.shaded.mozilla.javascript.JavaMembers
failed to determine best URL: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: javax/lang/model/SourceVersion

I assume that the first one was introduced with "Upgrade to new version of Mozilla Rhino that processes PAC proxy JavaScript." 🤔 -> With OWS 1.9.1 our app starts with no issues.

If you need more informations I can try to reproduce the issue locally or make some tests one the customer-pc.

janakmulani commented 4 months ago

We did test the Rhino upgrade with a sample PAC file we had. It will help if you can post your OWS log files on the OWS forum and also a sample PAC file that is leading to this error.

AlBundy33 commented 4 months ago

Is there a chance to get the stacktrace of the two lines? I've tried to reproduce this issue in a virtual machine with a simple pac-file but unfortunately the app starts as expected. 😄

Im curious why javax.lang.model.SourceVersion was no found because this seems to be a class from java itself since 1.6. 🤔

Is net.adoptopenjdk.icedteaweb.shaded.mozilla.javascript.JavaMembers still used in OWS or ITW? -> I couldn't find the class 🤔

The issue is at least reproducable on the customer-system. install 1.9 -> works, update to 1.10 -> error, uninstall 1.10 and reinstall 1.9 -> works

In fact the customer has OWS 1.8 installed on C:\Program Files\OpenWebstart and 1.9/1.10 are installed for the user only because the user has not enough permissions. -> I've also tried to replicate this in my VM without luck.

Is there something we can try to cleanup after the update from 1.9 to 1.10? -> We've already cleaned up the app-cache so that alle resources would be downloaded again.

sclassen commented 4 months ago

OWS is and will always use ITW internally. Also the shaded version of org.mozilla is still present in the 1.10 release and will be as long as ITW uses Rhino to interpret the pac-proxy file.

Regarding cleanup. OWS is packaged into a single JAR. So there isn't anything to clean up during an upgrade. The cache and the jvm-cache can be cleared but this is independent of the OWS installation as the cache structure and the code handling the cache has not changed since a few years.

AlBundy33 commented 4 months ago

I didn't expect anything else. 😄

Is there something I can do to get the stacktrace of the errors? -> Maybe it's enough to set loglevel to debug? I haven't tried this yet on the customers system because I don't want to waste their time.

AlBundy33 commented 4 months ago

I can now reproduce the issue. fresh installed windows 10 vm Installed latest OWS

Windows can not reach the internet without proxy Therefore http://127.0.0.1/proxy.pac is configured reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /t REG_SZ /d "http://127.0.0.1/proxy.pac" /f OWS uses System-Settings

I've used https://www.ritlabs.com/en/products/tinyweb/install.php as local webserver.

with this proxy.pac I get the error

function FindProxyForURL(url, host) {
        if (isInNet(host, "127.0.0.0", "255.0.0.0")) {
            return "DIRECT";
        }

        return "PROXY proxy.foo.bar:3128; DIRECT";
}

with this on the download works as expected

function FindProxyForURL(url, host) {
/*
        if (isInNet(host, "127.0.0.0", "255.0.0.0")) {
            return "DIRECT";
        }
*/
        return "PROXY proxy.foo.bar:3128; DIRECT";
}

With OWS 1.9 the first proxy.pac works too.

If I use the working proxy.pac there are no NoClassDefFound-Exceptions in the log.

AlBundy33 commented 4 months ago

I can make more tests next week if needed but it seems that the NoClassDefFoundError is just a side-effect. For me it looks like that the download of the href-jnlp is not done over the proxy and therefore ends in an error. This would explain why I can reproduce this in the VM but not locally (my PC has interenet-access event without proxy)

janakmulani commented 4 months ago

I can now reproduce the issue. fresh installed windows 10 vm Installed latest OWS with this proxy.pac I get the error


function FindProxyForURL(url, host) {
        if (isInNet(host, "127.0.0.0", "255.0.0.0")) {
            return "DIRECT";
        }

        return "PROXY proxy.foo.bar:3128; DIRECT";
}

So, NoClassDefFoundError occurs when isInNet(host, "127.0.0.0", "255.0.0.0") is invoked in the the PAC. Is this correct?

Can you please post the OWS logs with the verbose option (debug) and Jnlp content?

AlBundy33 commented 4 months ago

I think there is something wrong with the download of the href-resource. I can reproduce this with the Dynamic Tree Demo

The jnlp contains also a href-attribute:

<jnlp spec="1.0+" 
        codebase="https://docs.oracle.com/javase/tutorialJWS/samples/deployment/dynamictree_webstartJWSProject"
        href="dynamictree_webstart.jnlp">

With the enabled check ...isInNet... I cannot start the demo and have the NoClassDefFoundErrors. Without the check the demo starts as expected and without NoClassDefFoundErrors in the logs.

here are the logs of the failed start. 2024-06-03_08_17_32.205-ows-stage1.log 2024-06-03_08_17_32.205-ows-stage2.log

I think the cause of the issue is, that the proxy.pac is on 127.0.0.1 and could not be "downloaded" from there 🤔

janakmulani commented 4 months ago

Thanks for the sample. We normally test with AccessibleScrollDemo:

<jnlp spec="1.0+" codebase="https://docs.oracle.com/javase/tutorialJWS/samples/uiswing/AccessibleScrollDemoProject" href="AccessibleScrollDemo.jnlp">

But we have not tested this along with PAC proxy. I will try it now with PAC file having isInNet. I will come back to you.

AlBundy33 commented 4 months ago

I can reproduce this with AccessibleScrollDemo too

I think the main points to reproduce this issue are:

If you want I can provide a container based on dockurr/windows with a ready-to-reproduce setup. Currently I run the container with podman but if needed I can switch to docker.

janakmulani commented 3 months ago

I could reproduce:

`

Could not download resource [l=https://docs.oracle.com/javase/tutorialJWS/samples/uiswing/AccessibleScrollDemoProject/AccessibleScrollDemo.jnlp v=null s=I] from any of theses urls [https://docs.oracle.com/javase/tutorialJWS/samples/uiswing/AccessibleScrollDemoProject/AccessibleScrollDemo.jnlp] caused by ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class net.adoptopenjdk.icedteaweb.shaded.mozilla.javascript.JavaMembers caused by NoClassDefFoundError: Could not initialize class net.adoptopenjdk.icedteaweb.shaded.mozilla.javascript.JavaMembers caused by ExceptionInInitializerError: Exception java.lang.NoClassDefFoundError: javax/lang/model/SourceVersion `

You are getting the following exception:

Could not download resource [l=https://docs.oracle.com/javase/tutorialJWS/samples/deployment/dynamictree_webstartJWSProject/dynamictree_webstart.jnlp v=null s=I] from any of theses urls [https://docs.oracle.com/javase/tutorialJWS/samples/deployment/dynamictree_webstartJWSProject/dynamictree_webstart.jnlp] caused by ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class net.adoptopenjdk.icedteaweb.shaded.mozilla.javascript.JavaMembers caused by NoClassDefFoundError: Could not initialize class net.adoptopenjdk.icedteaweb.shaded.mozilla.javascript.JavaMembers

Will investigate.

janakmulani commented 3 months ago

The error does not happen with Rhino 1.7.12

AlBundy33 commented 3 months ago

I could reproduce:

`

Could not download resource [l=https://docs.oracle.com/javase/tutorialJWS/samples/uiswing/AccessibleScrollDemoProject/AccessibleScrollDemo.jnlp v=null s=I] from any of theses urls [https://docs.oracle.com/javase/tutorialJWS/samples/uiswing/AccessibleScrollDemoProject/AccessibleScrollDemo.jnlp] caused by ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class net.adoptopenjdk.icedteaweb.shaded.mozilla.javascript.JavaMembers caused by NoClassDefFoundError: Could not initialize class net.adoptopenjdk.icedteaweb.shaded.mozilla.javascript.JavaMembers caused by ExceptionInInitializerError: Exception java.lang.NoClassDefFoundError: javax/lang/model/SourceVersion `

You are getting the following exception:

Could not download resource [l=https://docs.oracle.com/javase/tutorialJWS/samples/deployment/dynamictree_webstartJWSProject/dynamictree_webstart.jnlp v=null s=I] from any of theses urls [https://docs.oracle.com/javase/tutorialJWS/samples/deployment/dynamictree_webstartJWSProject/dynamictree_webstart.jnlp] caused by ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class net.adoptopenjdk.icedteaweb.shaded.mozilla.javascript.JavaMembers caused by NoClassDefFoundError: Could not initialize class net.adoptopenjdk.icedteaweb.shaded.mozilla.javascript.JavaMembers

Will investigate.

I've used Java 11 (Temurin) for testing - maybe thats the reason for the additional exception

sclassen commented 3 months ago

We plan on releasing a bugfix early next week

sclassen commented 3 months ago

Fixed with 1.10.1

AlBundy33 commented 3 months ago

@sclassen seems to work - at least my local test case works as expected 👍 Thanks for the fast fix