Search code examples
pythonneo4jpy2neojoern

Access neo4j via python-joern


When using Joern, I accessed the Neo4j database via python-joern with the following code.

from joern.all import JoernSteps
j = JoernSteps()
j.setGraphDbURL('http://localhost:7474/db/data/')
j.connectToDatabase()
res =  j.runGremlinQuery('getFunctionsByName("main")')
for r in res: print r

Error like this

Traceback (most recent call last):
  File "test.py", line 11, in <module>
    res =  j.runGremlinQuery('getFunctionsByName("main")')
  File "/home/binbin/Downloads/python-joern-0.3.1/joern/all.py", line 44, in runGremlinQuery
    return self.gremlin.execute(finalQuery)
  File "/usr/local/lib/python2.7/dist-packages/py2neo-2.0-py2.7-linux-x86_64.egg/py2neo/ext/gremlin/__init__.py", line 36, in execute
    response = self.resources["execute_script"].post({"script": script})
  File "/usr/local/lib/python2.7/dist-packages/py2neo-2.0-py2.7-linux-x86_64.egg/py2neo/core.py", line 288, in post
    raise_from(self.error_class(message, **content), error)
  File "/usr/local/lib/python2.7/dist-packages/py2neo-2.0-py2.7-linux-x86_64.egg/py2neo/util.py", line 215, in raise_from
    raise exception
py2neo.error.NoClassDefFoundError: javax/transaction/SystemException

How to fix it?


Solution

  • I had searched a lot for my question. Finally I found the solution here: https://github.com/fabsx00/python-joern/issues/14. Anyone who has got the same problem can see it.