[TinkerPop3] Development environment: Starting gremlin-server within Eclipse from gremlin-server.jar

373 views
Skip to first unread message

Matt Van Wely

unread,
Oct 29, 2014, 11:13:13 AM10/29/14
to gremli...@googlegroups.com
I am attempting to implement a new graph implementation using gremlin-core according to the instructions outlined here.  This is going well.  However, as part of the development environment, I also wanted to extend the implementation to make use of the gremlin-console and gremlin-server.  I was able to get the gremlin-console working well by simply adding the gremlin-console maven dependency to my project and copying the configuration files from gremlin-console bin and conf to my local project. 

However, when I tried to do the same for gremlin-server, the server startup fails.  In my Eclipse environment, I have a simple Maven module which depends on gremlin-server and has a local copy of the respective gremlin-server bin, conf, script files.  I try to start the server using conf/gremlin-server.yaml and get the following class com.tinkerpop.gremlin.groovy.jsr223.ScriptEnginePluginAcceptor throws ScriptException while reading from UtilitiesGremlinPluginScript.groovy (included in the gremlin-server JAR) with the following details:  

javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: 
Script3.groovy: 1: expecting '/', found '<EOF>' @ line 1, column 4.
   /**
      ^
1 error

This issue is hidden by the subsequent NullPointerException when logging the ScriptException above (the returned IO is null):
<snip>
[INFO] GremlinServer - Initialized Gremlin thread pool.  Threads in pool named with pattern gremlin-*
[INFO] ScriptEngines - Loaded nashorn ScriptEngine
[INFO] ScriptEngines - Loaded gremlin-groovy ScriptEngine
[INFO] GremlinExecutor - Getting dependencies for [[org.apache.commons, commons-math3, 3.2]]
[INFO] GremlinServer - Shutting down thread pools
[INFO] GremlinServer - Gremlin Server - shutdown complete
Exception in thread "main" java.lang.NullPointerException
at com.tinkerpop.gremlin.console.plugin.UtilitiesGremlinPlugin.pluginTo(UtilitiesGremlinPlugin.java:48)
at com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.lambda$loadPlugins$0(GremlinGroovyScriptEngine.java:157)
at com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine$$Lambda$33/1334618867.accept(Unknown Source)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.loadPlugins(GremlinGroovyScriptEngine.java:155)
at com.tinkerpop.gremlin.groovy.engine.ScriptEngines.lambda$loadPlugins$23(ScriptEngines.java:153)
at com.tinkerpop.gremlin.groovy.engine.ScriptEngines$$Lambda$32/1995505717.accept(Unknown Source)
at java.lang.Iterable.forEach(Iterable.java:75)
at com.tinkerpop.gremlin.groovy.engine.ScriptEngines.loadPlugins(ScriptEngines.java:151)
at com.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$createScriptEngines$15(GremlinExecutor.java:206)
at com.tinkerpop.gremlin.groovy.engine.GremlinExecutor$$Lambda$19/1213349904.accept(Unknown Source)
at com.tinkerpop.gremlin.groovy.engine.ScriptEngines.<init>(ScriptEngines.java:53)
at com.tinkerpop.gremlin.groovy.engine.GremlinExecutor.createScriptEngines(GremlinExecutor.java:185)
at com.tinkerpop.gremlin.groovy.engine.GremlinExecutor.<init>(GremlinExecutor.java:84)
at com.tinkerpop.gremlin.groovy.engine.GremlinExecutor.<init>(GremlinExecutor.java:50)
at com.tinkerpop.gremlin.groovy.engine.GremlinExecutor$Builder.create(GremlinExecutor.java:399)
at com.tinkerpop.gremlin.server.GremlinServer.initializeGremlinExecutor(GremlinServer.java:126)
at com.tinkerpop.gremlin.server.GremlinServer.run(GremlinServer.java:65)
at com.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:165)
</snip>

I would like to get a running instance of gremlin-server within my own application.  Let me know if you can help me get that running.

Cheers,
Matt-

Stephen Mallette

unread,
Oct 29, 2014, 5:42:15 PM10/29/14
to gremli...@googlegroups.com
I am attempting to implement a new graph implementation using gremlin-core according to the instructions outlined here.  This is going well.  

Great!
 
However, as part of the development environment, I also wanted to extend the implementation to make use of the gremlin-console and gremlin-server.  I was able to get the gremlin-console working well by simply adding the gremlin-console maven dependency to my project and copying the configuration files from gremlin-console bin and conf to my local project. 

Note that you shouldn't have to modify the pom.xml of gremlin-console/server at all to get your "plugin" to be recognized.  Both use ServiceLoader and elements of Grape to dynamically plugin your external classes. Yu can read more about it here:

 
However, when I tried to do the same for gremlin-server, the server startup fails.  In my Eclipse environment, I have a simple Maven module which depends on gremlin-server and has a local copy of the respective gremlin-server bin, conf, script files.  I try to start the server using conf/gremlin-server.yaml and get the following class com.tinkerpop.gremlin.groovy.jsr223.ScriptEnginePluginAcceptor throws ScriptException while reading from UtilitiesGremlinPluginScript.groovy (included in the gremlin-server JAR) with the following details:  

I'm not sure I follow this part.   The UtilitiesGremlinPluginScript.groovy isn't (or shouldn't) be part of gremlin-server's distribution.  It is in the gremlin-console.jar.  Not sure I understand why it's even trying to load that, unless ServiceLoader is just noticing that the gremlin-console is part of your project and thus tries to load it anyway.  If that's what's happening, then you're running into a condition I never assumed would happen - where someone tries to load a "gremlin-console only" plugin to gremlin-server.  As such I never made a clear enough distinction between the two.  

Again, assuming this is the problem, I would look to better segregate your project to avoid gremlin-console/server dependencies and treat your plugins as behaving in a more independent fashion.  I'll think about creating an issue to try to better solve the problem of "distinguishing plugins".  Come to think of it, maybe "distinction" is not really the issue...perhaps the approach is to write plugins more defensively so that they work in either environment.  Not sure - created an issue to consider:




 

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/4da33caf-952e-48de-b06f-2efc5e6bfa06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matt Van Wely

unread,
Oct 29, 2014, 5:54:20 PM10/29/14
to gremli...@googlegroups.com
Thank you Stephen!  Simply removing the gremlin-console maven dependency from my application's pom (which also had the gremlin-server dependency) allowed the server to start cleanly.  My app was a testing application which had both -I will absolutely separate the "concerns" by keeping these dependencies separate going forward.  Thanks again
Reply all
Reply to author
Forward
0 new messages