Java applet audio with pulseaudio broken (local apps likely broken)

Bug #525883 reported by David Stenglein
162
This bug affects 32 people
Affects Status Importance Assigned to Milestone
openjdk-6 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: openjdk-6-jre

Problem: No audio output from applets in firefox using pulseaudio.

charm% lsb_release -rd
Description: Ubuntu 9.10
Release: 9.10

This bug is in a combination of packages:
 - openjdk-6-jre 6b16-1.6.1-3ubuntu1
 - openjdk-6-jre-lib 6b16-1.6.1-3ubuntu1
 - icedtea6-plugin 6b16-1.6.1-3ubuntu1

Examples:
  - Webex meetings
  - http://www.javazoom.net/applets/tinyplayer/tinyplayer.html

Doing some investigation, I found two things:

 - There is a security policy problem for applets using sound
 - There is a packaging problem with the location of the native pulse library for java

Working backwards using java stacktraces on stderr, I found the following permissions
were necessary to get audio output from java:

$ cat .java.policy
grant {
  permission java.lang.RuntimePermission
        "loadLibrary.pulse-java";
  permission java.io.FilePermission
        "/usr/lib/jvm/java-6-openjdk/jre/lib/ext/i386/libpulse-java.so", "read";
};

Then, I found that the .so file didn't actually exist! Instead, it's in a different directory:

$ dpkg -L openjdk-6-jre | grep pulse
/usr/lib/jvm/java-6-openjdk/jre/lib/i386/libpulse-java.so

Making a symbolic link fixed everything and made it work:

$ ls -l /usr/lib/jvm/java-6-openjdk/jre/lib/ext/i386
lrwxrwxrwx 1 root root 7 2010-02-22 11:19 /usr/lib/jvm/java-6-openjdk/jre/lib/ext/i386 -> ../i386

I can't say how the policies should be managed for applets, but even regular java programs aren't likely to work until the packaging is fixed.

-Dave

Revision history for this message
Matthias Klose (doko) wrote :

> $ cat .java.policy
this file is not part of a package. where does it come from?

I cannot understand your statement about the security problem

Changed in openjdk-6 (Ubuntu):
status: New → Incomplete
Revision history for this message
David Stenglein (stengleind) wrote :

>> $ cat .java.policy
>this file is not part of a package. where does it come from?
>
>I cannot understand your statement about the security problem

In essence, without making these local (per-user) additions to the java security policy within my account, an applet will not have permission to load the pulseaudio library or read the actual file containing the library.

This is not in a packaged file because I did not research where it should go and that decision has repercussions for the security of the system.

This ticket encompasses two different issues:

A) libpulse-java.so is in the wrong place, which will break all java applications that wish to use pulseaudio.
B) Java applets do not have permission to load native pulseaudio libraries and therefore will not be able to play audio

These issues are distinct from each other and perhaps should have been reported separately. I found them together after a fair bit of work and dumped everything here.

Revision history for this message
Matthias Klose (doko) wrote :

please could you recheck with a recent liveCD build of Ubuntu lucid? the applet and sound works for me.

Revision history for this message
Matthias Klose (doko) wrote :

closing as invalid. the applet works, and it's a user error to use the wrong path in the local config file

