Rexster server side scripting

31 views
Skip to first unread message

Sudha Subramanian

unread,
Apr 11, 2015, 5:30:15 PM4/11/15
to aureliu...@googlegroups.com
Hi,

Following this post ( https://groups.google.com/forum/#!topic/aureliusgraphs/HwVggTCLg0Y ), I'm trying to do the same thing. I'm using rexster-protocol 2.6.0.

I have modified rexster-cassandra-es.xml to include the script <init-scripts>scripts/get_or_create.groovy</init-scripts>.

Inside the file, I have the following code:

def getOrCreateNode(g, key, val) {
     def p = g.V(key, val)
     return p.hasNext() ? p.next() : g.addVertex([key:val])
}

In my java client, I call the method like this:

Map<String, Object> arg = new HashMap<String, Object>();
        arg.put("key", "userName");
        arg.put("val", "s333333");
        List<Object> userV= client.execute("getOrCreateNode(g, key, val);", arg);
       

I get the following exception:

 Exception in thread "main" com.tinkerpop.rexster.client.RexProException: An error occurred while processing the script for language [groovy]. All transactions across all graphs in the session have been concluded with failure: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.getOrCreateNode() is applicable for argument types: (com.thinkaurelius.titan.graphdb.database.StandardTitanGraph, java.lang.String, java.lang.String) values: [titangraph[cassandra:[127.0.0.1]], userName, ...]
    at com.tinkerpop.rexster.client.RexsterClient.execute(RexsterClient.java:220)
  

I restarted rexster after adding the script file.

Can someone please let me know what I'm doing wrong?

Thanks.



Stephen Mallette

unread,
Apr 13, 2015, 7:53:45 AM4/13/15
to aureliu...@googlegroups.com
Just a guess, but I'm thinking that Rexster isn't finding your script.  You should see some output in the console/logs when you start Rexster that says that it explicitly executed an init script (or failed in doing so).  Most of the time the issue is just a pathing problem.

--
You received this message because you are subscribed to the Google Groups "Aurelius" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aureliusgraph...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aureliusgraphs/97844487-393e-4af1-8372-6859638bdcca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sudha Subramanian

unread,
Apr 19, 2015, 5:30:08 PM4/19/15
to aureliu...@googlegroups.com
Thank you. Location of the script was the problem. Thanks again.
Reply all
Reply to author
Forward
0 new messages