orientechnologies / orientdb-gremlin

TinkerPop3 Graph Structure Implementation for OrientDB
Apache License 2.0
92 stars 32 forks source link

OrientDB Gremlin server not working in python #146

Closed Akshay-15mca1098 closed 6 years ago

Akshay-15mca1098 commented 6 years ago

I know this is not a good place to post this question but I need to find the answer.

I am using the orientdb and gremlin server in python, Gremlin server started successfully, but when I am trying to add a vertex to the orientdb through gremlin code it's giving me an error.

query = """graph.addVertex(label, "Test", "title", "abc", "title", "abc")"""

following is the Traceback

Traceback (most recent call last):
  File "/home/shubham/Documents/bitbucket/ecodrone/ecodrone/test.py", line 7, in <module>
    print(execute_query("""graph.addVertex(label, "Test", "title", "abc", "title", "abc")"""))
  File "/home/shubham/Documents/bitbucket/ecodrone/ecodrone/base_gremlin.py", line 47, in execute_query
    results = future_results.result()
  File "/usr/lib/python3.5/concurrent/futures/_base.py", line 405, in result
    return self.__get_result()
  File "/usr/lib/python3.5/concurrent/futures/_base.py", line 357, in __get_result
    raise self._exception
  File "/home/shubham/.local/lib/python3.5/site-packages/gremlin_python/driver/resultset.py", line 81, in cb
    f.result()
  File "/usr/lib/python3.5/concurrent/futures/_base.py", line 398, in result
    return self.__get_result()
  File "/usr/lib/python3.5/concurrent/futures/_base.py", line 357, in __get_result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/shubham/.local/lib/python3.5/site-packages/gremlin_python/driver/connection.py", line 77, in _receive
    self._protocol.data_received(data, self._results)
  File "/home/shubham/.local/lib/python3.5/site-packages/gremlin_python/driver/protocol.py", line 106, in data_received
    "{0}: {1}".format(status_code, data["status"]["message"]))
gremlin_python.driver.protocol.GremlinServerError: 599: Error during serialization: Direct self-reference leading to cycle (through reference chain: com.orientechnologies.orient.core.id.ORecordId["identity"])
wolf4ood commented 6 years ago

Hi @Akshay-15mca1098

which version of OrientDB?

Akshay-15mca1098 commented 6 years ago

OrientDB 3.2.3

wolf4ood commented 6 years ago

Hi @Akshay-15mca1098

That i think it's the old versioning of the OrientDB Gremlin Driver.

From OrientDB 3.0 the driver has the same version of ODB.

You could download the OrientDB version with Gremlin Server embedded here.

https://orientdb.com/download-2/

Or install the Gremlin Driver version 3.0.2

http://central.maven.org/maven2/com/orientechnologies/orientdb-gremlin/3.0.2/

Let me know if it helps

Thanks

Akshay-15mca1098 commented 6 years ago

I don't know I am on the right path but I followed this post. According to that, I downloaded some jar files through this command bin/gremlin-server.sh -i com.michaelpollmeier orientdb-gremlin 3.2.3.0 but now, when I tried to install 3.0.2 version it gives me an error.

wolf4ood commented 6 years ago

Hi @Akshay-15mca1098

com.michaelpollmeier is deprecated, now it is moved under

com.orientechnologies

following OrientDB versioning

With OrientDB 3.0 we started the official support of Apache Tinkerpop 3.x.

Can you try directly the orientdb-tp3 version that you can download here http://orientdb.com/download-2

Otherwise check this configuration for a OrientDB database configuration inside the Gremlin Server

https://github.com/orientechnologies/orientdb-gremlin/tree/develop/distribution/config

Akshay-15mca1098 commented 6 years ago

is there any documentation to configure all the requirements

Akshay-15mca1098 commented 6 years ago

Hi @maggiolo00 I tried to start the server but some GraphFactory error I get. is there anything i have to download?. also I attached a screenshot for more clarity. ./gremlin-server.sh conf/gremlin-server-orientdb.yaml command for start server image

wolf4ood commented 6 years ago

Hi @Akshay-15mca1098

can you share your configuration?

wolf4ood commented 6 years ago

@Akshay-15mca1098

about docs. I'm updating it now

Akshay-15mca1098 commented 6 years ago

gremlin : apache-tinkerpop-gremlin-server-3.3.1 OrientDB: orientdb-tp3-3.0.2 gremlinpython : 3.3.0 For download jar files use this bin/gremlin-server.sh -i com.orientechnologies orientdb-gremlin 3.0.2

wolf4ood commented 6 years ago

@Akshay-15mca1098

