OpenJDK does not find libpcsc, fails silently, causing smartcard applications to fail
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openjdk-6 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
openjdk-7 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The current versions of OpenJDK do not correctly find the libpcsc native C library, causing them to remove PC/SC support silently. This breaks smartcard applications, as javax.smartcardio uses libpcsc to interface with smartcard terminals.
Please see the attached Example.java. It loads the default smartcardio terminal factory, and shows the type. Currently, Java JDK supports two terminal types[0]: "None" (a dummy type which always says there are no terminals) and "PC/SC" (interfaces with PC/SC terminals). The PC/SC terminal factory is the default, but if it cannot be loaded, the Java library silently falls back to "None".
Now, on Ubuntu, the library searches for the PC/SC library in /usr/lib and /usr/local/lib, but libpcsclite1 installs its library file in /lib/libpcsclit
$ javac Example.java
$ java Example
Terminal factory type: None
A workaround[0] is to set the Java system property sun.security.
$ javac Example.java
$ java -Dsun.security.
Terminal factory type: PC/SC
Note: you don't need to have any terminals attached to see this result.
I would like to request the JDK be patched to search for the PCSC library in the correct location, namely /lib, so PC/SC applications can work out-of-the-box without having to supply system properties every time Java is started.
[0] http://
ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: openjdk-6-jdk 6b23~pre11-
ProcVersionSign
Uname: Linux 3.0.0-13-generic x86_64
ApportVersion: 1.23-0ubuntu4
Architecture: amd64
Date: Thu Dec 1 16:20:56 2011
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
ProcEnviron:
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: openjdk-6
UpgradeStatus: No upgrade log present (probably fresh install)
Changed in openjdk-6 (Ubuntu): | |
status: | New → Confirmed |
Changed in openjdk-6 (Ubuntu): | |
status: | Confirmed → In Progress |
In openjdk-7 the same thing seems to happen, so also filing the bug there.