I'm having a problem getting an applet to run in a portlet using WSAD 5.0 with the Portal Toolkit and was hoping that someone out there might have a helpful suggestion. There are some platform/environment specific issues but this problem is a real puzzler. The applet will run by itself and when loaded up into a straight JSP/HTML page. However, it won't run from within a portlet. When loading up the applet I get the following error in the Java Console: java.lang.ClassFormatError: com/rave/execDashboard/applet/EDBGraphApplet (Bad magic number) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at sun.applet.AppletClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadCode(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(Unknown Source) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Exception: java.lang.ClassFormatError: com/rave/execDashboard/applet/EDBGraphApplet (Bad magic number) Currently, I'm using WSAD 5.0/Portal Toolkit 5.0 with the 1.4.2_02 JRE to compile/run the applet. I've also tried this with 1.3.1_09 with idential results. Normally a "Bad Magic Number" indicates that the class/jar file is corrupt, however the applet loads/runs fine from within a straight JSP page(WAS 4.0 Test Environment) vs a Portlet/View.JSP(Portal Server 4.2 Test Environment). Another possiblity would require that there be an incompatibility between the JVM used to compile the class vs the one loading/runing it. However, WSAD is using JRE 1.4.2_02 JRE to perform both. A copy of the <APPLET> tag is below: <P><APPLET code="com.rave.execDashboard.applet.EDBGraphApplet.class" codebase="../lib" archive="wcis.jar,EDBGraphApplet.jar" width="310" height="310"> </APPLET></P> (Originally I used the <jsp luging> directive to load the applet but switched back to <APPLET> tags when I discovered that the generated OBJECT,EMBED tags wouldn't work with Netscape 7.1 or Firebird 0.7) EDBGraphApplet.jar contains my graphing applet and wcis.jar contains an off-the-shelf graphing package I'm extending. Normally, in a straight-forward JSP I would load up the applet from a directory relative to the JSP. However, in JetSpeed/WebSphere Portal, "You cannot calculate the codebase relative to the Portlet JSP because this JSP is not accessed directly by the browser. The codebase must be relative to the jetspeed servlet URI, which is /jetspeed/portal/ by default, thus your codebase should certainly be only "../applets", and this will work wherever your portlet JSPs are located (see: http://firstname.lastname@example.org/msg09237.html for the original post)" Anyway, if the loader was unable to find the JAR/Class file I would get either get a FileIO error or a ClassNotFound error. Does anyone have any suggestions as to what could be causing this problem? Thanks in advance. ===== email@example.com Eagles may soar, but weasels don't get sucked into jet engines.
Eagles may soar, but weasels don't get sucked into jet engines.
Somewhere on your machine you have two different versions of the jdk. The "bad magic number" means that java is expecting classes from one of them and instead is finding classes from the other version. Get rid of one of the versions and you will have solved your problem.
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
I don't think it's a JVM version. You would get an UnsuportedClassVersionError. The magic number is the 0xCAFEBABE marker at the beginning of the class files. It would indicate that the class file being loaded is either not a class file or is being corrupted in transit. (perhaps an attempt to transfer a binary file as text file)