Extension using LiveConnect fails to initialize Java code - Java Applet Development

Not sure if this is the correct forum for this post, please redirect me if I'm in the wrong place.
I have written an extension which can be downloaded from here:
This is a free extension that provides accessibility testing functionality for developers, so it allows them to make their web applications and web sites accessible to people with disabilities. We're trying to make the world a better place, but we're running into a problem (described below).
The extension is dependent on and integrated with Firebug, so you will also have to install Firebug - preferably 1.5.4 - if you want to reproduce the problem.
The problem I am having is that sometimes the extension is not able to initialize the Java correctly. I was getting this 100% of the time until I moved the Java initialization code into a timer function that is called after the extension and Firefox are initialized.
Now I get the failed initialization when opening up multiple Firebug instances in multiple tabs inside the same Firefox window (you have to click the "Worldspace FireEyes" tab inside Firebug to ensure that the Java is actually loaded). When you open the second or third tab, the Java cannot be initialized. What I mean by Java initialization is that it cannot load the JAR files that it needs for the accessibility testing. I also see this behavior very infrequently (hence difficult to reproduce) and seemingly randomly when starting Firefox. Under these circumstances, I will sometimes see a constructor failure and at other times the JAR loading will fail.
I might be doing something wrong but I do not even know where to begin debugging this as the failure seems to be occurring inside LiveConnect itself.
Can you help with this? How do I debug LiveConnect? How do I look inside the JVM to see what is going on?
Any help will be appreciated as this problem has been driving me nuts for a while and I've tried all other avenues to determine what could be going wrong.
Edited by: 798832 on Sep 29, 2010 3:24 PM
Here is some additional information. When I get the error that occurs at Firefox startup time, the following exception message is available from the exception that is thrown:
Can't load class netscape/javascript/JSObject
initialization error: Can't load class java/lang/Object
LiveConnect was unable to reflect one or more components of the Java runtime.
Go to http://bugzilla.mozilla.org/show_bug.cgi?id=5369 for details.
When I go to that URL, the bug is from 1999 and has been closed. Seems as though it might have resurfaced.


Java 1.3 Applet Console to File