can you share gremlin-server-orientdb.yaml and orientdb-empty.properties?

Thanks

Akshay-15mca1098 commented 6 years ago

gremlin-server-orientdb.yaml file

host: localhost
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
  graph : conf/orientdb-empty.properties
}
scriptEngines: {
  gremlin-groovy: {
    plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
               org.apache.tinkerpop.gremlin.orientdb.jsr223.OrientDBGremlinPlugin: {},
               org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
               org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [../config/demodb.groovy]}}}}
serializers:
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.orientdb.io.OrientIoRegistry] }}             # application/vnd.gremlin-v3.0+gryo
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true }}                                                                       # application/vnd.gremlin-v3.0+gryo-stringd
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.orientdb.io.OrientIoRegistry] }}         # application/json
processors:
  - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
  - { className: org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor, config: { cacheExpirationTime: 600000, cacheMaxSize: 1000 }}
metrics: {
  consoleReporter: {enabled: true, interval: 180000},
  csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
  jmxReporter: {enabled: true},
  slf4jReporter: {enabled: true, interval: 180000}}
strictTransactionManagement: false
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
authentication: {
  authenticator: com.orientechnologies.tinkerpop.server.auth.OGremlinServerAuthenticator
    }
ssl: {
  enabled: false}

orientdb-empty.properties file

gremlin.graph=org.apache.tinkerpop.gremlin.orientdb.OrientEmbeddedFactory

also, I tried with also

gremlin.graph=org.apache.tinkerpop.gremlin.orientdb.OrientGraph

wolf4ood commented 6 years ago

@Akshay-15mca1098 Ok let me try

wolf4ood commented 6 years ago

@Akshay-15mca1098

does the install

bin/gremlin-server.sh -i com.orientechnologies orientdb-gremlin 3.0.2

succeed?

Akshay-15mca1098 commented 6 years ago

yes It takes a bit long to download

wolf4ood commented 6 years ago

i have this error while trying to install the driver in a gremlin server

wolfwood@:apache-tinkerpop-gremlin-server-3.3.1$ bin/gremlin-server.sh -i com.orientechnologies orientdb-gremlin 3.0.2
Redirecting to 'install com.orientechnologies orientdb-gremlin 3.0.2' (-i will be removed in a future release)
Installing dependency com.orientechnologies orientdb-gremlin 3.0.2
Could not install the dependency: Error grabbing Grapes -- [download failed: org.apache.tinkerpop#gremlin-shaded;3.3.0!gremlin-shaded.jar]
java.lang.RuntimeException: Error grabbing Grapes -- [download failed: org.apache.tinkerpop#gremlin-shaded;3.3.0!gremlin-shaded.jar]
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
    at groovy.grape.GrapeIvy.getDependencies(GrapeIvy.groovy:424)
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
    at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:571)
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
    at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:534)
    at groovy.grape.Grape.resolve(Grape.java:202)
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
    at org.apache.tinkerpop.gremlin.groovy.util.DependencyGrabber.copyDependenciesToPath(DependencyGrabber.groovy:110)
    at org.apache.tinkerpop.gremlin.server.util.GremlinServerInstall.main(GremlinServerInstall.java:38)
Akshay-15mca1098 commented 6 years ago

Working in my system

image

Akshay-15mca1098 commented 6 years ago

Is there any other way please let me know. I am not tied up with this installation.

wolf4ood commented 6 years ago

Hi @Akshay-15mca1098

the correct implementation for the Graph is

gremlin.graph=org.apache.tinkerpop.gremlin.orientdb.OrientFactory

Then i think you need to change

{files: [../config/demodb.groovy]}

That binds g traversal to globals

You can use empty-sample.groovy in the scripts directory

Akshay-15mca1098 commented 6 years ago

okay let me try this

Akshay-15mca1098 commented 6 years ago

what I understood you are telling to change the file's path to this [../scripts/empty-sample.groovy]

wolf4ood commented 6 years ago

by seeing other configuration in the gremlin server should be [scripts/empty-sample.groovy]

Akshay-15mca1098 commented 6 years ago

I tried with the changes error was not getting but also server is not started image

wolf4ood commented 6 years ago

I had no problem on my system. screen shot 2018-06-19 at 14 27 09

Can you run kill -3 <pid> of the Gremlin Server and paste here the thread dump?

Thanks

Akshay-15mca1098 commented 6 years ago

no such process is shown kill -3 8182 kill 8182 tries both

wolf4ood commented 6 years ago

After kill -3 8182

you should check the logs in GremlinServer terminal or logs

