inolen/gremlin-node

Alpha gotchas

Closed this issue · 15 comments

Hi,

I was thinking in use this project but, the alpha word make me feel scared, what i need avoid to use this with safety?

cheers

Hi Gabriel,

I placed the alpha there just as a warning, as I have not tested this
extensively as yet. However, I do know of one other person using
gremlin-node. He has been using it for a few weeks and he doesn't seem to
have any issues at this stage. I would still precede with caution, but rest
assured that I do monitor this repository and I am available to resolve any
issue that may arise.

Regards
Frank

On Fri, Apr 26, 2013 at 12:10 AM, Gabriel Mancini de Campos <
notifications@github.com> wrote:

Hi,

I was thinking in use this project but, the alpha word make me feel
scared, what i need avoid to use this with safety?

cheers


Reply to this email directly or view it on GitHubhttps://github.com//issues/8
.

Hi Frank

Thanks for your super quick feedback :-D
Awsome project!

i am trying to create an module to use an titan berkeleyje like this:

module.exports = function (app) {
  var g = require('gremlin');
  var BaseConfiguration = g.java.import('org.apache.commons.configuration.BaseConfiguration');

  conf = new BaseConfiguration();
  conf.setPropertySync("storage.backend","berkeleyje");
  conf.setPropertySync("storage.hostname","/tmp/titan-local");
//  conf.setPropertySync("storage.keyspace","titan");

  var TitanFactory = g.java.import('com.thinkaurelius.titan.core.TitanFactory');
  gt = TitanFactory.openSync(conf);
  g.SetGraph(gt);
  return tg;
};

and show me that stack error:

/home/gabriel/Documents/github/bilgow/api/node_modules/gremlin/node_modules/java/lib/nodeJavaBridge.js:16
  var clazz = java.findClassSync(name); // TODO: change to Class.forName when 
                   ^
Error: Could not create class org.apache.commons.configuration.BaseConfiguration
java.lang.NoClassDefFoundError: org/apache/commons/configuration/BaseConfiguration
Caused by: java.lang.ClassNotFoundException: org.apache.commons.configuration.BaseConfiguration
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

    at Java.java.import (/home/gabriel/Documents/github/bilgow/api/node_modules/gremlin/node_modules/java/lib/nodeJavaBridge.js:16:20)
    at module.exports (/home/gabriel/Documents/github/bilgow/api/config/gremlin.js:3:40)
    at Object.<anonymous> (/home/gabriel/Documents/github/bilgow/api/server.js:23:51)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/home/gabriel/Documents/github/bilgow/api/test/api/v1/functional/user.test.js:5:9)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Mocha.loadFiles (/home/gabriel/Documents/github/bilgow/api/node_modules/mocha/lib/mocha.js:152:27)
    at Array.forEach (native)
    at Mocha.loadFiles (/home/gabriel/Documents/github/bilgow/api/node_modules/mocha/lib/mocha.js:149:14)
    at Mocha.run (/home/gabriel/Documents/github/bilgow/api/node_modules/mocha/lib/mocha.js:305:31)
    at Object.<anonymous> (/home/gabriel/Documents/github/bilgow/api/node_modules/mocha/bin/_mocha:327:7)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

do you know what can be do?

sorry about my pour english

No worries, your english is good. Have you copied all the Titan jar files to the lib directory?

No,

But I guess the problem is this :

java.lang.NoClassDefFoundError: org/apache/commons/configuration/BaseConfiguration
Caused by: java.lang.ClassNotFoundException: org.apache.commons.configuration.BaseConfiguration

the classpath not Found the apache commons configuration, what you think?

In order to set up the environment, you will need to locate and include all the jar files that are required to run your chosen database (Titan in this case). What the error is saying is that java cannot find the BaseConfiguration class. This class lives in org.apache.commons.configuration.BaseConfiguration. So you will need to find the jar file that has that class.

I haven't run Titan as this example was provided by another user. But I suspect that if you download the database files from https://github.com/thinkaurelius/titan/wiki/Downloads you should fine the required jar under the lib directory. Copy all of those files to the lib directory in gremlin-node project. Just replace any of the files if there is a conflict and ensure that you have the latest versions of the jar files. gremlin-node should find the jars and it should work.

If not you may need to include the BaseConfiguration class manually. You can find it at http://www.jarfinder.com/index.php/java/info/org.apache.commons.configuration.BaseConfiguration

See how you go.

Oh, by the way, I'm glad you like the project.

Frank

Hi Frank,

what you think about use maven to manager with this dependencies?
its sounds more manageable for you, its make sens?