Hello forum. I've searched the forums and Google but can't figure out the straight answer. Or maybe I just don't like the answer I have.
I have a user out in the field who is having an error in an applet based application running under 1.3. I can not duplicate the error. The user can not send me the contents of the java console because the application is hanging. I can see in the 1.3 docs that I can set the plugin.trace level and I can see in 1.4 Docs that I can declare an output file. Can I send the console data to a file in 1.3?
I can't recompile a new application for the user.
I can't launch the app from the command line and pipe the output that way.
Thanks for any thoughts.
why cant you do
java -jar evilprogram.jar > eviloutput.txt
and then have them send you eviloutput.txt 
It's an applet with tons of jars. If it comes to that I imagine I could do it somehow. It would violate capturing what the user is encountering in the true environment though. 
Now, if you're talking about a true 'applet', as in an Java application running within the context of a web browser, I don't believe you can do this unless the applet is signed. Does your user have tracing & logging turned on? 
Thanks for the reply. The applet is a true applet running in a web page and it is signed. I looked at the java plugin 1.3 docs and it says that tracing is available. I didn't think that logging is available until 1.4. Am I mistaken on that point? I tried using the 1.4 parameters to turn on logging on my test machine bot no log was generated.
You'll only see something in the console/log if something is put there. :)
It will capture any output to System.out and System.err, includiing stack traces. But if your application doesn't put messages on these channels, and no exceptions are thrown, you won't see anything (of value) in the log.
You had mentioned your application is 'freezing'. This could be caused by a number of things that wouldn't result in a stack trace. It could be a thread deadlock/starvation. You could be blocking on a resource that isn't getting loaded. There may be a badly implemented Applet lifecycle method that's causing the browser JVM to choke.
Without being able to replicate this, or change the code, I'm afraid you're in for some major headaches. :(

I'm having trouble getting a signed application to start

I've built a small browser-embedded JavaFX application that uses a FileChooser to access a file on the user's desktop.
I'm fairly certain that this file access is going to require the application to be signed, which I have done with a real certificate. (I also tried it with a self-generated certificate too, with the same results.)
The problem is that running it results in an error in the browser:
"Runtime error. Click for details" (Firefox)
Or on IE:
"JavaFX application could not launch due to system configuration (show error details). See java.com/javafx for troubleshooting information." The "details" don't really say anything in particular that gives me a clue.
I get the same result if I try to Run the application directly from Netbeans. However, if I de-select "Request unrestricted access" in the project properties, the app will run (from Netbeans as well as deployed to a server), but the File Choose won't work, due to a security violation.
Can anyone tell what I'm doing wrong? I would assume these signed apps should work at this point. Perhaps it's something in my code, but I'm a bit lost at the moment. 
It must be something in my code.
I just tried building a "Hello World" application and choosing "Request unrestricted access" and signing it with my keystore.
It worked fine, so I'll re-examine my code. Interesting though, that without signing, at least the app runs without error. 
I think my problem is that one of the JARs I've included in the application is already signed (by its developer).
I'd like to excluding this file from the signing process and I'm pretty sure that can be done somehow. If anyone can point me in the right direction on how to exclude a file from signing in a Netbeans / JavaFX application, I'd be very grateful.
Maybe you are having the same issue as that described by csh in this thread:
Help with Web deployment please "Help with Web deployment please"
csh was including the bouncy-castle crypto lib jar (which is pre-signed by bouncy-castle).
csh describes a manual workaround he applied in the thread.
There is also some confusing information on mixed code signing here:
But I'd avoid the mixed code signing situation if possible (perhaps using csh's manual workaround).
If it's still not clear, you might want to log a jira to get the deployment documentation and packager tool error message handling updated (though, check the long thread referenced earlier first to see if that jira has not already been raised). 
Thanks for your message, unfortunately I'm still at a stand-still after a couple of hours of trying.
There were two options: (1) try to "unsign" the vendor JARs and (2) use multiple JNLPs to deploy the signed JARs separately.
With option #1 -- I modified and rebuilt the 3rd-party JARs and referenced them in NetBeans. When I choose clean and build, the Ant processes results in an error: "jarsigner returns 1". So it doesn't seem to run at all.
With option #2 -- I haven't figured out how to manipulate the build.xml file, so I manually adjusted the JNLP, and added a JNLP for each of my signed JARs. Still, the application won't run.
It appears that NetBeans signs every JAR regardless of whether it's already signed, is that right?
Do you think the multiple-JNLP idea would work if NetBeans didn't apply "my" signature to the 3rd-party JARs? Aside from manually copying the original JARs into the \dist directory, is there a better way to tell NetBeans to leave the 3rd-party JAR alone (ie, don't sign it again)? 
With option #1 -- I modified and rebuilt the 3rd-party JARs and referenced them in NetBeans. When I choose clean and build, the Ant processes results in an error: "jarsigner returns 1". So it doesn't seem to run at all.As long as you rebuilt the jars correctly without the original signature, I think it should work.
An example of unsigning a jar using ant is here:
Do you think the multiple-JNLP idea would work if NetBeans didn't apply "my" signature to the 3rd-party JARs? Aside from manually copying the original JARs into the \dist directory, is there a better way to tell NetBeans to leave the 3rd-party JAR alone (ie, don't sign it again)?I think it's supposed to work (it's the mixed code signing situation I referred to in my prior post).
For example, from your description it sounds like the default NetBeans build doesn't really support this style of deployment, so you would have to create a custom build which does what you need and is not triggered by NetBeans - which is doable, but annoying - it's sounds like you tried this, but were unable to get it to work as expected. For NetBeans specific help, you are better posting to a NetBeans forum (though you might be just the second person who has tried to do this with a JavaFX app).
Also need to check the end user experience is acceptable too, because I think the dialog and warning handling for the mixed code situation is different.
Look at the deployment guide section "Using <fx:resources> for Extension Descriptors" - I think it documents how to do what you want if you use a custom build file rather than letting NetBeans do the work:
Hmm, a lot of running around to deploy an app which can open a file . . . 
Hi John,
Thanks very much for your suggestion. In the end, using the JAR utility, I was successful in removing the certificates and everything is working well.
I'm very excited to start spending more time now with JavaFX. I'm making the transition from being a Silverlight developer, now to JavaFX. Thank you again for your direction.
~~ Michael 
Hi Michael,
Happy it worked for you.
Sorry you had a confusing situation - for whatever reason, most Java jar libraries aren't signed by their creators, so you rarely run into this situation.
Additionally, for the simple jnlp launched application with file open and save dialogs, you (normally) don't need to sign your application because there is a service for that.
You can see a demo of such a service here: http://docs.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/usingJNLPAPI.html.
What the FileOpenService and FileSaveService do is pop up a dialog warning the user about file access only when they try to use the service, not when they first start the application and the application is not provided unlimited access to machine resources - only file access - so in your case it would seem a better API to use.
Unfortunately, there currently appear to bugs in the interoperability with these services and JavaFX, so sticking with your signed application for now is the better way to go until the bugs are fixed (targeted for the next major JavaFX release).
http://javafx-jira.kenai.com/browse/RT-24475 "Strange warning message when overwriting a file using FileSaveService"
http://javafx-jira.kenai.com/browse/RT-24474 "Mac: Unable to specify filetype extension using FileSaveService" 
That's really helpful, thanks again.
In addition to the FileChooser requirement, it also performs cross-domain data retrieval, which I understand is another key reason to sign the application. Now that I've worked this hard, I'll definitely stick with it.
You're a rock-star, my friend. I'll have a lot more questions as my journey continues.
~~ Michael