Akshay-15mca1098 commented 6 years ago
admin-12@admin:~$ kill -3 8182
bash: kill: (8182) - No such process

no process is there

Akshay-15mca1098 commented 6 years ago

server struck after this process image

Akshay-15mca1098 commented 6 years ago

did you download the jar files from this command bin/gremlin-server.sh -i com.orientechnologies orientdb-gremlin 3.0.2

wolf4ood commented 6 years ago

@Akshay-15mca1098

admin-12@admin:~$ kill -3 8182
bash: kill: (8182) - No such process

you can run jps to quickly find the pid of the gremlin server

wolf4ood commented 6 years ago

@Akshay-15mca1098

yes i fixed it and i was able to install the plugin with

bin/gremlin-server.sh -i com.orientechnologies orientdb-gremlin 3.0.2
Akshay-15mca1098 commented 6 years ago

I don't know why its the server is not started on my system.

I have posted a question on StackOverflow with the current configuration. one of the gremlin people has responded and he said I messed up some version. I shared you the link can you check.

wolf4ood commented 6 years ago

@Akshay-15mca1098

the error posted on StackOverflow has been resolved using OrientFactory.

Now let's try to find the reason for the stuck.

wolf4ood commented 6 years ago

Can you share the entire startup log?

wolf4ood commented 6 years ago

It could be related to mix of 3.3.1 (gremlin server) and 3.3.0 (orientdb-gremlin)

If you can give it a shot with Gremlin Server 3.30, it would solve this point

Akshay-15mca1098 commented 6 years ago

valid point, I think I should download Gremlin Server 3.3.0

Akshay-15mca1098 commented 6 years ago

Hi @maggiolo00 did you put database, username, and password in the orientdb-empty.properties file. if not then how will the gremlin knows what DB it has to choose

Akshay-15mca1098 commented 6 years ago

now I am getting some different error. when I am not putting the DB name, username and password getting the below error

[ERROR] GremlinServer - Gremlin Server Error
java.lang.IllegalStateException: Could not create/configure Authenticator null
    at org.apache.tinkerpop.gremlin.server.AbstractChannelizer.createAuthenticator(AbstractChannelizer.java:185)
    at org.apache.tinkerpop.gremlin.server.AbstractChannelizer.init(AbstractChannelizer.java:134)
    at org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer.init(WebSocketChannelizer.java:60)
    at org.apache.tinkerpop.gremlin.server.GremlinServer.start(GremlinServer.java:151)
    at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:326)
Caused by: java.lang.ClassNotFoundException: com.orientechnologies.tinkerpop.server.auth.OGremlinServerAuthenticator
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.apache.tinkerpop.gremlin.server.AbstractChannelizer.createAuthenticator(AbstractChannelizer.java:179)
    ... 4 more
[ERROR] GremlinServer - Gremlin Server was unable to start and will now begin shutdown: Could not create/configure Authenticator null
Akshay-15mca1098 commented 6 years ago

For download dependency, I replaced ./gremlin-server.sh -i com.orientechnologies orientdb-gremlin 3.0.2 to ./gremlin-server.sh -i com.orientechnologies orientdb-gremlin-server 3.0.2 and tried to start the server then I get the below error.

SLF4J: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError. 
SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
Exception in thread "main" java.lang.ExceptionInInitializerError
    at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:72)
    at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:45)
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
    at org.apache.tinkerpop.gremlin.server.GremlinServer.<clinit>(GremlinServer.java:67)
Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
    at org.slf4j.impl.Log4jLoggerFactory.<clinit>(Log4jLoggerFactory.java:54)
wolf4ood commented 6 years ago

@Akshay-15mca1098

this is not correct

./gremlin-server.sh -i com.orientechnologies orientdb-gremlin-server 3.0.2

This is the right one

./gremlin-server.sh -i com.orientechnologies orientdb-gremlin 3.0.2

Can you please share the orientdb-empty.properties that you are using when the server is not starting?

And remove the custom authenticator

From the YAML

authentication: {
  authenticator: com.orientechnologies.tinkerpop.server.auth.OGremlinServerAuthenticator
    }
Akshay-15mca1098 commented 6 years ago

./gremlin-server.sh -i com.orientechnologies orientdb-gremlin-server 3.0.2 but this also download the jar fiiles orientdb-empty.properties

gremlin.graph=org.apache.tinkerpop.gremlin.orientdb.OrientFactory
orient-db-name=db
orient-user=root        
orient-pass=root
Akshay-15mca1098 commented 6 years ago

Yaa it's working fine, data also insert successfully Thanks a lot man

wolf4ood commented 6 years ago

Cool!