(*** This bug was imported into bugs.kde.org ***) Package: kjava Version: KDE 2.2.2 Severity: normal Installed from: Compiled From Sources Compiler: gcc 2.95.3 OS: Solaris OS/Compiler notes: Sparc Solaris 7 We have an in-house signed Java applet which is causing problems with Konqueror. I think I know what the problem is but I don't know how to fix it. The applet is stored in a number of jar files. The applet tries to load the class IE.Iona.OrbixWeb.IIOP.CDRecorder. This class is not present in a jar file so the applet class loader attempts to download the class file directly from the web server i.e. http://valiant.net.com/java-classes/IE/Iona/OrbixWeb/IIOP/CDRecorder.class The web server responds with a 404 error code. I think what is happening is that the 404 error web page is being passed to the class loader as data and the class loader attempts to load the data as a class. Instead a ClassNotFound exception should be generated. I managed to enable Java debugging (there needs to be a way to enable this in Konqueror!) and captured the following output: Java VM version: 1.3.1_01 Java VM vendor: Sun Microsystems Inc. KJAS: JVM version = 1.3.1_01 KJAS: JVM numerical version = 1.3 KJAS: could not get provider: SunJSSE KJAS: PH: cmd_length = 3 KJAS: PH: read in 3 bytes for command KJAS: createContext id = 0 KJAS: PH: cmd_length = 582 KJAS: PH: read in 582 bytes for command KJAS: createApplet context = 0 applet = 0 KJAS: name = COM/NET/PanaVue/SVUI/Base/LaunchApplet.class classname = COM/NET/PanaVue/SVUI/Base/LaunchApplet.class KJAS: baseURL = http://valiant.net.com/cgi/applaunch.pl?viewSpec=web&productName=SVUI codeBase = /java-classes KJAS: archives = /java-classes/OrbixWeb.jar /java-classes/PanaVueJCommon.jar/java-classes/jcchart451K.jar /java-classes/jctable451K.jar /java-classes/jcfield451K.jar /java-classes/jcelements451K.jar /java-classes/PanaVueADMIN.jar /java-classes/PanaVueSCREAM.jar /java-classes/PanaVueP4000M.jar /java-classes/SCEClient.jar width = 333 height = 94 KJAS: CL: getLoader: key = http://valiant.net.com/java-classes/ ... loading a bazillion classes... ... KJAS: CL(http://valiant.net.com/java-classes/): loadClass class name = IE.Iona.OrbixWeb.IIOP.CDRcoder KJAS: CL(http://valiant.net.com/java-classes/): now checking the webserver KJAS: sendGetURLCmd from loader: http://valiant.net.com/java-classes/ url = IE/Iona/OrbixWeb/IIOP/CDRcoder.class KJAS: CL(http://valiant.net.com/java-classes/): waiting for the webserver to answer for class: IE/Iona/OrbixWeb/IIOP/CDRcoder.class KJAS: PH: cmd_length = 3007 KJAS: CL(http://valiant.net.com/java-classes/): waiting for the webserver to answer for class: IE/Iona/OrbixWeb/IIOP/CDRcoder.class KJAS: PH: read in 3007 bytes for command KJAS: CL(http://valiant.net.com/java-classes/): waiting for the webserver to answer for class: IE/Iona/OrbixWeb/IIOP/CDRcoder.class KJAS: URLData recieved KJAS: CL(http://valiant.net.com/java-classes/): waiting for the webserver to answer for class: IE/Iona/OrbixWeb/IIOP/CDRcoder.class KJAS: data is for loader: http://valiant.net.com/java-classes/ KJAS: CL(http://valiant.net.com/java-classes/): waiting for the webserver to answer for class: IE/Iona/OrbixWeb/IIOP/CDRcoder.class KJAS: URL is http://valiant.net.com/java-classes/IE/Iona/OrbixWeb/IIOP/CDRcoder.class KJAS: CL(http://valiant.net.com/java-classes/): waiting for the webserver to answer for class: IE/Iona/OrbixWeb/IIOP/CDRcoder.class KJAS: this is a class loader request KJAS: CL(http://valiant.net.com/java-classes/): waiting for the webserver to answer for class: IE/Iona/OrbixWeb/IIOP/CDRcoder.class KJAS: CL(http://valiant.net.com/java-classes/): addResource for url: http://valiant.net.com/java-classes/IE/Iona/OrbixWeb/IIOP/CDRcoder.class size of data = 2896 KJAS: CL(http://valiant.net.com/java-classes/): waiting for the webserver to answer for class: IE/Iona/OrbixWeb/IIOP/CDRcoder.class KJAS: CL(http://valiant.net.com/java-classes/): resource isn't a jar putting it straight in with name = IE.Iona.OrbixWeb.IIOP.CDRcoder.class KJAS: CL(http://valiant.net.com/java-classes/): waiting for the webserver to answer for class: IE/Iona/OrbixWeb/IIOP/CDRcoder.class KJAS: we got the data java.lang.ClassFormatError: IE/Iona/OrbixWeb/IIOP/CDRcoder (Bad magic number) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:486) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111) at org.kde.kjas.server.KJASAppletClassLoader.findClass(KJASAppletClassLoader.java:314) at org.kde.kjas.server.KJASAppletClassLoader.loadClass(KJASAppletClassLoader.java:335) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313) at COM.NET.PanaVue.JCommon.Base.ExtendedAppletBase.initOrb(ExtendedAppletBase.java:126) at COM.NET.PanaVue.JCommon.Base.ExtendedAppletBase.init(ExtendedAppletBase.java:57) at org.kde.kjas.server.KJASAppletStub.initApplet(KJASAppletStub.java:145) at org.kde.kjas.server.KJASAppletStub$1.run(KJASAppletStub.java:98) at java.lang.Thread.run(Thread.java:484) Here is the page returned by the web server via telnetting to the server: Connected to valiant. Escape character is '^]'. GET /IE/Iona/OrbixWeb/IIOP/CDRcoder.class HTTP/1.0 HTTP/1.1 404 Not Found Date: Fri 25 Jan 2002 04:46:39 GMT Server: Apache/1.3.19 (Unix) Connection: close Content-Type: text/html <HTML><HEAD> <TITLE>Error 404 - Not Found</TITLE></HEAD> <BODY BGCOLOR=FFFFFF TEXT=000000 LINK=#0000dd VLINK=#dd0000> <A NAME=HEADING1></A> <A NAME="top"></A> <!---BANNER STARTS---> <IMG SRC="/images/header.jpg" ALT="SCREAMvue Management System Documentation" USEMAP="#netmap" BORDER=0> <P> <!---END BANNER---> <CENTER> <H1>404 Error - Not Found</H1> </CENTER> <P> <CENTER> [ <A HREF="/idDocs/index.html"> Documentation Home Page</A> | <A HREF="/idDocs/server/help.html"> Help</A> ] </CENTER> <HR> <P>The server was not able to find the requested page:</P> <PRE><B> /IE/Iona/OrbixWeb/IIOP/CDRcoder.class</B></PRE> <P>You might have mistyped the URL or have meant to access another host.</P> <P>If this link was one of your bookmarks it might have been for a previous version of the SCREAMvue software. <P>Please make sure you entered the correct URL and try again</P><HR> <FONT SIZE=-1>Please mail any comments suggestions or corrections to this page to <A HREF="mailto:infodev (at) net.com?Subject=PanaVue%20Web%20Server%20pages%20(/cgi-bin/404error.pl)">infodev@net.com</A></FONT> <!---END CONTENT---> <HR> <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=590> <TR><TD ALIGN=LEFT VALIGN=TOP> <IMG WIDTH=50 HEIGHT=1 SRC="/images/1.gif"></TD> <TD ALIGN=LEFT VALIGN=TOP><IMG WIDTH=540 HEIGHT=1 SRC="/images/1.gif"></TD> </TR> <TR> <TD ALIGN=LEFT VALIGN=TOP></TD> <TR><TD ALIGN=LEFT VALIGN=TOP COLSPAN=2> </TD></TR> <!---TOOLBAR STARTS---> <TR><TD ALIGN=center VALIGN=TOP COLSPAN=2> <IMG WIDTH=590 HEIGHT=2 SRC="/images/3.gif"></TD></TR> <TR> <TD ALIGN=CENTER VALIGN=TOP COLSPAN=2 BGCOLOR=ff9900> <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 WIDTH=590> <TR> <TD ALIGN=CENTER VALIGN=TOP><A HREF="/index.html" target="_top"> <FONT FACE=" Arial Helvetica" size=-1><FONT color="ffcc00"> <IMG BORDER=0 vspace=2 hspace=8 SRC="/images/home.jpg" ALT="Home"><BR> <B>Home</B></font></A></TD> <TD ALIGN=CENTER VALIGN=TOP><A HREF="/idDocs/index.html" target="_top"> <FONT FACE=" Arial Helvetica" size=-1><FONT color="ffcc00"> <IMG BORDER=0 vspace=2 hspace=0 SRC="/images/docs.jpg" ALT="Docs."><BR> <B>Documentation</B></font></A></TD> <TD ALIGN=CENTER VALIGN=TOP><A HREF="/idDocs/help/index.html" target="_top"> <FONT FACE=" Arial Helvetica" size=-1><FONT color="ffcc00"> <IMG BORDER=0 vspace=2 hspace=8 SRC="/images/help.jpg" ALT="Help"><BR> <B>Help</B></font></A></TD> <TD ALIGN=CENTER VALIGN=TOP><A HREF="/index.html" target="_top"> <FONT FACE=" Arial Helvetica" size=-1><FONT color="ffcc00"> <IMG BORDER=0 vspace=2 hspace=10 SRC="/images/up.jpg" ALT="Up"><BR> <B>Up</B></font></A></TD> <!---TOOLBAR ENDS---> </TR></TABLE> </TD></TR> </TABLE> </CENTER> <P><FONT SIZE=-2><A HREF="/idDocs/panavue/copyright.html">Copyright</A> © 2001 Network Equipment Technologies Inc. All Rights Reserved.</FONT></P> </BODY> </HTML> Connection closed by foreign host. I may be wrong in terms of what data is being sent to the class-loader. Hopefully this is enough information to proceed. (Submitted via bugs.kde.org)
After reviewing the HTTP code in KDE it appears that by default no error is returned when the web server returns 404. The kjava package needs to take this into account. What is currently happening is that kjava is passing the 404 html page returned by the web server to the class loader. The class loader complains that it has a bad magic number since the data is an html page and not a java class file. kjava needs to validate the return code from the web server in addition to checking for errors before passing the data to the class loader. There is a configuration setting (which I don't have in front of me now) that changes the behavior of the http code so that it does return an error when a 404 is encountered. This causes kjava to behave correctly but the downside is that konqueror will no longer display the 404 error page. I suspect that this bug may be the cause of other reported applets not loading. Of course the applets shouldn't be trying to load non-existent classes but this bug is clearly in kjava.
Does this work if you enable 'Use KIO'? Make sure though java is restarted after setting this option, eg close all konqueror windows and wait for java process to exit.
Is this bug still present in a recent version of KDE, such as 3.5.8 or 4.0.0?
No response to request for feedback. Please reopen if you can reproduce this bug, and provide details of how to test it.