views:

1652

answers:

4

Recently two of our clients have reported problems with our applets. Looking at the java plugin console it is full of ClassNotFoundException so none of our code is executed.

I've been able to reproduce the stack trace using a virtual pc image with 0 free space on disk, but the problem goes away as I restore some disk space, and the users tell me that their disk is not full; they are able to create new files.

Our applet requires java 6, and the problem has appeared with updates 1, 10 and 14 of the jre. We have also tried different browsers (IE and Firefox), clearing the browser and java caches, ...

How can I debug or trace what is the jvm doing to load our applet?

I suppose that the problem lies on some security directive on windows so I'm using Sysinternal's Process Monitor to log the activity but I don't really know where to look at.

+1  A: 

The Java cache is most likely messed up. Open Java in the Control Panel and get rid of all temporary files to see if it goes away.

Logging in the Java Console for loading applets can be enabled which helps quite alot (even if the plugin is extremely cryptic). See http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/tracing_logging.html

Thorbjørn Ravn Andersen
Thanks! I forgot to enable tracing on my disk full test environment. Now I've tried it, but it only shows a 'java.io.IOException: Write error'. There is no detail of what path was trying to write or the cause of the error, so I think it will not give enough information if we enable tracing on the client pc's.Is this tracing the maximum we can get from the JVM?
Serhii
Did cleaning the java cache help your users?
Thorbjørn Ravn Andersen
No. We have already tried cleaning the java cache from the java control panel and deleting all the jar_cache*.tmp files from the temp directory. I suppose that it is some windows or network security directive but I don't know where to continue, so I'm trying to obtain a detailed log of what is happening.
Serhii
If you are dealing with signed jar files (to get out of the sandbox) the certificate chain may be broken. I looked inside the JNLP launcher code recently and all you can get on the Java Console must have been explicitly coded in the launcher. I am not familiar with the new browser plugin.I would suggest getting the source code for the plugin you are using and learn exactly what the logging output you see mean. Note: OpenJDK will NOT do, as these components are not under GPL.
Thorbjørn Ravn Andersen
A: 

I've been looking at the plugin source from the JDK and I've found that there is additional debug info available in the logs setting the environment variable JPI_PLUGIN2_DEBUG. Unfortunately I still only see ClassNotFound exceptions.

I've found a piece of the plugin code that swallows all exceptions, so maybe my users problem is there...

Serhii
A: 

Hi, had similar problems a while ago. In our case, the problem seems to be how the applet tag is set up on the web page. If it is in a wrong order or contains the codebase attribute, it fails with 6u10+. This works for us:

<applet name="DMGANTT" archive="DMGantt.zip" code="dm.applet.DMGanttApplet" 
 width='100%' height='100%' mayscript="mayscript">
kd304
I'm using the deployJava.js script to write the applet tags and we don't add the codebase attribute.How can the attributes be in the wrong order? Do you have an example that fails because of the worng order?
Serhii
Yes, if I change the order of code and archive, somehow 6u10 searches for the DMGanttApplet on the server, and not in the archive provided. What classes are missing - what is the stack trace of your error?
kd304
I've tried your suggestion with the attributes order but the problem persists. The class not found in the stack trace is the one that is specified in the code attribute, so nothing gets executed. I can see in the server log that the jar with the classes is requested. In fact, the jar is requested as many times as applets there are in the page, but when viewing the page from a pc that works it is only requested once.
Serhii
@kd304: Just for curiosity, did you use or try the codebase_lookup parameter? http://java.sun.com/javase/6/docs/technotes/guides/plugin/developer_guide/special_attributes.html#specialattributesAll of our applets run with this parameter set to true, so if the plugin can't find a class or resource it doesn't asks the server for it.
Serhii
No, since the attribute reorder and the codebase param removal was enough to get things working again.
kd304
Well, I've upvoted some of your other answers and questions to thank you for your help. I don't find correct to upvote this particular answer as it really doesn't helped to solve my problem. Thanks.
Serhii
@Serhii: Thanks, I'm sorry I couldn't help. There are so many things that can go wrong with browser-java, e.g. damaged installment of an update, bad registry, etc. You could also try to run your applet in Eclipse with debug mode and check if it works.
kd304
A: 

We had a similar problem with one of our clients. We discovered that it was a strange bug in some versions of Java related to proxy configuration on the client. See this article for the details

http://bugs.sun.com/bugdatabase/view%5Fbug.do?bug%5Fid=6723715

Also, our applet failed with new versions for a different reason.

Now, in similar cases I ask them to check javatester.org, so that I can see if applets (in general) load OK in their browser. If that page loads OK, its a problem on our applet (or page). Else it's a problem in their configuration. I help them anyway but it's easier to debug.

Gonzalo