OpenAL exception when closing an application


I am using a streamed background music (ogg) in my game and everything works great. However, when I close the application, the following exception is thrown:

Exception in thread "Thread-4" java.lang.UnsatisfiedLinkError: org.lwjgl.openal.AL10.nalGetSourcei(II)I
   at org.lwjgl.openal.AL10.nalGetSourcei(Native Method)
   at org.lwjgl.openal.AL10.alGetSourcei(

It is totally harmless because it only appears at the Java console and does not seem to affect the closing process at all (at least what could be noticed by a user). What is more curious, the exception is not thrown in all cases - sometimes it appears and sometimes not.

Is there anything I can do to avoid it? I am always using the latest sources of jME (from CVS) and the most recent versions of all libraries.


Are you calling cleanup on AudioSystem?

Of course. This is what I call at the cleanup() block:

        if (AudioSystem.isCreated())

Ah well then what is probably happening is that one thread kills openal just as the other is about to issue openal commands.  We can probably take care of much of that (musicqueue and environpool sounds anyhow) in the system's cleanup method.

hey … i got the same problem also … same error … how do you guys solve the problem? please … ://

I got the same error even if calling AudioSystems cleanup in my class derived from BaseGame.

I got rid of it by manually removing all tracks from the track queues before calling cleanup().

AudioSystem.cleanup() does a clearTracks() on the queues and clearTracks() only clears the ArrayList while

removeTrack() calls AudioTrack.stop() and AudioPlayer.cleanup().

(jme2, lwjgl2.0.1)

Hi and welcome :slight_smile:

Can you write a test showing the problem and the solution?

I found out that if I don't call cleanup at all then I get no errors. IF I call AudioSystem.cleanup() then I have to manually clean up tracks:

protected void cleanup() {

        MusicTrackQueue mtq = AudioSystem.getSystem().getMusicQueue();
        while (!mtq.getTrackList().isEmpty()) {

        EnvironmentalPool ep = AudioSystem.getSystem().getEnvironmentalPool();
        while (!ep.getTrackList().isEmpty()) {


.. or else I get the error.