rake db:seed error for Rails app using MongoDB, sunspot_solr -


i working on ruby on rails application uses mongodb, , have implemented basic sunspot functionality. here information environment

  • rails 3.2.11
  • mongo 2.4.3
  • sunspot 2.0.0
  • gem mongo_mapper
  • gem sunspot_rails
  • gem sunspot_solr
  • gem sunspot_mongo_mapper

i had working, having problems. can run

bundle exec rake sunspot:solr:start

when try

bundle exec rake db:seed

i following error:

rake aborted! rsolr::error::invalidrubyresponse - 200 ok error: <result status="1">java.lang.nullpointerexception     @ org.apache.solr.handler.xmlupdaterequesthandler.dolegacyupdate(xmlupdaterequesthandler.java:129)     @ org.apache.solr.servlet.solrupdateservlet.dopost(solrupdateservlet.java:87)     @ javax.servlet.http.httpservlet.service(httpservlet.java:727)     @ javax.servlet.http.httpservlet.service(httpservlet.java:820)     @ org.mortbay.jetty.servlet.servletholder.handle(servletholder.java:511)     @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1221)     @ org.apache.solr.servlet.solrdispatchfilter.dofilter(solrdispatchfilter.java:297)     @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1212)     @ org.mortbay.jetty.servlet.servlethandler.handle(servlethandler.java:399)     @ org.mortbay.jetty.security.securityhandler.handle(securityhandler.java:216)  request data: "<?xml version=\"1.0\" encoding=\"utf-8\"?><add><doc><field name=\"id\">event 5197f9061d41c853110005a1</field><field name=\"type\">event</field><field name=\"class_name\">event</field><field name=\"name_text\">test event name</field><field name=\"description_text\">test event description</field></doc></add>"  backtrace: /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:297:in `rescue in evaluate_ruby_response' /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:294:in `evaluate_ruby_response' /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:269:in `adapt_response' /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in `execute' /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in `send_and_receive' (eval):2:in `post' /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:67:in `update' /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:87:in `add' /var/lib/gems/1.9.1/gems/sunspot-2.0.0/lib/sunspot/indexer.rb:106:in `add_documents' /var/lib/gems/1.9.1/gems/sunspot-2.0.0/lib/sunspot/indexer.rb:30:in `add' /var/lib/gems/1.9.1/gems/sunspot-2.0.0/lib/sunspot/session.rb:91:in `index' /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:297:in `rescue in     evaluate_ruby_response' /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:294:in `evaluate_ruby_response' /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:269:in `adapt_response' /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in `execute' /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in `send_and_receive' (eval):2:in `post' /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:67:in `update' /var/lib/gems/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:87:in `add' /var/lib/gems/1.9.1/gems/sunspot-2.0.0/lib/sunspot/indexer.rb:106:in `add_documents' /var/lib/gems/1.9.1/gems/sunspot-2.0.0/lib/sunspot/indexer.rb:30:in `add' /var/lib/gems/1.9.1/gems/sunspot-2.0.0/lib/sunspot/session.rb:91:in `index' /var/lib/gems/1.9.1/gems/sunspot-        2.0.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `index' /var/lib/gems/1.9.1/gems/sunspot-2.0.0/lib/sunspot.rb:184:in `index' /var/lib/gems/1.9.1/gems/sunspot_rails-2.0.0/lib/sunspot/rails/searchable.rb:392:in `solr_index' /var/lib/gems/1.9.1/gems/sunspot_rails-2.0.0/lib/sunspot/rails/searchable.rb:492:in `perform_index_tasks' /var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:431:in `_run__816338171__save__410491902__callbacks' /var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback' /var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_save_callbacks' /var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/embedded_callbacks.rb:28:in `run_callbacks' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/callbacks.rb:17:in `create_or_update' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/querying.rb:129:in `save' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/dirty.rb:19:in `block in save' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/dirty.rb:37:in `clear_changes' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/dirty.rb:19:in `save' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/validations.rb:22:in `save' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/identity_map.rb:113:in `save' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/querying.rb:134:in `save!' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/querying.rb:31:in `block in create!' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/querying.rb:100:in `block in initialize_each' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/querying.rb:98:in `each' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/querying.rb:98:in `initialize_each' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/querying.rb:31:in `create!' /my_home_dir/my_rails_app/db/seed_events.rb:4:in `<top (required)>' /var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require' /var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require' /var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency' /var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require' /my_home_dir/my_rails_app/db/seeds.rb:16:in `block in <top (required)>' /my_home_dir/my_rails_app/db/seeds.rb:16:in `each' /my_home_dir/my_rails_app/db/seeds.rb:16:in `<top (required)>' /var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load' /var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `block in load' /var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency' /var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load' /var/lib/gems/1.9.1/gems/mongo_mapper-0.12.0/lib/mongo_mapper/railtie/database.rake:14:in `block (2 levels) in <top (required)>' tasks: top => db:seed (see full trace running task --trace) 

i also similar error if attempt bundle exec rake sunspot:reindex has same java.lang.nullpointerexception stacktrace different ruby stacktrace.


update

sorry haven't gotten around in long. tried deleting solr/ directory , restarting. able run bundle exec rake sunspot:solr:start , bundle exec rake db:seed without problems, still have error when try:

bundle exec rake sunspot:solr:reindex 

i see following stacktrace

$ bundle exec rake sunspot:solr:reindex rake aborted! undefined method `includes' event:class /home/my_username/.rvm/gems/ruby-1.9.3-p429/gems/mongo_mapper-0.12.0/lib/mongo_mapper/plugins/dynamic_querying.rb:39:in `method_missing' /home/my_username/.rvm/gems/ruby-1.9.3-p429/gems/sunspot_rails-2.1.0/lib/sunspot/rails/searchable.rb:254:in `solr_index' /home/my_username/.rvm/gems/ruby-1.9.3-p429/gems/sunspot_rails-2.1.0/lib/sunspot/rails/searchable.rb:203:in `solr_reindex' /home/my_username/.rvm/gems/ruby-1.9.3-p429/bundler/gems/sunspot_mongo_mapper-b6cf3edca97a/lib/sunspot/mongo_mapper/tasks.rb:21:in `block (3 levels) in <top (required)>' /home/my_username/.rvm/gems/ruby-1.9.3-p429/bundler/gems/sunspot_mongo_mapper-b6cf3edca97a/lib/sunspot/mongo_mapper/tasks.rb:20:in `each' /home/my_username/.rvm/gems/ruby-1.9.3-p429/bundler/gems/sunspot_mongo_mapper-b6cf3edca97a/lib/sunspot/mongo_mapper/tasks.rb:20:in `block (2 levels) in <top (required)>' /home/my_username/.rvm/gems/ruby-1.9.3-p429/bin/ruby_noexec_wrapper:14:in `eval' /home/my_username.rvm/gems/ruby-1.9.3-p429/bin/ruby_noexec_wrapper:14:in `<main>' tasks: top => sunspot:solr:reindex => sunspot:reindex (see full trace running task --trace) 

so know problem is?

any insight issue appreciated! thanks!

i had same error triggered bundle exec rake sunspot:solr:reindex, helped force quitting java processes find. after restarted solr with

bundle exec rake sunspot:solr:start

i reindex without errors.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -