thinkaurelius / neo4j-gremlin-plugin

Gremlin for Neo4jServer 2.x
http://thinkaurelius.com
Apache License 2.0
30 stars 14 forks source link

does/will the plugin support neo4j 2.2.*? #8

Closed lebedov closed 9 years ago

lebedov commented 9 years ago

It doesn't seem that the plugin works with neo4j 2.2.3; when I tried building and installing the source in the neo4j-gremlin-plugin-2.1.6 release on Ubuntu 14.04.2 and configuring neo4j as instructed, neo4j successfully found the plugin, but failed to start. I observed the following error in the console log:

com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
dkuppitz commented 9 years ago

I didn't watch the changes that were made in Neo4j, but looks like something has been significantly changed again. I bumped the version to 2.2.3, compiled it without problems and deployed it (server started without errors). However, trying to send requests to the plugin leads to some NoClassDefFoundErrors.

03:24:49.034 [qtp323830062-32] WARN  o.e.jetty.servlet.ServletHandler - 
javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/transaction/SystemException
        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420) ~[jersey-servlet-1.19.jar:1.19]
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558) ~[jersey-servlet-1.19.jar:1.19]
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733) ~[jersey-servlet-1.19.jar:1.19]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[javax.servlet-api-3.1.0.jar:3.1.0]
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:800) ~[jetty-servlet-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587) [jetty-servlet-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221) [jetty-server-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125) [jetty-server-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [jetty-servlet-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059) [jetty-server-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) [jetty-server-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.server.Server.handle(Server.java:497) [jetty-server-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) [jetty-server-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248) [jetty-server-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [jetty-io-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:620) [jetty-util-9.2.4.v20141103.jar:9.2.4.v20141103]
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:540) [jetty-util-9.2.4.v20141103.jar:9.2.4.v20141103]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: java.lang.NoClassDefFoundError: javax/transaction/SystemException
        at com.thinkaurelius.neo4j.plugins.GremlinPlugin.getOrCreateGraph(GremlinPlugin.java:74) ~[neo4j-gremlin-plugin-tp2-2.2.3.jar:na]
        at com.thinkaurelius.neo4j.plugins.GremlinPlugin.<init>(GremlinPlugin.java:67) ~[neo4j-gremlin-plugin-tp2-2.2.3.jar:na]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_45]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_45]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_45]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_45]
        at com.sun.jersey.server.spi.component.ResourceComponentConstructor._construct(ResourceComponentConstructor.java:253) ~[jersey-server-1.19.jar:1.19]
        at com.sun.jersey.server.spi.component.ResourceComponentConstructor.construct(ResourceComponentConstructor.java:233) ~[jersey-server-1.19.jar:1.19]
        at com.sun.jersey.server.impl.resource.PerRequestFactory$PerRequest._getInstance(PerRequestFactory.java:182) ~[jersey-server-1.19.jar:1.19]
        at com.sun.jersey.server.impl.resource.PerRequestFactory$AbstractPerRequest.getInstance(PerRequestFactory.java:144) ~[jersey-server-1.19.jar:1.19]
        at com.sun.jersey.server.impl.application.WebApplicationContext.getResource(WebApplicationContext.java:239) ~[jersey-server-1.19.jar:1.19]
        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83) ~[jersey-server-1.19.jar:1.19]
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) ~[jersey-server-1.19.jar:1.19]
        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) ~[jersey-server-1.19.jar:1.19]
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542) ~[jersey-server-1.19.jar:1.19]
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473) ~[jersey-server-1.19.jar:1.19]
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419) ~[jersey-server-1.19.jar:1.19]
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409) ~[jersey-server-1.19.jar:1.19]
        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409) ~[jersey-servlet-1.19.jar:1.19]
        ... 20 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.transaction.SystemException
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_45]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_45]
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_45]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_45]
        ... 39 common frames omitted
ibigpapa commented 9 years ago

i'm also attempting to make this work in 2.2 so far without luck

malteskoruppa commented 9 years ago

Same problem here. I get the same errors as Daniel...

This is unfortunate for me. I need Gremlin, but I also need the neo4j-import tool. The Gremlin plugin currently only works with Neo4J < 2.2, but the neo4j-import tool is only available in Neo4J >= 2.2. I hope that the Gremlin plugin will support Neo4J 2.2.x in the future. :)

dkuppitz commented 9 years ago

but I also need the neo4j-import tool

Isn't that just a simple CSV loader? If so, then I'm pretty sure that you can do the same thing using a few lines (maybe 5) of Groovy.

malteskoruppa commented 9 years ago

Yes, that's it, a highly scalable CSV importer. See:

You're right of course, it's possible to write a program that does pretty much the same thing using Neo4J's BatchInserter API. In fact, Michael Hunger wrote such a tool already quite a long time ago: jexp/batch-import.

batch-import is written in Java, but Michael also recently published a blog post on how to do the same thing with Groovy. It's a bit more than 5 lines, but not very long. ;)

Summing up, yes it's possible, and I'm currently using batch-import with Neo4J 2.1 since I cannot (yet) use Neo4J 2.2 because of the lack of support for Gremlin. It's just that I'd feel more comfortable using an officially supported tool that's part of Neo4J instead of reinventing the wheel...

nachivpn commented 9 years ago

It looks like Caused by: java.lang.ClassNotFoundException: javax.transaction.SystemException is being caused by the change in Neo4j's transaction management which removed JTA

the previously exposed XA and JTA functionalities have been removed.

in Neo4J 2.2.0 (Release notes). Doesn't this mean the blueprints implementation of neo4j 2 itself will have to be updated?

spmallette commented 9 years ago

Note that neo4 is bumped in Blueprints to 2.2.1:

https://github.com/tinkerpop/blueprints/blob/fc2a3531f4290dea16fb4087e59cdfa75b7d80ab/blueprints-neo4j2-graph/pom.xml#L15

but that's SNAPSHOT. I think that there was a fair bit of change to get that working actually - the update came from an external pull request which was nice so I'm not completely sure what had to happen there to get stuff working.

nachivpn commented 9 years ago

@spmallette - yup, the latest SNAPSHOT gets the plugin running! Thanks!

dseguy commented 9 years ago

Hi nachivpn : first, thanks for taking time to take a look at this. I'm trying to move to Neo4j 2.2 (and more) but I'm stuck with this Gremlin plugin.

mvn clean package with the current version of the plug-in gives me this :

[WARNING] The POM for com.tinkerpop.blueprints:blueprints-neo4j2-graph:jar:2.7.0-SNAPSHOT is missing, no dependency information available [WARNING] The POM for com.tinkerpop:pipes:jar:2.7.0-SNAPSHOT is missing, no dependency information available [WARNING] The POM for com.tinkerpop.gremlin:gremlin-java:jar:2.7.0-SNAPSHOT is missing, no dependency information available [WARNING] The POM for com.tinkerpop.gremlin:gremlin-groovy:jar:2.7.0-SNAPSHOT is missing, no dependency information available [WARNING] The POM for com.tinkerpop.rexster:rexster-protocol:jar:2.7.0-SNAPSHOT is missing, no dependency information available

Obviously, I'm missing something.

I got the repository for blueprints, and did 'mvn clean package' on the neo4j2 plugin with success. I expect to do the same for the other repositories. I noticed I still have 2.5.0 and 2.6.0 in my .m2/repository/com/tinkerpop/blueprints/blueprints-neo4j2-graph/ so I'm probably missing some installation step somewhere.

Any hint for this? I'll try to clean some cache and rebuild.

malteskoruppa commented 9 years ago

The 2.7.0-SNAPSHOT JARs that you need do not appear to be in the Maven Central repo. I guess you will have to git clone each of these projects (i.e., Blueprints, Pipes, Gremlin, and Rexster; see https://github.com/tinkerpop/blueprints/wiki), mvn clean package them, and finally mvn install:install-file -Dfile= the JARs you were missing (and just built) into your local repo.

nachivpn commented 9 years ago

Update: @einheitlix beat me to it!

Hello @dseguy,

I faced the same problem too. I had a little trouble getting around to fetching the snapshot versions as mentioned here (I am not too experienced with maven).

So, here's what I did:

spmallette commented 9 years ago

TinkerPop 2.x snapshots are held in SonaType Snapshots repo:

https://oss.sonatype.org/content/repositories/snapshots/com/tinkerpop/blueprints/blueprints-core/2.7.0-SNAPSHOT/

You would need to add an entry like this to your pom.xml:

    <repositories>
       <repository>
         <id>snapshots-repo</id>
         <url>https://oss.sonatype.org/content/repositories/snapshots</url>
         <releases><enabled>false</enabled></releases>
         <snapshots><enabled>true</enabled></snapshots>
       </repository>
     </repositories>
dseguy commented 9 years ago

@spmalette, @einheitlix @nachivpn : Well, kudos for everyone. I've been trying this to run for a long time and thanks to you, it now works fine. Thanks so much :)

I used Stephane's entry for pom.xml, and it went well. I have it working find now.

I'll keep the idea of compiling the 4 repositories then installing the gremlin plug-in. TIL quite a lot.