Applets throwing NPE when succesfully loading jars

Everytime I load an applet, this ends up printed in the ‘Sun Java Console’ of JRE 1.6.0.05 (in IE7, FireFox 2 and Opera)

java.lang.NullPointerException
	at sun.plugin.AppletViewer.loadJarFiles(Unknown Source)
	at sun.applet.AppletPanel.runLoader(Unknown Source)
	at sun.applet.AppletPanel.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

The applets works fine (if it can get passed the initial locking-on-the-orange-java-logo, which happens about 20% (!!) of the time >:()

(The NPE happens regardless of the lockup…)

Anything odd in the manifest? Can you post a link for me to check here? (IE6 JRE 1.6.0.03)

Can the lack of a manifest cause this? (I’m an Applet n00b)

Shouldn’t do! Is this any help?
Reducing the jar size might help - keep resources separate &c.
It’s not a bug I’ve ever found myself - I don’t like the sound of it!

it should not be related to your manifest, it is not requiered for unsigned applet you can simply zip your classes directory and rename it to .jar it should work often, at least for 1.6.0.03 and below.

maybe you can try with a jar containing only one classes ?

I changed the JARs so that they have proper manifests…

[b]when I remove the applet from the DOM tree, while it is hanging, it becomes clear what is blocking


java.lang.InterruptedException
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:485)
	at sun.plugin.ClassLoaderInfo.lock(Unknown Source) <----------------------
	at sun.plugin.AppletViewer.loadJarFiles(Unknown Source)
	at sun.applet.AppletPanel.runLoader(Unknown Source)
	at sun.applet.AppletPanel.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

this is a VERY serious problem!! 20% of the time an applet is loaded, IT HANGS!

this is a commercial site, we need that applet right there!

Maybe I should add that the initial NPE (see first post) has a similar stacktrace.

I bet the NPE (which is always thrown) causes a situation where a deadlock might occur.

.

So is the intial NPE still thrown?

I just did some googling about applets on the sun site and the guide I found was massive :’(

Yup, that silly NPE is there to stay.

I filled a bug in the BugParade and I hope they will have enough info to fix it, as it is now apparant the hanging is in their code, not some random browser screwup.

what Tag did you use for your applet ?

did you get same error on other applet over internet ?

Have you tried using someone’s example applet and html and modifying only what you need to? At least there’s lots of people here who know about applets, maybe you should just try their html code and methods of jar’ing etc. DzzD’s applets work pretty well.

Starting from scratch and trying to learn how the applet black box works sounds like the hard way.

Very interristing summary on Applet :

http://java.sun.com/docs/books/tutorial/deployment/applet/

and that very annoying section… cant beleve nothing is done to correct that point:

[quote]…In many applet viewers (including browsers), reloading is not reliable. This is why we recommend that you simply use the JDK Applet Viewer, invoking it anew every time you change the applet…
[/quote]
in
http://java.sun.com/docs/books/tutorial/deployment/applet/problemsindex.html

quote from this sun website, I would also recommend to not use lastest JRE :slight_smile: (-target x.x)

[quote]Note: The HTML specification states that the applet tag is deprecated, and that you should use the object tag instead. However, the specification is vague about how browsers should implement the object tag to support Java applets, and browser support is currently inconsistent. It is therefore recommended that you continue to use the applet tag as a consistent way to deploy Java applets across browsers on all platforms
[/quote]

DzzD, I get NPEs on your applets too… could you check your Java Console?

http://dzzd.net/demo/PLANETARIUM/

first try:

But it seems to happend before I ran any applet, when you open this page the only applet launched is code=java.applet.Applet, seems to happend on an applet destruction…

EDIT:
In this sample an Applet code=java.applet.Applet is first created and immediatly destroyed (removed from DOM) seems that cause the crash, what is strange is that Applet dont use any jar and only a local class file …

It’s very easy to end up with strange, probabilistic errors due to initializations running
in multiple threads, along with window setup, refresh events, “run” processes of
runnable threads - all firing off at the same time.

It’s wise to keep initialization as simple and untangled as possible. For example, constructors
shouldn’t try to create windows or set up event listeners. Window repaint routines and event
listeners ought to do nothing until a flag you set at the end of all necessary initialization is set.

My applets feed EVERYTHING through one thread - mouse, network, window events. Every line
of code is in effect only executed by one particular thread. Java threads are extremely dangerous.

Well, is a HelloWorld applet too advanced? It throws the NPE too, and hangs 20% of the time.

And uh… thanks Sun, for ignoring my bug report, or is one month of silence to be expected?

anything new about this one ?

I got a reply some time ago: could not reproduce.