Well, i do what :-) this is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>bla.blabla</groupId>
  <artifactId>dependencies</artifactId>
  <packaging>pom</packaging>
  <version>1.0</version>
  <name>blabla</name>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
         <groupId>com.thinkaurelius.titan</groupId>
         <artifactId>titan-core</artifactId>
         <version>0.3.0</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>com.thinkaurelius.titan</groupId>
      <artifactId>titan-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>node_modules/gremlin/lib/</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>

afer this pom.xml i just call this or better yeat, put this on my package.json, and npm install :-D

  "scripts": {
    "postinstall":"mvn dependency:copy-dependencies package"
  },

but, now i have another error...

/home/gabriel/Documents/github/bilgow/api/node_modules/gremlin/node_modules/java/lib/nodeJavaBridge.js:22
    return java.newInstanceSync.apply(java, args);
                                ^
Error: Error creating class
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
Caused by: java.lang.VerifyError: class org.codehaus.groovy.runtime.callsite.GroovySunClassLoader$2 overrides final method visit.(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at org.codehaus.groovy.runtime.callsite.CallSiteGenerator.isCompilable(CallSiteGenerator.java:245)
    at org.codehaus.groovy.reflection.CachedMethod.createStaticMetaMethodSite(CachedMethod.java:284)
    at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.createStaticMetaMethodSite(StaticMetaMethodSite.java:111)
    at groovy.lang.MetaClassImpl.createStaticSite(MetaClassImpl.java:3034)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:61)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:146)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
    at com.tinkerpop.gremlin.groovy.Gremlin.load(Gremlin.groovy:25)
    at com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.<init>(GremlinGroovyScriptEngine.java:62)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
    at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:54)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
    at com.tinkerpop.gremlin.groovy.Gremlin.<clinit>(Gremlin.groovy:21)
    at com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.<init>(GremlinGroovyScriptEngine.java:62)
    ... 4 more

    at new java.import.result (/home/gabriel/Documents/github/bilgow/api/node_modules/gremlin/node_modules/java/lib/nodeJavaBridge.js:22:33)
    at /home/gabriel/Documents/github/bilgow/api/node_modules/gremlin/gremlin-node.js:89:18
    at /home/gabriel/Documents/github/bilgow/api/node_modules/gremlin/gremlin-node.js:3:5
    at Object.<anonymous> (/home/gabriel/Documents/github/bilgow/api/node_modules/gremlin/gremlin-node.js:5:3)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at module.exports (/home/gabriel/Documents/github/bilgow/api/config/gremlin.js:2:11)
    at Object.<anonymous> (/home/gabriel/Documents/github/bilgow/api/server.js:23:51)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/home/gabriel/Documents/github/bilgow/api/test/api/v1/functional/user.test.js:5:9)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Mocha.loadFiles (/home/gabriel/Documents/github/bilgow/api/node_modules/mocha/lib/mocha.js:152:27)
    at Array.forEach (native)
    at Mocha.loadFiles (/home/gabriel/Documents/github/bilgow/api/node_modules/mocha/lib/mocha.js:149:14)
    at Mocha.run (/home/gabriel/Documents/github/bilgow/api/node_modules/mocha/lib/mocha.js:305:31)
    at Object.<anonymous> (/home/gabriel/Documents/github/bilgow/api/node_modules/mocha/bin/_mocha:327:7)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

I thinking i m in the middle of Jar hell pls help me!

Hi Gabriel.

I'm not a Java guy and have only had very limited exposure to maven. I'm
not too sure how it would help, could you explain how for me.

Thanks
Frank

On Fri, Apr 26, 2013 at 1:40 AM, Gabriel Mancini de Campos <
notifications@github.com> wrote:

Frank, what u think about use maven to manager with this dependencies? its
sound more mantaneable for u?
Em 25/04/2013 12:21, "entrendipity" notifications@github.com escreveu:

In order to set up the environment, you will need to locate and include
all the jar files that are required to run your chosen database (Titan
in
this case). What the error is saying is that java cannot find the
BaseConfiguration class. This class lives in
org.apache.commons.configuration.BaseConfiguration. So you will need to
find the jar file that has that class.

I haven't run Titan as this example was provided by another user. But I
suspect that if you download the database files from
https://github.com/thinkaurelius/titan/wiki/Downloads you should fine
the
required jar under the lib directory. Copy all of those files to the lib
directory in gremlin-node project. Just replace any of the files if
there
is a conflict and ensure that you have the latest versions of the jar
files. gremlin-node should find the jars and it should work.

If not you may need to include the BaseConfiguration class manually. You
can find it at

