Skip to content

Instantly share code, notes, and snippets.

@ept
Created August 11, 2011 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ept/1138815 to your computer and use it in GitHub Desktop.
Save ept/1138815 to your computer and use it in GitHub Desktop.
Exceptions in Neo4j.rb (1.1.4)
jruby-1.6.3 :001 > require 'rubygems'
=> true
jruby-1.6.3 :002 > require 'neo4j'
=> true
jruby-1.6.3 :003 > inserter = Neo4j::Batch::Inserter.new
=> #<Neo4j::Batch::Inserter:0xd713fe @rule_inserter=#<Neo4j::Batch::RuleInserter:0x4936f3 @inserter=#<Neo4j::Batch::Inserter:0xd713fe ...>>, @batch_inserter=#<Java::OrgNeo4jKernelImplBatchinsert::BatchInserterImpl:0x118abfe>>
jruby-1.6.3 :004 > node_a = inserter.create_node('name' => 'andreas')
=> 1
jruby-1.6.3 :005 > node_c = inserter.create_node('name' => 'craig')
=> 2
jruby-1.6.3 :006 > inserter.create_rel(:friends, node_a, node_c, :since => '2009') # NOTE: using symbol :since
NativeException: java.lang.ClassCastException: org.jruby.RubySymbol cannot be cast to java.lang.String
from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:419:in `createPropertyChain'
from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:198:in `createRelationship'
from /home/martin/.rvm/gems/jruby-1.6.3@neo/gems/neo4j-1.1.4-java/lib/neo4j/batch/inserter.rb:71:in `create_rel'
from (irb):6:in `evaluate'
from org/jruby/RubyKernel.java:1088:in `eval'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:158:in `eval_input'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:271:in `signal_status'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1419:in `loop'
from org/jruby/RubyKernel.java:1191:in `catch'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:154:in `eval_input'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1191:in `catch'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:70:in `start'
from /home/martin/.rvm/rubies/jruby-1.6.3/bin/jirb:17:in `(root)'
jruby-1.6.3 :007 > inserter.create_rel(:friends, node_a, node_c, 'since' => '2009') # changed from using a symbol to using a string
NativeException: org.neo4j.kernel.impl.nioneo.store.InvalidRecordException: Record[0] not in use
from org/neo4j/kernel/impl/nioneo/store/RelationshipStore.java:229:in `getRecord'
from org/neo4j/kernel/impl/nioneo/store/RelationshipStore.java:96:in `getRecord'
from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:210:in `connectRelationship'
from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:195:in `createRelationship'
from /home/martin/.rvm/gems/jruby-1.6.3@neo/gems/neo4j-1.1.4-java/lib/neo4j/batch/inserter.rb:71:in `create_rel'
from (irb):7:in `evaluate'
from org/jruby/RubyKernel.java:1088:in `eval'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:158:in `eval_input'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:271:in `signal_status'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1419:in `loop'
from org/jruby/RubyKernel.java:1191:in `catch'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:154:in `eval_input'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1191:in `catch'
from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:70:in `start'
from /home/martin/.rvm/rubies/jruby-1.6.3/bin/jirb:17:in `(root)'
jruby-1.6.3 :001 > require 'rubygems'
=> true
jruby-1.6.3 :002 > require 'neo4j'
=> true
jruby-1.6.3 :003 > inserter = Neo4j::Batch::Inserter.new
=> #<Neo4j::Batch::Inserter:0x15b15ab @rule_inserter=#<Neo4j::Batch::RuleInserter:0x1635aad @inserter=#<Neo4j::Batch::Inserter:0x15b15ab ...>>, @batch_inserter=#<Java::OrgNeo4jKernelImplBatchinsert::BatchInserterImpl:0x186b11c>>
jruby-1.6.3 :004 > node_a = inserter.create_node('name' => 'andreas')
=> 1
jruby-1.6.3 :005 > node_c = inserter.create_node('name' => 'craig')
=> 2
jruby-1.6.3 :006 > inserter.create_rel(:friends, node_a, node_c, 'since' => '2009')
=> nil
jruby-1.6.3 :007 > inserter.shutdown
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment