You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "stephen mallette (JIRA)" <ji...@apache.org> on 2019/05/14 12:46:00 UTC
[jira] [Commented] (TINKERPOP-2218) failed static type checking
when gremlin server use security sandbox
[ https://issues.apache.org/jira/browse/TINKERPOP-2218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16839378#comment-16839378 ]
stephen mallette commented on TINKERPOP-2218:
---------------------------------------------
Please use the gremlin-users mailing list or stackoverflow for questions about usage - we typically only use JIRA for confirmed bugs and enhancements. In answer to your question though, you have type checking enabled, therefore you need to be explicit with your types:
{code}
gremlin> :> g.V().groupCount('m').cap('m').next().size()
Script11.groovy: 1: [Static type checking] - Cannot find matching method java.lang.Object#size(). Please check if the declared type is correct and if the method exists.
@ line 1, column 1.
g.V().groupCount('m').cap('m').next().size()
^
1 error
{code}
should instead be:
{code}
gremlin> :> ((Map) g.V().groupCount('m').cap('m').next()).size()
==>1
{code}
and another example:
{code}
gremlin> :> g.V().count().is(gte(1))
Script15.groovy: 1: [Static type checking] - Cannot call org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal <org.apache.tinkerpop.gremlin.structure.Vertex, java.lang.Long>#is(org.apache.tinkerpop.gremlin.process.traversal.P <java.lang.Long>) with arguments [org.apache.tinkerpop.gremlin.process.traversal.P <java.lang.Integer>]
@ line 1, column 1.
g.V().count().is(gte(1))
^
1 error
Type ':help' or ':h' for help.
Display stack trace? [yN]n
gremlin> :> g.V().count().is(gte(1L))
==>1
{code}
> failed static type checking when gremlin server use security sandbox
> --------------------------------------------------------------------
>
> Key: TINKERPOP-2218
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2218
> Project: TinkerPop
> Issue Type: Bug
> Components: server
> Affects Versions: 3.3.0
> Reporter: xifeng
> Priority: Major
>
> Request like "{color:#8eb021}graph_test = XXXGraph.open('movie').traversal();graph_test.V('46'){color}" return error {color:#d04437} "org.apache.tinkerpop.gremlin.driver.exception.ResponseException: startup failed:\nScript17.groovy: 1: [Static type checking] - Cannot find matching method java.lang.Object#V(java.lang.String). Please check if the declared type is right and if the method exists.\n @ line 1, column 48.\n aph.open('movie').traversal();graph_test.V\n ^\n\n1 error\n"{color}.
> *It seems as if the variable 'graph_test' lost its type(change to Object).*
> my gremlin-server.yaml is as follows:
> _scriptEngines: {_
> _gremlin-groovy: {_
> _plugins: \{ org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},_
> _com.xx.xx.xx.jsr223.xxGraphGremlinPlugin: {},_
> _org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},_
> _org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyCompilerGremlinPlugin: \{enableThreadInterrupt: true, compilation: COMPILE_STATIC, extensions: org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.FileSandboxExtension},_
> org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin:\{classImports: [java.lang.Math], methodImports: [java.lang.Math#*|#*]},
> _org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/generate-xxxgraph.groovy]}}}}_
>
> my sandbox.yaml is the same as tinkerpop document 3.3.0 posted.
>
> In addition,request "{color:#14892c}g.V().repeat(timeLimit(2).both().groupCount('m')).times(16).cap('m').order(local).by(values,decr).next().size(){color}" return error {color:#d04437}"org.apache.tinkerpop.gremlin.driver.exception.ResponseException: startup failed:\nScript22.groovy: 1: [Static type checking] - Cannot find matching method java.lang.Object#size(). Please check if the declared type is right and if the method exists.\n @ line 1, column 1.\n g.V().repeat(timeLimit(2).both().groupCount('m')).times(16).cap('m').order(local).by(values,decr).next().size()\n ^\n\n1 error\n","{color}
> request like "{color:#14892c}results = ['blah',3]\ng.V().out('rate').fill(results){color}" return error {color:#d04437}"org.apache.tinkerpop.gremlin.driver.exception.ResponseException: startup failed:\nScript25.groovy: 2: [Static type checking] - Cannot find matching method org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#fill(java.lang.Object). Please check if the declared type is right and if the method exists.\n @ line 2, column 1.\n g.V().out('rate').fill(results)\n ^\n\n1 error\n",{color}
> request like "{color:#14892c}g.V().where(__.out('rate').count().is(gte(30))).values('userid'){color}" return error {color:#d04437}"org.apache.tinkerpop.gremlin.driver.exception.ResponseException: startup failed:\nScript4.groovy: 1: [Static type checking] - Cannot call org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal <org.apache.tinkerpop.gremlin.structure.Vertex, java.lang.Long>#is(org.apache.tinkerpop.gremlin.process.traversal.P <java.lang.Long>) with arguments [org.apache.tinkerpop.gremlin.process.traversal.P <java.lang.Integer>] \n @ line 1, column 13.\n g.V().where(__.out('rate').count().is(gte(30))).values('userid')\n ^\n\nScript4.groovy: 1: [Static type checking] - Cannot find matching method org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#where(java.lang.Object). Please check if the declared type is right and if the method exists.\n @ line 1, column 1.\n g.V().where(__.out('rate').count().is(gte(30))).values('userid')\n ^\n\n2 errors\n".{color}
> Any help will be appreciated!
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)