Hello, Thanks for the tip. I have added all the jar files in HBASE_HOME and HBASE_HOME/lib and HBASE_HOME/conf is in the classpath. Going through the code of Configuration.java and HBaseConfiguration.java, the latter is a simple subclass and setClassLoader replaces the classloader with a user supplied one. This classloader is then used to things like Class.forName(...)
I didn't understand the bit about recursive class loaders, there being only one right? Thanks again for the information Cheers Saptarshi On Thu, Jul 9, 2009 at 2:23 PM, Ryan Rawson<ryano...@gmail.com> wrote: > You need to include everything in lib/*.jar. this includes the hadoop jar... > > The problem might be that rcl isn't registering itself so the recursive > class loaders aren't using rcl? > > On Jul 9, 2009 2:15 PM, "Saptarshi Guha" <saptarshi.g...@gmail.com> wrote: > > Hello, > I'm using HBase(trying to) from another language (R) which has it's > own classloader (call it RCL) > RCL takes its own classpath (in which i've included all Hbase JARS and > conf folder) and > did the following > > cfg <- .jnew("org/apache/hadoop/hbase/HBaseConfiguration") ## Create > a new Java object > .jcall(cfg,"V","setClassLoader",.jcast(.jclassLoader(),"java/lang/ClassLoader")) > ##Call setClassLoader on cfg, replacing it with RCL > .jcall("org/apache/hadoop/hbase/client/HBaseAdmin","V","checkHBaseAvailable",cfg) > ## call the static method checkHBaseAvailable > .jcheck() ## check for exceptions > Exception in thread "main" java.lang.RuntimeException: Socket Factory > class not found: java.lang.ClassNotFoundException: > org.apache.hadoop.net.StandardSocketFactory > at > org.apache.hadoop.net.NetUtils.getSocketFactoryFromProperty(NetUtils.java:111) > at > org.apache.hadoop.net.NetUtils.getDefaultSocketFactory(NetUtils.java:91) > > So it appears the classloader can't find it. But it can, > .jnew("org/apache/hadoop/net/StandardSocketFactory") returns a Java > Object corresponding to this class. > > The configuration's class loader is in fact replaced yet for some > reason this class cannot be found. > This is the code in NetUtils > public static SocketFactory getSocketFactoryFromProperty( > Configuration conf, String propValue) { > > try { > Class<?> theClass = conf.getClassByName(propValue); > return (SocketFactory) ReflectionUtils.newInstance(theClass, conf); > > } catch (ClassNotFoundException cnfe) { > throw new RuntimeException("Socket Factory class not found: " + cnfe); > } > > I see no reason why this is throwing the exception when clearly the > class is present. > Any help would be appreciated > Regards > Saptarsho >