Hi i'm a web developer and I'm really interested on purchasing jfileupload but i'm getting some trouble here:
When I run jFileUpload outside the server (i mean opening the .html file directly having the lib folder where it should be), i get no trouble BUT when I run it within my server I get the tipical ClassNotFoundException: jfileupload.upload.client.MApplet.class (i followed the installation instructions)
I have put the lib folder everywhere I could in case it was the problem, I also modified the codebase, java_codebase and archive properties of the applet but I still get that exception.
Since i'm using xhtml strict i had to close some tags and put everything in lowercase, I also got rid of the .js file and wrote all the applet tags and params directly on my xhtml file (which still works perfectly without the server)
I'm running JBoss + JSF with xhtml on ubuntu 7.10 and testing on firefox 3 and IE7 (also testing on windows)
Thanks for your help!
ClassNotFoundException persistsRe: ClassNotFoundException persistsCould you post your resulting HTML page that loads the applet ?
Also, are you able to access JAR files directly in browser such as: http://yourserver.com/something/lib/jfileupload.jar Re: ClassNotFoundException persistsfor practical purposes i reduced my xhtml file to this: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:t="http://myfaces.apache.org/tomahawk"> <ui:composition> <applet code="jfileupload.upload.client.MApplet.class" codebase="./ " java_codebase="./" archive="lib/jfileupload.jar,lib/httpimpl.jar,lib/chttpclient.jar,lib/clogging.jar" width="250" height="250" name="fileupload"> <param name="type" value="application/x-java-applet;version=1.4"/> <param name="scriptable" value="true"/> <param name="url" value="http://localhost:8080/upload/process.xhtml"/> <param name="paramfile" value="uploadfile"/> <param name="param1" value="todo"/> <param name="value1" value="upload"/> <param name="mode" value="http"/> </applet> </ui:composition> </html> As you can see i removed all the repeated tags since my interest is to make it work at least on firefox or IE7 and then add the rest of the code once it works. As i said before, the code above (the applet) works perfectly outside the server in both firefox3 and IE7. I forgot to mention i'm also using java 1.6.0_03 I just realized about waht you mean with access the jar file directly and the answer would be this: I don't get the "not found" page but instead the server displays a parsing error: Content is not allowed in prolog Thank you very much for your concern. Re: ClassNotFoundException persistsIf you access the JAR file directly in browser on your test environment, then it works, you have the "Save As" prompt, correct ?
But if you do the same test on your server, then you have "Content is not allowed in prolog", correct ? Then it explains why you have the ClassNotFound error. Your server doesn't server the JAR files so Java cannot find the required class files. Make sure your server servers JAR files as any others binary file. It seems it tries to interpret the JAR content as XML or so. Re: ClassNotFoundException persistsI just solved the problem but in a very different way: I returned to the .js file but changed all of its content. First i switch the browser not in the js but as xml if/else inside the xhtml page so the .js file is a big function that returns all the code as one string instead of writing directly into the document. What solved my problem is that i moved the jar files outside any folder, putting it directly into the webContent folder so the archive parameter looks something like this: archive="../../../../..." And finally I parameterized the ../../../ thing so that one var changes all archives. For some weird reason i had to put an extra ../ than the amount i expected to have. and that solved my problem Hope it helps someone reading this. Thanks a lot for your patience and help |