urgent help, what do these exceptions mean

I was wondering what it means exactly when a InternalError(Ex02),
VirtualMachineError are thrown. im designing a programme which was working fine now suddenly it is throwing those errors, and for the life of me i cant figure out why and what they mean.
Please can someone help.
It means something really bad happened inside the JVM. And unless you want to mess with the JVM source code you are unlikely to fix it, nor usually figure out exactly what caused it.
It might also be caused by your environment, like trying to run a class file created with java 1.0 on a 1.3 jvm or something like that. Not likely, but possible.
Try redesigning your code and hope it goes away.
If you can reduce the code to a very small sample you could post it here and someone might be able to provide a more specific answer and/or a work around. (You need to provide the jvm version you are running under too.) 
This error can happen when a servlet engine is compiling a JSP.
When calling a Servlet in navigator, the servlet engine console of IBM VisualAge for Java 4.0 threw a VirtualMachineError Ex02. The only solution to solve the problem is to remove the "Websphere Test Environament" project and re-installing it (file menu->quick start-> remove characteristic->Webspere Test Environment then file menu->quick start-> add characteristic->Webspere Test Environment). if the removing doesn't work, you have to remove the "JSP page compile generadted code" project before WTE project.

Missing api Components

Hi guys,
I am working on this project and and I get the following errors when I run it.
Have no FileObject for /home/zogenheimer/jdk1.5.0_15/jre/lib/sunrsasign.jar
Have no FileObject for /home/zogenheimer/jdk1.5.0_15/jre/classes
Can anyone tell me where i can find these files to download or how to fix the problem.
Thanks in advance, 
I've never seen those kind of errors and neither does Google. Where does they come from? Are those exact copypastes? How can we try to reproduce this? 
I'm seeing the exact same error.
Have no FileObject for C:\Program Files\Java\jdk1.6.0\jre\lib\sunrsasign.jar
Have no FileObject for C:\Program Files\Java\jdk1.6.0\jre\classes
I get this error whenever I run System.load("file.dll");
The file sunrsasign.jar doesn't exist on my computer. 
I'm not 100% sure, but I think sunrsasign.jar is part of the Java Cryptography Extension. AFAIK, JCE can be downloaded from the regular Java SE download page http://java.sun.com/javase/downloads/index.jsp. 
I know this thread is a month old, but Did you recieve an answer? I'm getting the same error when I wrote a program in 1.6, then had to refactor to 1.5.
I get it to compile, but it doesnt even get to the main method, tosses the same errors up. Do we need to just download the right jar's? 
BalusC wrote:
How can we try to reproduce this? 
Well, the way it happened to me was...
1. Write a form in 1.6 using javax.swing.grouplayout. (Free Design)
2. Set your JDK of the Project to 1.5. (Must have it downloaded)
3. Refactor to Swing Extension by: (You might need swing-layout-extensions.jar)
a. Clicking on your frame.
b. Opening up the Inspector window.
c. Opening the properties of your FORM FILE frame.
d. Changing layout generation style to "Swing Layout Extensions Library"
And thats where I'm at right now.
Edited by: HrPeanut on Jul 31, 2008 6:10 AM 
Am i correct in assuming that its not your application thats giving errors but some kind of GUI editor ?
Using a GUI editor is not Java Programming. Either go to the editors webpages to find help or hand code your GUI's 
it is possible, but it is a runtime error. Happens before I reach my main method... I dunno where the categorize this.
java.lang.NoClassDefFoundError: javax/swing/GroupLayout$Group
Exception in thread "main"
Java Result: 1
BUILD SUCCESSFUL (total time: 4 seconds)Thats exactly and all that i see. 
well GroupLayout is in Java since 1.6 and seeing one of previous posters mentioned using 1.5 that might be causing a problem 
right, thats exactly what the problem is. But as I stated above, you can use grouplayout in 1.5 using the swing-layout-extensions library.
You might as why I'm using 1.5 over 1.6, and the reason is that I need to 'plug' this tool into an existing program, which is written in 1.5. So either i get the error here, or later. I would rather fix it here. 
Well i'm doing some research, but It seems it may be due to the "ClassPath" variable. However, I'm not quite sure where to go with that... the error i'm getting is for java.swingx.grouplayout, which i DONT want included in the project. 
Do in your command consolejavac -versionand
java -versionand verify if you're using the right java compiler and java runtime. I suspect that you're using the 1.6 comiler and the 1.5 runtime.
Edit: oh, you're using an IDE? Well, doublecheck its configuration settings then.
Edited by: BalusC on 31-jul-2008 12:05 
Well.... It just upping stopped throwing that error. I'm not sure what I did, but heres a list of possibilities for future users:
1.  Committed to the Repository.  (probably not)
2.  Re-Set all of my responsible environment variables...
    a. set path="D:\...\JDK1.5\bin"
    b. set classpath="D:\...\JDK1.5\bin"
    c. set java_home="D:\...\JDK1.5"