Changed in openjdk-6 (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
David Stenglein (stengleind) wrote :

This still doesn't work for me in 10.04, even after I stopped using "the wrong path in the local config file", which is a drastic oversimplification of my bug report.

I either get no audio, or an NPE and no audio.

However, an strace shows that libpulse-java.so is now getting loaded from the correct location so things may be working properly and something else is wrong with my particular system configuration.

After numerous technical difficulties, we've stopped using webex, so I don't have any desire to pursue this.

Revision history for this message
Alan Lord (theopensourcerer) wrote :

Sounds like the same problem in 10.10 for me.

Last week (on 10.04) I attended a Webex - Java - webinar on OpenERP. Audio was fine.

This week, I attempted to join a further webinar from the same company again via webex. I am now running a fresh 10.10 64bit Desktop install.

The conference loads OK but sound fails to work. When I try to join the audio I get the following message:

"The Audio Device is Unaccessible Now"

Trying a simple java audio device http://www.roseindia.net/java/example/java/applet/PlaySoundApplet.html also fails to produce any audio but no error messages to the user.

I tried adding a "Policy" as above, but this didn't seem to make any difference. The statement I added was:

// Added by me to try and fix broken audio in Webex.
// Link to source: https://lists.launchpad.net/openjdk/msg02992.html
grant {
  permission java.lang.RuntimePermission
        "loadLibrary.pulse-java";
  permission java.io.FilePermission
        "/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libpulse-java.so", "read";
};

Revision history for this message
Peter Lundqvist (peterl) wrote :

I have the same problem in 10.10 (and in 10.4).

Revision history for this message
Jarkko Torvinen (jarkkot) wrote :

Why are you closing this bug as invalid!?? How is it a user error if the bug still exists in default install (running 10.10 amd64)

Fix is to:
# ln -s ../amd64 /usr/lib/jvm/java-6-openjdk/jre/lib/ext/amd64

and then add to /etc/java-6-openjdk/security/java.policy

        permission java.lang.RuntimePermission "loadLibrary.pulse-java";
        permission java.io.FilePermission "/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libpulse-java.so", "read";

That got the http://www.roseindia.net/java/example/java/applet/PlaySoundApplet.html playing sound. Need to test microphone in next webex meeting

Revision history for this message
erny (erevilla) wrote :

Although the RoseIndia demo mentioned above works for me with sun Java 1.6.22, and the .java.policy and adjusted path for libpulse-java.so, Cisco's WebEx does still complain about audio.

I'll try it with openjdk.

Revision history for this message
Ricardo Almeida (ric-almeida) wrote :

This also happens to me (Ubuntu 10.10 on amd64)... Couldn't fix it with proposed security permissions :(

Changed in openjdk-6 (Ubuntu):
status: Invalid → Confirmed
Revision history for this message
Ricardo Almeida (ric-almeida) wrote :

ok, I got it :) Should have read instructions more clearly... In resume:

1) Lib file is in wrong place, to fix it, execute:

sudo ln -s /usr/lib/jvm/java-6-openjdk/jre/lib/amd64 /usr/lib/jvm/java-6-openjdk/jre/lib/ext/amd64

2) Permissions are wrong. Must create a .java.policy file with the following content:

grant {
    permission java.lang.RuntimePermission "loadLibrary.pulse-java";
    permission java.io.FilePermission "/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libpulse-java.so", "read";
};

Ubuntu should have lib in right place and .java.policy file in /etc/skel/, so new users are created with it...

Revision history for this message
Paul Ebermann (paul-ebermann) wrote :

I reported this some time ago at the IcedTea bug tracker, but it seems the problem is ubuntu specific. Nevertheless, I think I can add a link here: http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=595

Revision history for this message
koma (koen-koma) wrote :

Followed the fixes by adding symbolic link and policy file.
Let's hope my next Webex has sound;

Revision history for this message
sceo (christopher-j-wells) wrote :

The fixes listed seem to get audio to play from http://www.javazoom.net/applets/tinyplayer/tinyplayer.html and http://www.roseindia.net/java/example/java/applet/PlaySoundApplet.html but webex meetings still don't work. Fail with "You do not have the necessary audio capabilities (error: -1)" (I'm paraphrasing).

So what makes webex different; that is also needs a mic?

Revision history for this message
ikke (ikke-iki) wrote :

I confirm the bug and the fix by jarkko and ricardo. This is what I did:

sudo ln -s ../i386 /usr/lib/jvm/java-6-openjdk/jre/lib/ext/i386

cat > .java.policy
grant {
    permission java.lang.RuntimePermission "loadLibrary.pulse-java";
    permission java.io.FilePermission "/usr/lib/jvm/java-6-openjdk/jre/lib/i386/libpulse-java.so", "read";
    permission java.io.FilePermission "/usr/lib/jvm/java-6-openjdk/jre/lib/ext/i386/libpulse-java.so", "read";
};

and it fixed similar error:

java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.pulse-java)

among the not finding libpulse-java.so -problem.

This is done using maverick, updated latest today. My daughter hit the problem at some first grade school education pages at: http://opit.wsoy.fi , which I believe requires authenticaiton. Sorry I can't provide sample due auth.

Revision history for this message
Vadim Peretokin (vperetokin) wrote :

