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

Reply via email to