Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!

Sam Foletta

+ Follow
since Apr 28, 2009
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sam Foletta

You're absolutely right. Just added a "toString()" and it worked like a charm.

Final code looked something like this:

and later...

I ran into the same problem with AudioClips, actually, and since they only accept URLs and not InputStreams I assume this fix won't work and I'll have to use Clips and AudioSystem.

Anyways... thanks for the help!
11 years ago
Yes, is the same server, the midi is in a subdirectory of the applet's directory.

I tried calling getSequence with InputStream, URL, and File inputs with the same results, even tried skipping the sequence altogether and calling setSequence with an InputStream, no luck. I placed the call in a PrivilegedAction and signed the script just to try everything. Always an access denied error.

Picking through the console at a higher trace level, I noticed that other resources were being redirected to "stopit.php". When I opened it up in Firefox, it brought up a page that states direct/hot linking is not allowed. It looks like the host server is blocking the applet's connection to these files thinking that they're being linked to by a foreign web site. Yet image files still get through somehow. Hmm...

Any way to get around that?
11 years ago
So, I tried that, getCodeBase() threw a NullPointerException so I moved that line from the constructor to init(), but now I get this:

I tried signing the applet, no luck there. Do I need to use privileges? This seems so excessively problematic for loading a midi.

11 years ago
Hi! First time caller, long time listener.

I'm getting an access denied error trying to load a midi file on the server, in a subdirectory of the applet's folder. As in, the applet root/ffp.class, on webpage root/ffp.htm, is trying to access root/mid/wm0.mid, and is denied access.

It works fine when I run the applet on my hard disk, but run from the server it throws an AccessControlException (access denied). This is odd, because I can put the same midi file into an AudioClip and run it with no problem. However, I don't have much control over playback with AudioClip and prefer to use a midi sequencer. I'm trying to load the midi file as a FileInputStream which, again, works fine when I run it on my hard disk, but doesn't work once I upload it onto the server.

Shouldn't the applet already have access to files in subdirectories without modifying permissions? Especially if the applet can already access the same files as a different data type? I feel like I'm missing something here.

The code is basically the following:

The line that calls MidiSystem.getSequence throws the following error:

Would very much appreciate any help.
11 years ago