Needing help with neo4jHaGraph

128 views
Skip to first unread message

Richard Andrews

unread,
Nov 25, 2013, 6:42:37 PM11/25/13
to gremli...@googlegroups.com
Hello,

We have a java app in jar format using tinkerpop to an embedded neo4j instance.  We're trying to setup multiple instances of the java app with db replication but our app is throwing the following exception:

Exception in thread "main" java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [com.tinkerpop.blueprints.impls.neo4j.Neo4jHaGraph].
        at com.tinkerpop.blueprints.GraphFactory.open(GraphFactory.java:48)
        at com.tinkerpop.blueprints.GraphFactory.open(GraphFactory.java:62)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at com.tinkerpop.blueprints.GraphFactory.open(GraphFactory.java:41)
        ... 2 more
Caused by: java.lang.IllegalArgumentException: Missing mandatory setting 'ha.server_id'
        at org.neo4j.helpers.Settings$DefaultSetting.apply(Settings.java:759)
        at org.neo4j.helpers.Settings$DefaultSetting.apply(Settings.java:702)
        at org.neo4j.kernel.configuration.ConfigurationValidator.validate(ConfigurationValidator.java:50)
        at org.neo4j.kernel.configuration.Config.applyChanges(Config.java:121)
        at org.neo4j.kernel.configuration.Config.<init>(Config.java:89)
        at org.neo4j.kernel.InternalAbstractGraphDatabase.<init>(InternalAbstractGraphDatabase.java:219)
        at org.neo4j.kernel.ha.HighlyAvailableGraphDatabase.<init>(HighlyAvailableGraphDatabase.java:149)
        at org.neo4j.graphdb.factory.HighlyAvailableGraphDatabaseFactory$1.newDatabase(HighlyAvailableGraphDatabaseFactory.java:47)
        at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:207)
        at com.tinkerpop.blueprints.impls.neo4j.Neo4jHaGraph.<init>(Neo4jHaGraph.java:22)
        at com.tinkerpop.blueprints.impls.neo4j.Neo4jHaGraph.<init>(Neo4jHaGraph.java:30)

Despite the following config parameters.
blueprints.graph=com.tinkerpop.blueprints.impls.neo4j.Neo4jHaGraph
blueprints.neo4jha.directory=/data/neo/
blueprints.neo4jha.config.ha.server_id=1
blueprints.neo4jha.config.ha.server=xxx.xxx.xxx.xxx:6001
blueprints.neo4jha.config.ha.cluster_server=xxx.xxx.xxx.xxx:5001
blueprints.neo4jha.config.ha.initial_hosts=xxx.xxx.xxx.xxx:5001,xxx.xxx.xxx.xxx:5002

I'm stuck at the fact the exception is allegedly caused by a Missing ha.server_id parameter, yet it is there in my config.  Any ideas what I might be doing wrong here?

Stephen Mallette

unread,
Nov 26, 2013, 7:51:52 AM11/26/13
to gremli...@googlegroups.com
There was a mistype in the documentation.  I've fixed that now.  Please try:

blueprints.neo4jha.conf

as your configuration prefix instead of what you are using now ("blueprints.neo4jha.config").  

Stephen




--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Richard Andrews

unread,
Nov 26, 2013, 10:34:26 PM11/26/13
to gremli...@googlegroups.com
Hi Stephen,

Thank you for getting back to me on that one.  That has moved us past that exception onto another one.   Hopefully you have some insight into this one as well:
Collabinate Server Version 0.2.0
Exception in thread "main" java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [com.tinkerpop.blueprints.impls.neo4j.Neo4jHaGraph].
        at com.tinkerpop.blueprints.GraphFactory.open(GraphFactory.java:48)
        at com.tinkerpop.blueprints.GraphFactory.open(GraphFactory.java:62)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at com.tinkerpop.blueprints.GraphFactory.open(GraphFactory.java:41)
        ... 2 more
Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String
        at org.neo4j.graphdb.factory.GraphDatabaseBuilder.setConfig(GraphDatabaseBuilder.java:134)
        at com.tinkerpop.blueprints.impls.neo4j.Neo4jHaGraph.<init>(Neo4jHaGraph.java:22)
        at com.tinkerpop.blueprints.impls.neo4j.Neo4jHaGraph.<init>(Neo4jHaGraph.java:30)
        ... 7 more

Stephen Mallette

unread,
Nov 27, 2013, 5:34:58 AM11/27/13
to gremli...@googlegroups.com
Looks like the apache ConfigurationConverter is getting fancy with how it is treating the conversion of your comma separated lists.  

gremlin> c = new BaseConfiguration()
==>org.apache.commons.configuration.BaseConfiguration@171183d8
gremlin> c.setProperty("test","1,2,3,4")
==>null
gremlin> import org.apache.commons.configuration.ConfigurationConverter
==>import com.tinkerpop.gremlin.*
==>import com.tinkerpop.gremlin.java.*
==>import com.tinkerpop.gremlin.pipes.filter.*
==>import com.tinkerpop.gremlin.pipes.sideeffect.*
...
==>import org.apache.commons.configuration.ConfigurationConverter
gremlin> m = ConfigurationConverter.getMap(c)                          
==>org.apache.commons.configuration.ConfigurationMap$ConfigurationSet$Entry@48cb68d8
gremlin> m.values()
==>[1, 2, 3, 4]
gremlin> m.collect{k,v->v.class}
==>class java.util.ArrayList

Since Neo4jHaGraph just wants flat strings we need to make this conversion some other way.


The above is deployed to sonatype snapshot repo for 2.5.0-SNAPSHOT.  Until 2.5.0 is released, the workaround would be to to instantiate Neo4jHaGraph directly with a constructed Map and take GraphFactory out of the picture.  Sorry for the inconvenience.  Didn't test well enough around GraphFactory in relation to Neo4jHA.

Stephen
Reply all
Reply to author
Forward
0 new messages