The Source for Java Technology Collaboration
Webmaster Alert: Posting to Jive Forums is currently not working. Estimated time for fix is unknown.

Home » java.net Forums » Java Deployment & Distribution » Java Plug-in

Thread: NoClassDefFoundError in Applet since Java 1.6.0_15

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is not answered. Helpful answers available: 2. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 7 - Last Post: Jan 20, 2010 8:57 AM by: ccng123
budde

Posts: 1
NoClassDefFoundError in Applet since Java 1.6.0_15
Posted: Sep 15, 2009 4:01 AM
 
  Click to reply to this thread Reply

Hi all,

I have a problem with a signed Java applet that is started using the <OBJECT> tag from HTML.
The JAR is built on Java 1.4.2 (but no difference building it on 1.6.0_16) and is run under 1.6.0_16 and it adds other JARs to the classpath in its manifest (but the class that is not found is in the 'primary' JAR).
The applet is run in InternetExplorer 6.0.2900.2180.xpsp_sp2_gdr.070227-2254.

Since I installed the new JRE (1.6.0_16) with Java plugin, a NoClassDefFoundError is thrown when accessing a static method on a class importing the class that cannot be found.

It looks like this:
Exception in thread "thread applet-MyApplet.class-1" java.lang.NoClassDefFoundError: my/package/MyClass1
at my.package.MyClass1.initStage5(MyClass1.java:483)
at my.package.MyClass1.init(MyClass1.java:147)
at my.package.MyClass1.init(MyClass2.java:80)
at MyClass3.init(MyClass3.java:42)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: my.package.MyClass1
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 6 more

Before adding the parameter <param name="codebase_lookup" value="false"> this ClassNotFoundException was caused my a further FileNotFoundException... I'm not sure what that is supposed to mean.

Turning off the "next-generation Java Plug-in" functionality in the Java control Panel (Advanced) it works fine, but this seems to be no option for other reasons.

Does anybody know of an option that might be related to this?

Many thanks in advance,
Stefan

pifta

Posts: 3
Re: NoClassDefFoundError in Applet since Java 1.6.0_15
Posted: Sep 22, 2009 5:32 PM   in response to: budde
 
  Click to reply to this thread Reply

Hi,
I'm facing this problem too. I have some results and thoughts about the root of the problem, but it is absolutely not sure yet.

In Java 1.6.0_15 there were some changes in the plugin2 engine in relation to cache handling.
I have found two specific case which can cause such a NoClassDefFoundError.

First case:
Use Class.forName() to load a class from the default package cause NCDFE because the classloder tries to find the class file on the server not in the jar which has been downloaded correctly. This behavior came up when client side Java cache was completely disabled and the jars were signed. I decided to make some further debugging before submit this as a bug, but i don't have enough time to do so until now.

Second case:
Appears with signed jars when applet code has a package which contents are separated into two or more jars, and applet uses Class.forName to load classes from that package. If applet runs for the first time, with clean cache(or with such a cache that contains nothing related to the applet which is loading and running at the moment) everything works fine, every classes and jars loaded correctly. After that with applet related jars in the cache(restart browser and load the applet again), when applet is trying to load a class with Class.forName - from a package which has formerly cached pieces in the java cache - the jar is downloaded, but the classloader is not able to load the class from the just downloaded jar. Then classloader tries to download the class file directly from the server and throw a NCDFE because only the jar files are on the server. It seems the package-jar relations not updated in time inside the cache mechanism of plugin2, and the classloader cannot search the newly downloaded jar files for classes - in such a package which has downloaded parts in the formerly cached jar files. Of course i didn't have enough time to deeply debug this issue as the previous one.

I'm submitting somewhere the created minimal reproduction cases and give a link for that. If somebody has time, every idea and further investigations are welcome...:)

Pifta

pifta

Posts: 3
Re: NoClassDefFoundError in Applet since Java 1.6.0_15
Posted: Sep 22, 2009 5:40 PM   in response to: pifta
 
  Click to reply to this thread Reply

Test cases:
First case: http://csomalin.csoma.elte.hu/~pifta/test.zip
Second case: http://csomalin.csoma.elte.hu/~pifta/test2.zip

Info for test.zip usage:
Use a webserver to view index.html after building applets with release.sign target. Error will be thrown while initializing the applet if java cache is disabled.

Info for test2.zip useage:
Use webserver to view index.html.
Build applets with release target and after that launch release.sign target.
Open the java control panel.
Clear the cache.
Load index.html into a browser(i've used firefox 3.0 on winxp sp3)
Close browser.
Open the browser again.
Load index.html
Click on the button inside the applet.
Error will be thrown.

Please let me know if i screwed up somthing, and that cause the problem...:)

Pifta

Message was edited by: pifta

seboooo

Posts: 1
Re: NoClassDefFoundError in Applet since Java 1.6.0_15
Posted: Oct 5, 2009 2:07 AM   in response to: pifta
 
  Click to reply to this thread Reply

Hi,
I have exactly the same problem as You've described as "second case". Have You already found any solution?

Thanks for any help.

Seboo

Message was edited by: seboooo

pifta

Posts: 3
Re: NoClassDefFoundError in Applet since Java 1.6.0_15
Posted: Oct 5, 2009 6:32 AM   in response to: seboooo
 
  Click to reply to this thread Reply

No unfortunately i haven't have more information about the issue, i've posted a bug report to Sun, and waiting for their reply. The bug report is in internal review state for one and a half week now.

ndcosta123

Posts: 12
Re: NoClassDefFoundError in Applet since Java 1.6.0_15
Posted: Oct 5, 2009 11:54 PM   in response to: pifta
 
  Click to reply to this thread Reply

Hi Pifta,

We have included your bug reports in our bug database with id's - 6888527 and 6888528. This will be visible in a couple of days at -
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6888527
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6888528

Thanks,
Nelson

tuler

Posts: 4
Re: NoClassDefFoundError in Applet since Java 1.6.0_15
Posted: Jan 10, 2010 5:38 AM   in response to: ndcosta123
 
  Click to reply to this thread Reply

I also have the second problem. Unfortunetly the bug has been closed as "Not Reproducible" :-(
Please reopen it!

ccng123

Posts: 1
Re: NoClassDefFoundError in Applet since Java 1.6.0_15
Posted: Jan 20, 2010 8:57 AM   in response to: tuler
 
  Click to reply to this thread Reply

Yeah, I have the exact problem in my Applet.
I checked and double checked my classpath
and couldn't fond any clue!




 XML java.net RSS