This issue still seems to be present, and it is affecting Sun Java as well...

Revision history for this message
Vadim Peretokin (vperetokin) wrote :

Oops, nevermind about Sun Java, for some reason I still had OpenJDK installed and was using it. Nonetheless, it's still present for OpenJDK.

Revision history for this message
Vadim Peretokin (vperetokin) wrote :

Although after only getting:

$ update-alternatives --list java
/usr/lib/jvm/java-6-sun/jre/bin/java

On the list, the issue was still present.

Revision history for this message
xpecttrum (xpecttrum) wrote :

Hello,

I have the same problem in webex and ubuntu 11.04

I try all the proposed solutions above, but none of them worked, I crated the simbolic link as:

sudo ln -s /usr/lib/jvm/java-6-openjdk/jre/lib/amd64 /usr/lib/jvm/java-6-openjdk/jre/lib/ext/amd64

I added the

grant {
    permission java.lang.RuntimePermission "loadLibrary.pulse-java";
    permission java.io.FilePermission "/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libpulse-java.so", "read";
};

to the /etc/java-6-openjdk/security/java.policy

I also created the .java.policy file in the home directory, because I could not find any.

Nothing worked, I still have the same problem:

Webex report: Audio device is not accessible now

Any suggestions?

(I even tryed to run firefox as root and I got the same error)

Plz, I need more suggestions.

Revision history for this message
Daniele Dellafiore (ildella) wrote :

I've performed the #11 solution, having a 64 bit installation, and put the .java.policy file in my user home but I still have same issue: audio device is not accessible.
Ubuntu 11.10.
3.0.0-16-generic #28-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10.2)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode

Revision history for this message
Søren Holm (sgh) wrote :

The same problem exist on current 12.04 i386 pre-release.

Revision history for this message
IlyaY (ilya-yanok) wrote :

Both test applets are working for me without any workaround but webex doesn't. Ubuntu 11.10 x64

Revision history for this message
Wirawan Purwanto (wirawan0) wrote :

@IlyaY: I also suffer the same problem with webex. Ubuntu 10.04 x86. Do you have a test website for us to test out webex issue?

Revision history for this message
Matthias Klose (doko) wrote :

works with openjdk-6/icedtea-web in precise

Changed in openjdk-6 (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Garvin (internetprofiles1) wrote :

Matthias can you check if you run this java test on your system to see if it can play and record audio.

http://austincc.wimba.com/austincc/wizard/launcher.jsp

error is "initializing audio"
it never goes further on load.

I have been working on this issue for months. on a related ubuntu forum we managed to confirm the above link only works on ubuntu 8.04 with sun java once we upgrade to 8.10 or higher it does not work. I was wondering if this post about java security permissions is related to the problem I am having.

The original forum that was working on it is at this link

 http://ubuntuforums.org/showthread.php?t=1558065

I've since given up and now force to dualboot windoze 7 with ubuntu 11.10

Revision history for this message
Søren Holm (sgh) wrote :

Hey that is a nice test. But the for me is that it does not work. I would wich that webex had a public setup/test wizard....

Iøm runnign the currence Ubuntu Precise.

Revision history for this message
Søren Holm (sgh) wrote :
Revision history for this message
Søren Holm (sgh) wrote :

webex still does not work. Why is this markes as fixed? Or are any additional steps necessary before the released fix will work?

Revision history for this message
Daniel Eloff (dan-eloff) wrote :

Just wanted to add that with sun java 7 installed (and openjdk removed) webex does not work (Audo device is not accessible now)

This works: http://www.javasonics.com/listenup/examples/record_upload_wav.html

Using 12.04

Revision history for this message
Wirawan Purwanto (wirawan0) wrote :

@dan-eloff: is your system 32-bit or 64-bit? I learned yesterday that webex does not work on linux 64-bit system because they have 32-bit shared libraries as part of their system. So everything has to run on 32-bit Sorry I don't have time to get the exact link again, but a search on the web might solve your problem. Let me know how it goes and maybe we can all benefit from your experience.

Revision history for this message
Tom Ellis (tellis) wrote :
Revision history for this message
Catalin Patulea (cpatulea) wrote :

The symlink/java.policy workaround worked for me on 10.04 - thank you!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.