Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javazoom player not opening sfd.ser

    I will warn you that I have not been programming in Java for very long, but I'm familiar with C++ and it's not so very different. Also, the program on which I'm working was not started by me, so there are areas with which I am still unfamiliar. That said, my problem...

    The program, when I found it, had a "Javalayer MP3 decoder" from http://www.javazoom.net/javalayer/javalayer.html. It worked fine, but was old. Seeing that the new one had some functionality I needed, I have updated all the files I need (the music agent makefile and MusicAgent, specifically) but when I run it, I get this error:

    Code:
    java.lang.ExceptionInInitializerError
    
    	at javazoom.jl.decoder.SynthesisFilter.load_d(SynthesisFilter.java:1624)
    	at javazoom.jl.decoder.SynthesisFilter.<init>(SynthesisFilter.java:73)
    	at javazoom.jl.decoder.Decoder.initialize(Decoder.java:282)
    	at javazoom.jl.decoder.Decoder.decodeFrame(Decoder.java:137)
    	at javazoom.jl.player.Player.decodeFrame(Player.java:206)
    	at javazoom.jl.player.Player.play(Player.java:113)
    	at javazoom.jl.player.Player.play(Player.java:97)
    	at MusicAgent.MusicBox.run(MusicAgent.java:271)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: unable to load resource 'sfd.ser'
    	at javazoom.jl.decoder.JavaLayerUtils.deserializeArrayResource(JavaLayerUtils.java:145)
    	at javazoom.jl.decoder.SynthesisFilter.load_d(SynthesisFilter.java:1619)
    	... 8 more
    The program itself is quite large, so I regret that I can't give you all the code you might need... just ask for specific bits if I'm not showing you enough.

    Synthesis Filter (part of Javazoom)

    Code:
    static private float[] load_d()
    {
    	try
    	{
    		Class elemType = Float.TYPE;
    		Object o = JavaLayerUtils.deserializeArrayResource("sfd.ser", elemType, 512);
    		return (float[])o;
    	}
    	catch (IOException ex)
    	{
    		throw new ExceptionInInitializerError(ex);
    	}
    }
    Java Layer Utils (part of Javazoom)

    Code:
    static public Object deserializeArrayResource(String name, Class elemType, int length) throws IOException
    {		
    	InputStream str = getResourceAsStream(name);
    	if (str==null)
    		throw new IOException("unable to load resource '"+name+"'");
    	Object obj = deserializeArray(str, elemType, length);
    	return obj;
    }
    Code:
    static synchronized public InputStream getResourceAsStream(String name)
    {
    	InputStream is = null;
    	if (hook!=null)
    	{
    		is = hook.getResourceAsStream(name);	
    	}
    	else
    	{
    		Class cls = JavaLayerUtils.class;
    		is = cls.getResourceAsStream(name);
    	}
    	return is;		
    }
    I have no idea what a hook is, but this is still the Javazoom code, so I sort of suspect that's not the problem.

    MusicAgent - MusicBox

    Code:
    public void run()
    {
    	if(musicSocket != null)
    	{
    		try
    		{
    			if (!initd)
    			{
    				player = new Player(sin);
    				initd = true;
    			}
    			player.play();
    		}
    		catch(Exception e)
    		{
    			Log.logInfo("problem with the player");
    		}
    	}
    	else
    	{
    		Log.logInfo("MusicBox failed to run");
    	}
    }
    Which should be innocent enough.

    MusicAgent - imports

    Code:
    import java.io.*;
    import java.net.*;
    import java.lang.*;
    
    import teema.*;
    //import MusicAgent.javazoom.jlme.decoder.*;
    //import MusicAgent.javazoom.jlme.util.*;
    // Old above, new below
    import javazoom.jl.player.*;
    import javazoom.jl.decoder.*;
    import javazoom.jl.converter.*;
    makefile

    Code:
    @echo off
    
    del MusicAgent.jar
    
    javac -classpath ..\;..\..\;.\ *.java
     rem OLD javac -classpath ..\;..\..\;.\ javazoom/jlme/util/*.java
     javac -classpath ..\;..\..\;.\ javazoom/jl/player/*.java
     javac -classpath ..\;..\..\;.\ javazoom/jl/decoder/*.java
     javac -classpath ..\;..\..\;.\ javazoom/jl/converter/*.java
    rem Gives same error with or without compiling these last two
    
    cd ..
     rem jar cmf MusicAgent/Manifest.txt MusicAgent/MusicAgent.jar MusicAgent/*.class MusicAgent/javazoom/jlme/util/*.class MusicAgent/javazoom/jlme/decoder/*.class MusicAgent/d16.dat MusicAgent/huffman.dat d16.dat
    rem Old above, new below
     jar cmf MusicAgent/Manifest.txt MusicAgent/MusicAgent.jar MusicAgent/*.class javazoom/jl/player/*.class javazoom/jl/decoder/*.class javazoom/jl/converter/*.class javazoom/jl/decoder/*.ser MusicAgent/d16.dat MusicAgent/huffman.dat d16.dat
    cd MusicAgent
    
    del *.class
    I've tried moving the file into multiple folders, but I suppose I can't remove that possibility entirely. So... I'm hoping someone here has seen a similar problem before, or can recognize what it might be. Thanks in advance for any tips!
    Last edited by Parmeisan; 10-14-2004 at 05:01 PM. Reason: Fixing indentation

  • #2
    New to the CF scene
    Join Date
    Apr 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Permission problem?

    The original post is quite old. But the same problem occurred to me lately: An IOException stating sfd.ser could not be read.

    In my case the JVM started with a SecurityManager and the solution was to grant read access to the audio jar-Files in the policy file.

    So the OP's problem could have been a permission problem.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •