Welcome Guest, Not a member yet? Register   Sign In
Java applet in a view, "magic value" error...
#1

[eluser]wskoch[/eluser]
Hi everyone,
I'm trying to embed a java applet into one of my view files, but I'm getting a strange error. The applet loads fine if I load the view from the index() portion of the model file, but if I put it in another function (which would be ideal -- I'm trying to send it some parameters from a URI segment), I get the following error:

java.lang.ClassFormatError: Incompatible magic value 1013478509 in class file JDScrollingImagemap
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassFormatError: Incompatible magic value 1013478509 in class file JDScrollingImagemap

Here is what the URL looks like (running off my local server, of course):
http://localhost/buildingMap/index.php/b...oadLevel/2
So loadLevel is the name of the function containing the code to load the view, and "2" is a parameter being passed to it.
Again, if I navigate to http://localhost/buildingMap, the view with the applet is loaded with no problems. Any suggestions? Thanks!

Warner
#2

[eluser]pistolPete[/eluser]
Please post your view code.
Which browser are you using? Which Java VM?
Does the applet load some relative located ressources?
Have a look at http://forums.sun.com/thread.jspa?threadID=640927
#3

[eluser]wskoch[/eluser]
Hi,
Thanks for the response! I'm using IE6 (it's for a information kiosk which has to use it), but I get the same error across all browsers: IE, FF, Opera, Safari... I'm using the standard JRE (version 6, update 12). The applet does load a few pictures that are expected to be found in the same folder as the class files. Here is my view code (it's messy, simple and ugly right now, because I'm just trying to get it to load the app correctly at the moment. Also I edited out a couple of IP addresses that were in the code):
Code:
<html>

<head>
<base target="main">
<title>Waterman building Map</title>
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
</head>

<body bgcolor="#FFFFFF" topmargin="0" leftmargin="0">
<? echo $_SERVER['REMOTE_ADDR'];
$ip = $_SERVER['REMOTE_ADDR'];
if($ip == "IP ADDRESS ERASED"){
    $client = "ATRIUM";
}
else if($ip == "IP ADDRESS ERASED"){
    $client = "CLINIC";
}
else if($ip == "IP ADDRESS ERASED"){
    $client = "WARNER";
}

else if($ip == "127.0.0.1"){
    $client = "WARNER";
}
echo $client;
?>
<?
if($floor == "1"){
    $bigPicture = "waterman1st.jpeg";
    $smallPicture = "waterman1st_small.jpeg";
}
else if($floor == "2"){
    $bigPicture = "waterman2nd.jpeg";
    $smallPicture = "waterman2nd_small.jpeg";
}
else{
    $bigPicture = "waterman1st.jpeg";
    $smallPicture = "waterman1st_small.jpeg";
}
echo <<&lt;APPLET
&lt;p><small><font face="Arial"><small>
&lt;applet CODE="JDScrollingImagemap.class" WIDTH="930" HEIGHT="522" align="left"&gt;
  <param name="scrollBoxColor" value="000000">
  <param name="borderColor" value="000000">

  <param name="imagemap_file_name" value="$bigPicture">
  <param name="index_file_name" value="$smallPicture">
  <param name="scale" value="2">
  <param name="youAreHere_file_name" value="youAreHere_sm.png">
  <param name="client" value="$client">
  <param name="imagemap_data" value="
  10, 100, 100, 200, http://www.google.com;">Your browser does not support java, click back button to return
&lt;/applet&gt;
APPLET;
?&gt;
</small></font></small></p>

<p align="center">&nbsp;</p>

<p align="center"><br>
<br clear="all">
</p>
&lt;/body&gt;
&lt;/html&gt;

Also I looked at the site you posted (had actually seen that very post before in my quest for an answer on google). Wasn't sure if that was the problem with mine, and even if it was, was unsure of how to implement it in my situation. Thanks!
Thanks again -- any further help would be great. I'm pulling my hair out with this one.

Warner
#4

[eluser]pistolPete[/eluser]
Where are $bigPicture and $smallPicture located?
Try using absolute paths:

Code:
<param name="imagemap_file_name" value="/path/to/$bigPicture">
<param name="index_file_name" value="/path/to/$smallPicture">
<param name="scale" value="2">
<param name="youAreHere_file_name" value="/path/to/youAreHere_sm.png">


Quote:Wasn’t sure if that was the problem with mine
I don't know either, but maybe your java applet gets some "faulty" 404 responses from CodeIgniter/PHP.

I'd suggest using a network monitoring tool like wireshark to see which request actually are made and what responses are sent.
#5

[eluser]wskoch[/eluser]
Hi again,
Thanks for the responses -- I got it working. Putting all my class files into a jar archive fixed it. Thanks again,
Warner




Theme © iAndrew 2016 - Forum software by © MyBB