I just recently learned about Vert.x and would like to try it out but I am running into some issues.
I can get a server up written in javascript but cannot get the ruby (jruby) version to run.
May 04, 2012 1:50:57 PM org.vertx.java.core.logging.impl.JULLogDelegate error
SEVERE: backtrace is
/home/curtis/.rvm/rubies/jruby-1.6.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
require'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json/ext.rb:13:in
Ext'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json/ext.rb:12:in
JSON'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json/ext.rb:9:in
(root)'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json/ext.rb:36:in
require'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json.rb:58:in
JSON'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json.rb:54:in
(root)'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json.rb:59:in
require'
/home/curtis/src-files/vert.x-1.0.beta11/bin/../lib/ruby/core/event_bus.rb:16:in
(root)'
/home/curtis/src-files/vert.x-1.0.beta11/bin/../lib/ruby/core/event_bus.rb:26:in
(root)'
/home/curtis/src-files/vert.x-1.0.beta11/bin/../lib/ruby/vertx.rb:1:in
`(root)'
This is what happens when I try to simply run the webapp example located in the vert.x-1.0.beta11/examples/ruby/webapp directory. I do have Jruby installed (through rvm)
$ jruby-1.6.6 -v jruby 1.6.6 (ruby-1.8.7-p357) (2012-01-30 5673572)
(OpenJDK Client VM 1.7.0_147-icedtea) [linux-i386-java]
I also have the reccomended JDK/JRE version installed. With the correct paths
.bashrc (bottom)
PATH=$PATH$HOME/.rvm/bin:$HOME/src-files/vert.x-1.0.beta11/bin:/usr/lib/jvm/java-1.7.0-openjdk-i386
I am running into a brick wall sort of, the error messages either don't help much or lead me to believe there is simply a bug in vert.x or jruby.
Advice please?
JRUBY_HOME=$HOME/.rvm/rubies/jruby-1.6.6
Make sure you have json gem installed, it's a prerequisite for the running the ruby version as stated on the vert.x website. Since you're using rvm you can switch to jruby, rvm use [jruby-version] if you've not already and try searching for the json gem as shown below.
gem search json
What is the result when you issue the command above. If you didn't get any response, you can get it installed in your jruby by using this command,
jruby -S gem install json
On the lighter side you should also install yard gem if you want to build the ruby API doc. Hope this helps.
Is the PATH line in your .bashrc just as you wrote here? If so, you need a slash in between $PATH and $HOME. Also, I think rvm likes to have the rvm sourcing line as the last thing in .bashrc, like the following:
# RVM -- don't put anything after this.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
Related
I've been following along with the Lynda.com's Ruby on Rails course. I did everything just as mentioned inside the videos.
I am trying to run the rails server command, which should default to WEBrick, correct?
I run the command and it has an issue in the nokogiri.rb file and on line 29 where the error is happening this is what is read:
require 'nokogiri/nokogiri'
Which is what my command prompt is throwing up on when running the rails server command. Any idea what could be causing this? If so, what commands do I need to run to settle this? To me it sounds like something was missed when installing MySQL.
I am not sure what nokogiri is and why rails server won't run and points to that line of code.
The path to this file is (Wherever you installed the folder to)\lib\ruby\gems\2.2.0\gems\nokogiri-1.6.6.2-x64-mingw32\lib
EDIT**: I have a chain of errors, like it goes from -long path-, from -longpath- etcetera. I tried installing the latest gem, and it wasn't successful. Is there a log file I can get to share with you guys to help figure out the issue.
nokogiri is a Ruby "gem" (library) for parsing XML and HTML.
Your Rails project should have a Gemfile which specifies the name and version of each gem needed to run the project. To install the gems listed in the gemfile:
bundle install
After that install completes successfully, Rails should be able to find the nokogiri gem.
Try this
$ sudo apt-get install libxslt-dev libxml2-dev zlib1g-dev
$ sudo gem install nokogiri -v '1.5.11'
According to \lib\ruby\gems\2.2.0\gems\nokogiri-1.6.6.2-x64-mingw32\lib, which means that you are running it on Windows platform. You are using ruby 2.2.0.
I know that nokogiri conflicts with 2.2.* versions of ruby in Windows. I have already encountered this problem. I think it is because of mingw32.
You need to install 2.1.* version of Ruby in order to make Nokogiri work.
Per http://jruby.org/2014/01/09/jruby-1-7-10.html, the subject problem is supposed to be fixed in 1.7.10 via https://github.com/jruby/jruby/pull/1252. However, my experience is otherwise, per:
MacbookAir1:javlats palfvin$ jruby -v
jruby 1.7.10 (2.0.0p195) 2014-01-09 c4ecd6b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_65-b14-462-11M4609 [darwin-x86_64]
MacbookAir1:javlats palfvin$ jruby
(1..2).size
NoMethodError: undefined method `size' for 1..2:Range
(root) at -:1
MacbookAir1:javlats palfvin$
I haven't figured out how to look at the Java code in an installed JRuby version, so I wasn't able to compare the installed Java source code to the version on github, but this seems so basic it's hard to believe there's anything in my environment that is messing it up. I Googled to see if anyone else had encountered this, but didn't find anything.
Any ideas?
If my git-fu is right, I don't think this commit was included in 1.7.10. Indeed, it looks to only be in master:
$ git show -s --oneline 01be8f85522e4da8df3968e622fa2c947ea6712c
01be8f8 Add a size method to RubyRange to resolve #1252
$ git branch -r --contains 01be8f85522e4da8df3968e622fa2c947ea6712c
upstream/master
upstream/unbox_opts
$ git tag --contains 01be8f85522e4da8df3968e622fa2c947ea6712c
Perhaps there was a confusing merge somewhere in JRuby land?
Does Nitrous.io support JRuby?
Installing it with RVM seems to attempt to run a sudo apt-get update, which it won't allow...
Thanks.
First you will need to update RVM.
rvm get head
From there you can install jruby:
rvm install jruby
Next, set RVM to use jruby.
rvm use jruby
Next, add jruby to your PATH.
export PATH=$PATH:/opt/jruby/bin
From there you should be able to check that jruby is working with the following command:
jruby --version
So, installing a jruby binary seems to work fine, but still cant figure out how to get RVM to do the install...
So, I just manually moved jruby into the .rvm folder...I put a copy of the binary in the .rvm/rubies directory, made a symlink from the binaries' "jruby" executable to a "ruby" executable in the .rvm/rubies bin folder, made related empty folders for jruby in the .rvm/gems directory for the version of jruby, and did "rvm jruby-1.7.8 do rvm gemset create" and now I can do "rvm use jruby"...things seem to work fine.
I have a bad feeling about this tho. But I always do when using RVM...
I don't know if it will actually require any additional packages (so this might not work), but you could try running rvm with --autolibs=0 so it doesn't attempt to install any packages; see https://rvm.io/rvm/autolibs for details.
I have problem with very simple program I'm trying to write using JRuby, Open URI and JRuby-OSSL.
I installed JRuby-OSSL gem using:
gem install jruby-openssl
and downloaded latest jruby-complete jar (1.6.7).
I have simple script test.rb:
require 'jruby/openssl/gem_only'
require 'open-uri'
open('https://google.com')
and when I run it like this:
java -jar jruby-complete-1.6.7.jar test.rb
I get:
NameError: uninitialized constant Net::HTTP::OpenSSL
const_missing at org/jruby/RubyModule.java:2642
use_ssl= at file:/Users/mislocin/.m2/repository/org/jruby/jruby-complete/1.6.7/jruby-complete-1.6.7.jar!/META-INF/jruby.home/lib/ruby/1.8/net/https.rb:124
open_http at file:/Users/mislocin/.m2/repository/org/jruby/jruby-complete/1.6.7/jruby-complete-1.6.7.jar!/META-INF/jruby.home/lib/ruby/1.8/open-uri.rb:231
buffer_open at file:/Users/mislocin/.m2/repository/org/jruby/jruby-complete/1.6.7/jruby-complete-1.6.7.jar!/META-INF/jruby.home/lib/ruby/1.8/open-uri.rb:616
open_loop at file:/Users/mislocin/.m2/repository/org/jruby/jruby-complete/1.6.7/jruby-complete-1.6.7.jar!/META-INF/jruby.home/lib/ruby/1.8/open-uri.rb:164
catch at org/jruby/RubyKernel.java:1183
open_loop at file:/Users/mislocin/.m2/repository/org/jruby/jruby-complete/1.6.7/jruby-complete-1.6.7.jar!/META-INF/jruby.home/lib/ruby/1.8/open-uri.rb:162
open_uri at file:/Users/mislocin/.m2/repository/org/jruby/jruby-complete/1.6.7/jruby-complete-1.6.7.jar!/META-INF/jruby.home/lib/ruby/1.8/open-uri.rb:132
open at file:/Users/mislocin/.m2/repository/org/jruby/jruby-complete/1.6.7/jruby-complete-1.6.7.jar!/META-INF/jruby.home/lib/ruby/1.8/open-uri.rb:518
open at file:/Users/mislocin/.m2/repository/org/jruby/jruby-complete/1.6.7/jruby-complete-1.6.7.jar!/META-INF/jruby.home/lib/ruby/1.8/open-uri.rb:30
(root) at test.rb:4
I'm pretty sure I'm missing some details, any help appreciated.
try requiring openssl instead :
require 'openssl'
require 'open-uri'
open('https://google.com')
but than of course this probably won't solve you problem.
you gem install jruby-openssl among your jruby gems, but than do not use jruby but invoke java directly - you should not rely on it resolving gems based on your ENV variables.
you also should expect a SSLError as you haven't configured it to ignore certificate verification, here's a sample how to get https:// URIs: https://gist.github.com/1361989
OK, found my error.
By mistake, I configured GEM_HOME variable pointing to my gem repo instead of GEM_PATH. After configuring GEM_PATH environment variable everything works fine now.
I did a fresh install of jruby 1.6.2, and then wanted to install some gems.
I ran this command:
jruby -S gem install cucumber
And got this error message:
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
LoadError: OpenSSL::SSL requires the jruby-openssl gem
(root) at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/shared/jruby/openssl/autoloads/ssl.rb:8
use_ssl= at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/shared/jruby/openssl/autoloads/ssl.rb:124
connection_for at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:267
request at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:349
open_uri_or_path at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:306
fetch_path at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:181
load_specs at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:251
load_specs at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:72
list at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:224
each at org/jruby/RubyArray.java:1602
list at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:220
list at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:63
find_matching_with_errors at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:143
find_matching_with_errors at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:54
fetch_with_errors at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:83
find_gems_with_sources at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:108
find_spec_by_name_and_version at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:212
install at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:244
execute at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:120
each at org/jruby/RubyArray.java:1602
execute at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:115
invoke at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/command.rb:278
process_args at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:133
run at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:103
run at /Users/Staffr02/Development/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:63
(root) at /Users/Staffr02/Development/jruby-1.6.2/bin/gem:21
So then I tried this:
jruby -S gem install jruby-openssl
And I got the same error, which seemed a little odd. I'm running Mac OS 10.6.6.
I did some googling, and couldn't really find anything, except for a page that said this:
However, this breaks programs that use require 'openssl' as a test for whether openssl is available or not. Soap4r is one such program. In order to support this behavior, simply add
require 'jruby/openssl/gem_only'
So I tracked down the file that seemed to have the error (gem_runner.rb) and added the require line in there. I ran jruby -S gem install jruby-openssl again, and got this error:
ERROR: While executing gem ... (NameError)
uninitialized constant Net::HTTP::OpenSSL
Has anyone else had this problem before? I don't understand what I did wrong! Are there some independent openssl settings that I should delete first?
Any guidance would be much appreciated - thanks,
Rebecca