http://www.jarfinder.com/index.php/java/info/org.apache.commons.configuration.BaseConfiguration

See how you go.

Oh, by the way, I'm glad you like the project.

Frank


Reply to this email directly or view it on GitHub<
https://github.com/entrendipity/gremlin-node/issues/8#issuecomment-17013525>

.


Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-17014781
.

Hi Frank,

Maven is a dependency manager of java projects, like npm to install you just download http://maven.apache.org/download.cgi 3.0.5 version

go to:

/opt
tar -zxvf apache-maven-3.0.5-bin.tar.gz
ln -s /opt/apache-maven-3.0.5 maven

on your ~/.bashrc add this

export JAVA_HOME=/opt/java
export MAVEN_HOME=/opt/maven
export MONGO_HOME=/opt/mongo
export ES_HOME=/opt/es
export NEO4J_HOME=/opt/neo4j
export ORIENTDB_HOME=/opt/orient
export TITAN_HOME=/opt/titan

export PATH=$JAVA_HOME/bin:$PATH
export PATH=$MAVEN_HOME/bin:$PATH
export PATH=$MONGO_HOME/bin:$PATH
export PATH=$ES_HOME/bin:$PATH
export PATH=$ES_HOME/bin/service:$PATH
export PATH=$NEO4J_HOME/bin:$PATH
export PATH=$ORIENTDB_HOME/bin:$PATH
export PATH=$TITAN_HOME/bin:$PATH
export PATH=./node_modules/.bin:$PATH 

to run just:

source .bashrc
mvn install

after that put that content of xml inside of pom.xml file on root folder and run

mvn package

inside pom u can config the folder where de dependencies will download
and u can search then here: mvnrepository.com

that way u can expose the dependences of jar and avoid jar hell ;-)

cheers

Thanks Gabriel,

I'll take a look. Might not be able to do it soon as I have a lot going on,
but I'll definitely consider it.

Thanks
Frank

On Sat, Apr 27, 2013 at 12:06 AM, Gabriel Mancini de Campos <
notifications@github.com> wrote:

Hi Frank,

Maven is a dependency manager of java projects, like npm to install you
just download http://maven.apache.org/download.cgi 3.5 version

go to:

/opt
tar -zxvf apache-maven-3.0.5-bin.tar.gz
ln -s /opt/apache-maven-3.0.5 maven

on your ~/.bashrc add this

export JAVA_HOME=/opt/java
export MAVEN_HOME=/opt/maven
export MONGO_HOME=/opt/mongo
export ES_HOME=/opt/es
export NEO4J_HOME=/opt/neo4j
export ORIENTDB_HOME=/opt/orient
export TITAN_HOME=/opt/titan

export PATH=$JAVA_HOME/bin:$PATH
export PATH=$MAVEN_HOME/bin:$PATH
export PATH=$MONGO_HOME/bin:$PATH
export PATH=$ES_HOME/bin:$PATH
export PATH=$ES_HOME/bin/service:$PATH
export PATH=$NEO4J_HOME/bin:$PATH
export PATH=$ORIENTDB_HOME/bin:$PATH
export PATH=$TITAN_HOME/bin:$PATH
export PATH=./node_modules/.bin:$PATH

to run just:

source .bashrc
mvn install

after that put that content of xml inside of pom.xml file on root folder
and run

mvn package

inside pom u can config the folder where de dependencies will download
and u can search then here: mvnrepository.com

that way u can expose the dependences of jar and avoid jar hell ;-)

cheers


Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-17076221
.

Hi Gabriel,

I've been thinking about it and I'm not too sure that mvn is required for this project. gremlin-node does not depend on the jar files, and the jar files used is determined by which blueprints implementation you use. The people that should be using mvn are the users of the software, so that they can manage the jars as this project is database independent.

Frank

Hi Frank,

I Agree with you, but in /lib we have a bunch of jar files, i just thinking, clean this folder and just leave the java implementation specific for the gremlin-node, this way the user will be able surely use mvn, leave the dependencies with the users, that way i can use mvn, and the other guy can only download de jar and put on folder.
I try to use, mvn and mixed versions imagine what happend... the smell its not good hehe ;-)

Gabriel

Point taken. I agree. I'll look into getting mvn support soon.
Thanks

Hi Gariel,

Just reopened this as I realised that this issue didn't get resolved. Are you still getting the error?

Frank

Hi Gabriel,

I finally took a look at including a pom.xml and I'm glad you convinced me to to it. It's much easier now for the user. Currently I've included the required jars for Orient graphdb, but if you get a chance can you give it a try.

Thanks
Frank

Added maven support and included all .jar files required for titan in v0.1.13a+