3.  Re-set all of my Dependencies on my project.  (Project Properties->Libraries).It seemed to go after num. 3.
strange. Hope it doesn't happen again. 
I'm seeing the error too, on three specific references:
Have no FileObject for D:\Program Files\Java\jdk1.5.0_16\jre\lib\i18n.jar
Have no FileObject for D:\Program Files\Java\jdk1.5.0_16\jre\lib\sunrsasign.jar
Have no FileObject for D:\Program Files\Java\jdk1.5.0_16\jre\classes
when starting a POJO that references web services defined by a WSDL, but I am writing web services in NetBeans IDE 6.1 running on Tomcat 5.5 and 6.0 installed, with Jdk1.6.0_04 selected but many installed, on a project requiring jdk1.5.0_16, when attempting to set a SOAP header for security purposes using Axiom with Axis2.
But the program doesn't blow up until at the line where I'm actually trying to set the header:
"<?xml version=\"1.0\"?>" + ...
Any ideas about this one? I am able to connect to the web service, but setting the header on this side kills the process. Strange.

Web Start source code

Is the source code to the com.sun.deploy package publicly available?
I think there has been a change to, perhaps, class com.sun.deploy.security.DeployURLClassPath for Java 7 update 6 which is causing us problems. I'm wondering whether to change our code to cater for the Web Start change, or if it's a change that's likely to be reverted in a future Java update. Viewing the source for DeployURLClassPath might be useful in making that decision. 
OpenJDK is the open source version of Java, that's where you can find the parts of the Oracle JDK distribution that actually are open source (which are not all, for example the browser plugins are not open source).
So yeah, download the source and see if the package is in there somewhere (might take some scouting...). If not, I'm pretty sure a google for 'com.sun.deploy source' will give you some results. I'm pretty positive about that actually.
No, deployment stack is closed source.
What is the problem you are seeing? 
We're getting a "mixed code" warning dialog. Our code tries to load a properties file via Class.getResourceAsStream() and if that fails tries to load the resource via the code base URL. Under 7u6, or rather when using 7u6 Web Start / plug-in, the Class.getResourceAsStream() gives the mixed code dialog. I think this happens because the resource actually is available naked via the code base.
I debugged with a breakpoint on Socket.connect(), and it looked like the 7u6 JNLP classloader was checking the code base URL itself for the resource where the 7u5 one was not (presumably just looking in the jars specified by the JNLP). 
If your app did no thing unusual in terms of resource declaration and access, and it works for 7u5 but for 7u6, then it is likely a bug some where. The best way to solve this is file a bug to provide application details, test cases.