Problem getting Titan and Vert.x to work together.

160 views
Skip to first unread message

javajosh

unread,
Aug 23, 2013, 10:00:11 PM8/23/13
to ve...@googlegroups.com
Hello! I'm trying to write a WorkerVerticle for Titan, the idea being to translate event bus messages to Titan calls using the very nice Gremlin DSL.

My first attempt was to try to write a trivial verticle, adding the Titan libraries to the classpath. To do this, first I adapted the Getting Started instructions to a Vertx Groovy script:

==titan.vertx.groovy==
import com.thinkaurelius.titan.core.*
import com.thinkaurelius.titan.example.*
print "hello"
g = GraphOfTheGodsFactory.create()
container.exit()

Next I wrote a small bash script that constructs the correct classpath for vertx from the Titan distribution:

#!/bin/bash
CP=$( echo titan-all-0.3.2/lib/*.jar . | sed 's/ /:/g')
vertx run titan.vertx.groovy -cp $CP

Note that this script assumes that you've downloaded and unzipped titan into a subdirectory of the CWD. You can get the binaries from: http://s3.thinkaurelius.com/downloads/titan/titan-all-0.3.2.zip

Running ./titan.verx.sh fails with a "java.lang.RuntimeException: java.lang.reflect.InvocationTargetException". I suspected that there is a conflict with the included Groovy version, so I removed the groovy jars, but got the same error.
 
Any idea how I can get Titan to work inside vert.x?

vertx 2.1.0-SNAPSHOT
Titan 0.3.2
cassandra 1.2.8
java 1.7.0_17
osx 10.8.4

Thanks.

Norman Maurer

unread,
Aug 24, 2013, 4:09:16 AM8/24/13
to ve...@googlegroups.com
Can you post the full stacktrace?

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Tim Fox

unread,
Aug 24, 2013, 4:19:06 AM8/24/13
to ve...@googlegroups.com
I don't recommend using raw verticles for anything other than quick prototyping.

Much better to write your app as a module, more info here:

http://vertx.io/mods_manual.html#what-is-a-vertx-module

On 24/08/13 03:00, javajosh wrote:
Hello! I'm trying to write a WorkerVerticle for Titan<https://github.com/thinkaurelius/titan>, 
the idea being to translate event bus messages to Titan calls using the 
very nice Gremlin DSL.

My first attempt was to try to write a trivial verticle, adding the Titan 
libraries to the classpath. To do this, first I adapted the Getting Started 
instructions to a Vertx Groovy script:

==titan.vertx.groovy==
import com.thinkaurelius.titan.core.*
import com.thinkaurelius.titan.example.*
print "hello"
g = GraphOfTheGodsFactory.create()
container.exit()

Next I wrote a small bash script that constructs the correct classpath for 
vertx from the Titan distribution:

==titan.vertx.sh===
#!/bin/bash
CP=$( echo titan-all-0.3.2/lib/*.jar . | sed 's/ /:/g')
vertx run titan.vertx.groovy -cp $CP

Note that this script assumes that you've downloaded and unzipped titan 
into a subdirectory of the CWD. You can get the binaries from: 

Tim Fox

unread,
Aug 24, 2013, 4:25:19 AM8/24/13
to ve...@googlegroups.com
vertx 2.1.0-SNAPSHOT ?

Can you try with a released version of Vert.x, not an old snapshot?

On 24/08/13 03:00, javajosh wrote:
> Hello! I'm trying to write a WorkerVerticle for Titan<https://github.com/thinkaurelius/titan>,

javajosh

unread,
Aug 24, 2013, 4:41:39 AM8/24/13
to ve...@googlegroups.com, norman...@googlemail.com
Unfortunately there is no stacktrace, just the one line of output.

javajosh

unread,
Aug 24, 2013, 4:41:58 AM8/24/13
to ve...@googlegroups.com
This is a quick prototype.

javajosh

unread,
Aug 24, 2013, 4:54:49 AM8/24/13
to ve...@googlegroups.com
Same output with 1.3.1-FINAL.

Tim Fox

unread,
Aug 24, 2013, 5:51:00 AM8/24/13
to ve...@googlegroups.com
No, I meant with the latest 2.0.1-final release ;)

javajosh

unread,
Aug 24, 2013, 12:16:16 PM8/24/13
to ve...@googlegroups.com
Perhaps you should say that then. ;)

Same output.

Tim Fox

unread,
Aug 24, 2013, 12:51:00 PM8/24/13
to ve...@googlegroups.com
Sorry... thought it was obvious.

Tim Fox

unread,
Aug 24, 2013, 1:10:15 PM8/24/13
to ve...@googlegroups.com
I had a few minutes spare as a wait for the dinner to cook, so I
downloaded Titan (well, it certainly lives up to its name - just how
many jar dependencies does it have! wow ;) ), removed groovy from the
lib directory and replicated your issue.

The exception being thrown from the line:

g = GraphOfTheGodsFactory.create()

So I added a try...catch around the line with an e.printStackTrace to
give more information on the exception, this yielded:

java.lang.IllegalArgumentException: Could not instantiate
implementation:
com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager
at
com.thinkaurelius.titan.diskstorage.Backend.getImplementationClass(Backend.java:274)
at
com.thinkaurelius.titan.diskstorage.Backend.getStorageManager(Backend.java:227)
at com.thinkaurelius.titan.diskstorage.Backend.<init>(Backend.java:97)
at
com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.getBackend(GraphDatabaseConfiguration.java:440)
at
com.thinkaurelius.titan.graphdb.database.StandardTitanGraph.<init>(StandardTitanGraph.java:67)
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:40)
at
com.thinkaurelius.titan.example.GraphOfTheGodsFactory.create(GraphOfTheGodsFactory.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at
org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:43)
at
org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:88)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at titan.run(titan.groovy:5)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSite.invoke(PojoMetaMethodSite.java:189)
at
org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at
org.vertx.groovy.platform.impl.GroovyVerticleFactory$1.start(GroovyVerticleFactory.groovy:87)
at org.vertx.java.platform.Verticle.start(Verticle.java:82)
at
org.vertx.java.platform.impl.DefaultPlatformManager$18.run(DefaultPlatformManager.java:1278)
at
org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:170)
at
io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:366)
at
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
at java.lang.Thread.run(Thread.java:722)
Caused by: 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)
at
com.thinkaurelius.titan.diskstorage.Backend.getImplementationClass(Backend.java:263)
... 39 more
Caused by: java.lang.IllegalArgumentException: Need to specify storage
directory
at
com.google.common.base.Preconditions.checkArgument(Preconditions.java:92)
at
com.thinkaurelius.titan.diskstorage.common.LocalStoreManager.<init>(LocalStoreManager.java:26)
at
com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager.<init>(BerkeleyJEStoreManager.java:37)

So something to do with Titan. tbh I don't even know what Titan does so
can't help you on what that means, but it doesn't appear to be a Vert.x
issue.



On 24/08/13 17:16, javajosh wrote:

Nate McCall

unread,
Aug 25, 2013, 1:52:31 PM8/25/13
to ve...@googlegroups.com
> So something to do with Titan. tbh I don't even know what Titan does so
> can't help you on what that means, but it doesn't appear to be a Vert.x
> issue.

Graph database with plug-able storage impls for BerkleyDB, Cassandra
and HBase. Hence all the Jars :)

>Caused by: java.lang.IllegalArgumentException: Need to specify storage directory

But really this looks like a configuration issue - how are the configs
provided and where are they stored at runtime?
Reply all
Reply to author
Forward
0 new messages