Re: Question about connecting to HBase


Jerry <boyeggp...@...>
 

Hi Marc,
I use the GraphOfTheGodsFactory example  and the load method is exactly same as the source code.
The following is the code snippet and the link to github :https://github.com/JanusGraph/janusgraph/blob/master/janusgraph-core/src/main/java/org/janusgraph/example/GraphOfTheGodsFactory.java

public static void loadWithoutMixedIndex(final JanusGraph graph, boolean uniqueNameCompositeIndex) {
        load(graph, null, uniqueNameCompositeIndex);
    }

    public static void load(final JanusGraph graph) {
        load(graph, INDEX_NAME, true);
    }

    public static void load(final JanusGraph graph, String mixedIndexName, boolean uniqueNameCompositeIndex) {

Based on the error message, it seems the program stopped at open() function before the load():

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/MasterNotRunningException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:56)
at org.janusgraph.diskstorage.Backend.getImplementationClass(Backend.java:480)
at org.janusgraph.diskstorage.Backend.getStorageManager(Backend.java:414)
at org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1343)
at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:107)
at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:75)
at org.janusgraph.example.GraphOfTheGodsFactory.main(GraphOfTheGodsFactory.java:169)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

Thanks in advance,
Jerry


On Sunday, April 23, 2017 at 7:11:51 PM UTC+8, HadoopMarc wrote:
Hi Jerry,

What does your load() function/method look like?

Did you include the janusgraph-hbase dependency in your Intellij project?

Cheers,     Marc

Op vrijdag 21 april 2017 14:12:51 UTC+2 schreef Jerry:
Hi ,
Sorry for the repost!
I am new to the JanusGraph and  setup a JanusGraph database  on my cluster .The storage is HBase with Zookeeper as coordinator.

I try to run the GraphOfTheGodsFactory example from IntelliJ Idea. I configure the janusgraph-hbase.properties  as following:

storage.hostname=10.1.1.2,10.1.1.3,10.1.1.4
storage.port=2181

The IP addresses are zookeeper servers.
I run the following codes:

JanusGraph g = JanusGraphFactory.open("/janusgraph/conf/janusgraph-hbase.properties");
load(g);
I get the following error message:

 java.lang.ClassNotFoundException: org.apache.hadoop.hbase.MasterNotRunningException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

but I can connect to the Hbase in gremlin shell with the same conf file.
I know the error message is about the ClassNotFoundException but it seems the JanusGraphFactory cannot connect to Hbase and then reports the MasterNotRunningException after checking the source code 

public final static <T> T instantiate(String clazzname, Object[] constructorArgs, Class[] classes) {
Preconditions.checkArgument(constructorArgs!=null && classes!=null);
Preconditions.checkArgument(constructorArgs.length==classes.length);
try {
Class clazz = Class.forName(clazzname);
Constructor constructor = clazz.getConstructor(classes);
T instance = (T) constructor.newInstance(constructorArgs);
return instance;
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Could not find implementation class: " + clazzname, e);
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException("Implementation class does not have required constructor: " + clazzname, e);
} catch (InstantiationException e) {
throw new IllegalArgumentException("Could not instantiate implementation: " + clazzname, e);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Could not instantiate implementation: " + clazzname, e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException("Could not instantiate implementation: " + clazzname, e);
} catch (ClassCastException e) {
throw new IllegalArgumentException("Could not instantiate implementation: " + clazzname, e);
}
}

I wonder if you have any suggestion on solving this problem? 
Thanks in advance!

Join {janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.