This discussion is archived
1 Reply Latest reply: Oct 25, 2012 8:13 AM by DarrylBurke RSS

Serving an applet that should be embedded in a webpage

970669 Newbie
Currently Being Moderated
I'm new here, so hi all :-)

I'm using Moodle (this is not really relevant... I think) to embed and serve an applet to my students.

This is the code I have:

<applet code="FallingBall_pkg.FallingBallApplet.class"
codebase="http://localhost/pluginfile.php/25/mod_ejsapp/jarfile/5/"
archive="ejs_FallingBall.jar"
name="ejs_FallingBall"
id="ejs_FallingBall"
width="800"
height="600">
<param name="context_id" value="5"/>
<param name="user_id" value="2"/>
<param name="ejsapp_id" value="5"/>
<param name="language" value="en"/>
<param name="username" value="Admin User"/>
<param name="password" value="8560f4ae284f4930b22567fd7945f2b5"/>
<param name="moodle_upload_file" value="http://localhost/mod/ejsapp/upload_file.php"/>
</applet>

Now, Moodle stores files in a data folder (outside the apache root folder) and those files are served using the pluginfile.php script, which is provided by the Moodle software.

I think there is nothing wrong with my code because it works and by that I mean the applet loads and it is shown embedded in the webpage BUT it can take even 4 or 5 minutes to do so!

Depending on the applet, it can actually only take a few seconds, which is the time it usually takes to load most embedded applets around there.

Even more, if I write http://localhost/pluginfile.php/25/mod_ejsapp/jarfile/5/ejs_FallingBall.jar in my browser's url bar, I instantly get the option to download the file and this is done quickly.

Everytime the webpage with the previous code is loaded, pluginfile.php is called. Regardless the applet being used, pluginfile.php always receive something like:

/21/mod_ejsapp/jarfile/1/ejs_Gyroscope.jar

Which is ok.

Now, while for some applets the previous call to pluginfile.php is done only once (this are the cases in which the applet loads in jus a few seconds, and this is the way it should work), for others pluginfile.php can be called 10 or 15 times, receiving something like:

/21/mod_ejsapp/jarfile/1/org/opensourcephysics/tools/DefaultState.out

or

/21/mod_ejsapp/jarfile/2/servo_pkg/images/Servo.jpg

or

/21/mod_ejsapp/jarfile/3/org/opensourcephysics/resources/Resources.properties

This are just random examples. Anyway, the thing is all those are files inside of some of the .jar files. I don't know how or why this happens but it seems to me that Moodle File API open the .jar files and sometimes (only for some applets) it decides that it needs to serve those files inside the .jar aswell as the .jar itself. When this happens, it seem those files can't be accessed (so they cant be served) and Moodle keeps trying. As I said, sometimes 15 calls to pluginfile.php (always receiving the same parameters) are done.

When looking at the apache logs, I can see messages like these ones:

[Wed Oct 17 20:14:25 2012] [error] [client 127.0.0.1] File does not exist: C:/Moodle/server/moodle/mod/ejsapp/DefaultState.out
[Wed Oct 17 20:14:25 2012] [error] [client 127.0.0.1] Default exception handler: Sorry, the requested file could not be found Debug: \r\nError code: filenotfound\n* line 467 of \\lib\\setuplib.php: moodle_exception thrown\n* line 1917 of \\lib\\filelib.php: call to print_error()\n* line 4221 of \\lib\\filelib.php: call to send_file_not_found()\n* line 38 of \\pluginfile.php: call to file_pluginfile()\n

Thats from the error.log file.



127.0.0.1 - - [17/Oct/2012:20:14:25 +0200] "HEAD /mod/ejsapp/DefaultState.out HTTP/1.1" 404 - "-" "Mozilla/4.0 (Windows XP 5.1) Java/1.7.0_07"
127.0.0.1 - - [17/Oct/2012:20:14:25 +0200] "HEAD /pluginfile.php/21/mod_ejsapp/jarfile/1/org/opensourcephysics/tools/DefaultState.out HTTP/1.1" 404 - "-" "Mozilla/4.0 (Windows XP 5.1) Java/1.7.0_07"

The last one is from the access.log file.



Well, I think thats all. I hope someone has an idea of what might be going on here.

Im sorry for the huge message with the tons of lines of code but I am totally lost and I really need help.

Thanks.

Edited by: 967666 on 25-oct-2012 7:36

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points