Im getting this very odd error with sun java and ubuntu.
"java.lang.ClassNotFoundException: com.sun.security.auth.UnixPrincipal"
This class appears to be a sun specific class, and i have a fresh, working version of sun java 1.6 on ubuntu 12.04. I have confirmed that my version of java is the correct one which is being used to run by class, and in fact, that the other versions (like openjdk) are not interfering.
Here are my specs :
$ java -version java version "1.6.0_33" Java(TM) SE Runtime Environment (build 1.6.0_33-b03) Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03, mixed mode)
$ lsb_release -a No LSB modules are available. Distributor ID:
Ubuntu Description: Ubuntu 12.04 LTS Release: 12.04 Codename:
precise
The error :
home/vagrant/Development/workspace/xxxxx/build.xml:222: java.lang.NoClassDefFoundError: com/sun/security/auth/UnixPrincipal at org.apache.hadoop.security.UserGroupInformation.(UserGroupInformation.java:246) at org.apache.hadoop.fs.FileSystem$Cache$Key.(FileSystem.java:1436) at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1337) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:244) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:122) ... Caused by: java.lang.ClassNotFoundException: com.sun.security.auth.UnixPrincipal at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1361) at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1311) at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1070) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 38 more
'First, I thought this just meant that the class wasnt in my sun installation'
But the following :
unzip -l /usr/lib/jvm/java-6-sun/jre/lib/rt.jar | grep UnixPrincipal
revealed :
1272 2012-05-09 10:19 com/sun/security/auth/UnixPrincipal.class
And, by checking System.getProperties(), I found :
java.ext.dirs=....usr/lib/jvm/java-6-sun-1.6.0.33/jre/lib/rt.jar.....
Thus indicating that this class is in a jar which is certainly in the Runtime version of my java !
Thus, somehow, the java runtime is not able to load this class. I wonder why ?
One minor note : Im running it via ant 1.8. However, I dont think this should effect anything, since the Ant classloader is, I believe, relatively stable.