0

I have been using Neo4J 1.8.x as an embedded database in an application framework that breaks the regular ServiceLoader used by Neo4j. So far, I've worked around this issue by using the OSGi instructions for Neo4j. This has worked great.

However, these OSGi instructions no longer work for 1.9.0, 1.9.1 or 2.0.0-M03. When initializing the embedded database I get this exception:

java.lang.ExceptionInInitializerError
at plugins.fritter.Fritter.setupNeo4j(Fritter.java:240)
at plugins.fritter.Fritter.runPlugin(Fritter.java:106)
at freenet.pluginmanager.PluginHandler.startPlugin(PluginHandler.java:45)
at freenet.pluginmanager.PluginManager.realStartPlugin(PluginManager.java:394)
at freenet.pluginmanager.PluginManager.startPluginFile(PluginManager.java:367)
at freenet.clients.http.PproxyToadlet$3.run(PproxyToadlet.java:157)
at freenet.support.PooledExecutor$MyThread.innerRun(PooledExecutor.java:247)
at freenet.support.PooledExecutor$MyThread.realRun(PooledExecutor.java:187)
at freenet.support.io.NativeThread.run(NativeThread.java:129)

Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at org.neo4j.graphdb.factory.GraphDatabaseSettings.<clinit>(GraphDatabaseSettings.java:79)
... 9 more

I am aware that the OSGi setup instructions have changed from 1.9.0 and higher versions OSGI, but the new initialization methods do not address the issue.

Is neo4j > 1.8.3 still supported in a non-ServiceLoader / OSGi context and, if so, what is the proper way to set it up?

Thomas
  • 101
  • 1
  • 3
  • The service loading code has changed quite a bit in Neo4j 1.9 and above: https://github.com/neo4j/neo4j/blob/1.9.1/community/kernel/src/main/java/org/neo4j/helpers/Service.java You aren't able to load a cache: https://github.com/neo4j/neo4j/blob/1.9.1/community/kernel/src/main/java/org/neo4j/graphdb/factory/GraphDatabaseSettings.java#L394 Though I don't know why. – Sheena Artrip Jul 09 '13 at 13:43
  • Right it did change. It seems that the relevant code you are linking to still depends on a functional ServiceLoader and hence breaks in my plugin environment? – Thomas Jul 09 '13 at 17:54
  • I'm guessing, yes. Have you tried the META-INF/services directory? It looks like you can bootstrap neo4j a standard way as long as you have your services directory in order, since neo4j will use ServiceLoader and ServiceLoader will look into META-INF/services/ folder. EDIT: Oh! Not sure if you are actually using OSGI or if your framework just breaks ServiceLoader. In the latter case, best bet may be to patch neo4j yourself (it's why I gave you the source code link =) ). http://blog.osgi.org/2013/02/javautilserviceloader-in-osgi.html – Sheena Artrip Jul 09 '13 at 19:02

0 Answers0