title: Capistrano: RSolr::Error::Http - 404 Not Found when reindexing Solr
body: <p>I have not found any concrete examples that could possibly help address my problem. I previously had the sunspot gem working with Capistrano before my update to Rails 4 and Ruby 2. Any help sorting this error out would be greatly appreciated.</p>
  
  <p><strong>Gemfile:</strong></p>
  
  <pre><code>gem 'sunspot_rails', :github =&gt; 'hsbt/sunspot', :branch =&gt; 'enabled-rails4'
  gem 'sunspot_solr', :github =&gt; 'hsbt/sunspot', :branch =&gt; 'enabled-rails4'
  </code></pre>
  
  <p><strong>.gitignore</strong></p>
  
  <pre><code>solr/pids
  solr/default
  </code></pre>
  
  <p><strong>config/deploy.rb</strong></p>
  
  <pre><code>namespace :deploy do
    task :start do ; end
    task :stop do ; end
    task :restart, :roles =&gt; :app, :except =&gt; { :no_release =&gt; true } do
      run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
    end
  
    desc "Migrate Database"
    task :migrate_db do
      run "cd #{current_path} &amp;&amp; rake db:migrate RAILS_ENV=production"
      run "touch #{current_path}/tmp/restart.txt"
    end
  
    desc "Create Solr Directory"
    task :setup_solr_data_dir do
      run "mkdir -p #{shared_path}/solr/data"
    end
  end
  
  namespace :solr do
    desc "start solr"
    task :start, :roles =&gt; :app, :except =&gt; { :no_release =&gt; true } do
      run "cd #{current_path} &amp;&amp; RAILS_ENV=#{rails_env} bundle exec sunspot-solr start --port=8983 --data-directory=#{shared_path}/solr/data --pid-dir=#{shared_path}/pids &gt; /dev/null 2&gt;&amp;1 || true"
    end
    desc "stop solr"
    task :stop, :roles =&gt; :app, :except =&gt; { :no_release =&gt; true } do
      run ("cd #{current_path} &amp;&amp; RAILS_ENV=#{rails_env} bundle exec sunspot-solr stop --port=8983 --data-directory=#{shared_path}/solr/data --pid-dir=#{shared_path}/pids &gt; /dev/null 2&gt;&amp;1 || true")
    end
    desc "reindex the whole database"
    task :reindex, :roles =&gt; :app do
      stop
      run "rm -rf #{shared_path}/solr/data"
      start
      run "cd #{current_path} &amp;&amp; yes | RAILS_ENV=#{rails_env} bundle exec rake sunspot:solr:reindex"
    end
  end
  
  after "deploy", "deploy:cleanup", "deploy:migrate_db",'deploy:setup_solr_data_dir', 'solr:start', 'solr:reindex'
  </code></pre>
  
  <p><strong>Error Message:</strong></p>
  
  <pre><code>  * 2013-06-24 12:19:20 executing `solr:start'
    * executing "cd /home/username/apps/MyApplication/current &amp;&amp; RAILS_ENV=production bundle exec sunspot-solr start --port=8983 --data-directory=/home/username/apps/MyApplication/shared/solr/data --pid-dir=/home/username/apps/MyApplication/shared/pids &gt; /dev/null 2&gt;&amp;1 || true"
      servers: ["0.0.0.0"]
      [0.0.0.0] executing command
      command finished in 1349ms
    * executing "cd /home/username/apps/MyApplication/current &amp;&amp; yes | RAILS_ENV=production bundle exec rake sunspot:solr:reindex"
      servers: ["0.0.0.0"]
      [0.0.0.0] executing command
   ** [out :: 0.0.0.0] *Note: the reindex task will remove your current indexes and start from scratch.
   ** [out :: 0.0.0.0] 
   ** [out :: 0.0.0.0] If you have a large dataset, reindexing can take a very long time, possibly weeks.
   ** [out :: 0.0.0.0] 
   ** [out :: 0.0.0.0] This is not encouraged if you have anywhere near or over 1 million rows.
   ** [out :: 0.0.0.0] 
   ** [out :: 0.0.0.0] Are you sure you want to drop your indexes and completely reindex? (y/n)
   ** [out :: 0.0.0.0] 
   ** [out :: 0.0.0.0] D, [2013-06-24T12:18:59.139035 #2262] DEBUG -- :   SOLR Request (12.2ms)  [ path=#&lt;RSolr::Client:0x00000007003988&gt; parameters={data: &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;delete&gt;&lt;query&gt;type:Project&lt;/query&gt;&lt;/delete&gt;, headers: {"Content-Type"=&gt;"text/xml"}, method: post, params: {:wt=&gt;:ruby}, query: wt=ruby, path: update, uri: http://localhost:8983/solr/default/update?wt=ruby, open_timeout: , read_timeout: , retry_503: , retry_after_limit: } ]
   ** [out :: 0.0.0.0] 
   ** [out :: 0.0.0.0] rake aborted!
   ** [out :: 0.0.0.0] 
   ** [out :: 0.0.0.0] RSolr::Error::Http - 404 Not Found
   ** [out :: 0.0.0.0] 
   ** [out :: 0.0.0.0] Error:     NOT_FOUND
   ** [out :: 0.0.0.0] 
   ** [out :: 0.0.0.0] 
   ** [out :: 0.0.0.0] Request Data: 
  </code></pre>