Java Runtime error when trying to install sunspot - ruby-on-rails-3

i have seen other blogs and SO questions relating to this issue but none of them seem to help. I am trying to install sunspot with solr, however i keep getting an error when running the following command:
bundle exec rake sunspot:solr:start
The is the trace from running the command:
** Invoke sunspot:solr:run (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:solr:run
/home/i7core/.rvm/gems/ruby-1.9.3-p125/bin/rake: No such file or directory - java -version
rake aborted!
You need a Java Runtime Environment to run the Solr server
My gemfile:
gem 'sunspot_rails', '~> 1.3.0'
gem 'sunspot_solr'
Seems like i do not have a java runtime environment, but i have already installed java. Not sure what to do. There have also been a few github issues and everthing seems to work with the latest version, but i still cannot get it to work. Please help.

One of the fast ways to install JRE on Ubuntu:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

You need the Java JRE installed, eather the Oracle version or OpenJDK one did fine for me. Additionally, make sure, the java executable is in your path that the rake task can see.

Related

How do I `bundle install` with Chef?

I am using Chef to provision a CentOS 6.5 box and install my Rails 4.0.4 app.
I installed RVM and Ruby 2.1.1
When I cd my_website, RVM will set the correct ruby version (gemset).
How do I tell Chef to bundle with the correct ruby version
currently I am using this:
execute "bundle-install" do
user "my_user"
cwd "/home/my_user/website/"
command "bundle install"
action :run
end
But that is not enougth, it's still trying to use ruby 1.9.3
RVM is a shell-based Ruby version manager. Since the Chef Client runs as root, it probably isn't executing the login shell. So things like .rvmrc and the actual loading of RVM are ignored. Handling this with Chef is a bit complicated. I would recommend looking at Fletcher's chef-rvm cookbook.

cap deploy:migrations fails with Could not locate Gemfile

I'm working on my first rails deployment and having a problem I can't figure out.
mac osx 10.8.2
ruby 1.8.7
Rails 3.2.6
rvm 1.17.2
I've been following this tutorial http://brandnewrails.wordpress.com/ and got stuck on 7c.
I set it all up in RVM, got git running on the server, ran bundle install in the app, and wrote the Capistrano recipe in my_app/config/deploy.rb
Then I ran:
$ capify . no problem
$ cap deploy:setup no errors
$ cap deploy:check returned You appear to have all necessary dependencies installed
$ cap deploy:migrations is where the problem happens. After successfully running a bunch of the commands, capistrano fails. See below:
2012-12-10 00:43:56 executing `bundle_install'
* executing "cd /home/{servername}/party/releases/20121209134354 && bundle install --path vendor/bundle"
servers: ["{servername}"]
[{servername}] executing command
** [out :: {servername}] Could not locate Gemfile
command finished in 694ms
failed: "sh -c 'cd /home/alexchee/party/releases/20121209134354 && bundle install --path vendor/bundle'" on {servername}
Does anyone know what to do? When I check the app directory, the Gemfile is there. Any ideas or further questions?
The inability of capistrano to locate a Gemfile in this case seems to be a symptom of not having initiated git in the app locally, that is on my own computer.
My hunch is that since Gemfile is the first file in the list above, that is why it created an error first. If the program had continued, it would have probably had other errors as well.
Even if git is running on the server and the app is bundled up correctly, you must also initiate git locally and direct it to the appropriate files on your server in order for the deploy to work.
Great instructions are listed here: http://brandnewrails.wordpress.com/2012/10/14/lesson-7b/

Using lessc on Windows

I've been trying to work out how to install lesscss.org on Windows 7 so I can use it from a cygwin command line interface and also using Maven.
We have SASS running in this way but there is a requirement to use LESS in a new project.
My Steps so far...
Checked Ruby is installed, I have it installed at C:\Ruby193
Downloaded the Ruby DevKit and followed this to install it.
At CMD.exe, execute gem install less - 1 gem installed ... less-2.2.1
CMD.exe, run lessc - This gives [WARNING] Please install gem 'therubyracer' to use Less.
So at CMD.exe I try gem install therubyracer which gives this error...
ERROR:
Error installing therubyracer: ERROR: Failed to build gem native extension.
Full error is here
6. And this is where I'm stuck because lessc is still complaining therubyracer is not installed. I've also installed Python27 and added it to the Path variable as that came up in a previous error.
I can confirm I have this path C:\Ruby193\lib\ruby\gems\1.9.1\gems\therubyracer-0.10.1 which looks like a project to me but something is obviously wrong.
I've also found this as a potential answer to getting LESS on Windows but that would indicate we can't get the native 'real' version to run so both Macs, Windows and Ubuntu can use the same switches/ environment? github.com/duncansmart/less.js-windows
As the others mentioned, this is now easily done with node:
npm install -g less
This will install less as a global module that you can use from anywhere on the command line by typing:
lessc input-file.less output-file.css
An even easer way to do this is to just use a tool like SimpleLess that will automagically compile and minify your LESS for you:
http://wearekiss.com/simpless
Happy Coding!
Perhaps you had the same problem I did where you successfully installed the node module via:
npm install -g less
but when trying to run lessc, you were getting the error:
[WARNING] Please install gem 'therubyracer' to use Less.
I think this is because, though you've installed the node module, the lessc command is still tied to the ruby gem. Try uninstalling the less gem:
gem uninstall less
And then try running lessc again.

Capistrano & jruby & rvm - Bundler::GemNotFound: Could not find rake-0.9.2.2 in any of the sources

I encountered Bundler::GemNotFound: Could not find rake-0.9.2.2 in any of the sources during deploying my application using capistrano, and when processing deploy:assets:precompile.
The command is:
cd /opt/app/deploy/entercamp/releases/20120627132117 && /usr/local/rvm/rubies/jruby-1.6.7/bin/jruby --1.9 -S bundle exec rake RAILS_ENV=staging RAILS_GROUPS=assets assets:precompile
I tried the command manually on the server and it works quite ok. And I could see that rake-0.9.2.2 is installed in the result output of bundle:install in the deploy process.
Where could be the problem?
Detailed information is in: https://gist.github.com/3005237
This just got fixed with help of Michal from rvm-capistrano project.
It raises this error is because jruby is install with version 1.8 by default and it tries to switch to 1.9 when deploying and that causes the problem.
The solution is to install jruby with version 1.9 by default: rvm install jruby-1.6.7.2 --1.9 and then it works.

Capistrano + RVM rvm_install_ruby with Rubinius

I am trying to fully automate the setup of my deployment host, and so avoiding manual install of Ruby.
I am using capistrano-rvm as it promises to do the job, but I have a problem when RVM compiles Rubinius:
** [out] rbx-2.0.0pre - #configuring
** [out] rbx-2.0.0pre - #compiling
*** [err] Error running '/home/app/.rvm/wrappers/ruby-1.8.7-p358/rake install', please read /home/app/.rvm/log/rbx-2.0.0pre/rake.log
The content of /home/app/.rvm/log/rbx-2.0.0pre/rake.log is:
ERROR: Gem rake is not installed, run `gem install rake` first.
How could I? That should have been done by RVM, no?
Does anyone already met & get out of this issue?
EDIT
I forgot to mention that RVM did load & compile 1.8.7 before rbx, seems like a dependence for build. Maybe RVM is running in a gem set which is badly initialized?
I thought the 2.0.0pre was removed from rbx already, it looks like you have older RVM installation, make sure you update RVM:
curl -L get.rvm.io | bash -s stable --auto
rvm reload
This will run the installer which also makes update.
To make sure everything works properly use rbx-2.0.testing which is supposed to work version of rbx.