jruby

jruby rails memcached unmarshalling error with java classes

I have a rails app that is communicating with some java services over JMS. I'm caching a few of these objects in memcached on the rails side like so: @my_objects = MEMCACHE["some_key"] || @service.retrieve_objects MEMCACHE.set("some_key",@my_objects) if MEMCACHE["some_key"].nil? where MEMCACHE is MEMCACHE = MemCache.new(['localhost'...

jruby include java class performance vs include a package

I have a jruby rails app with a ruby module in lib that is name-spacing my java objects so I don't have conflicts. I'm wondering what the difference is between including the specific classes in that module and including the package. I've included the sample code below. In the console, for example 1 when I say MyMod:: and hit tab, it h...

Reasons to not compile

Having been landed with a Ruby project, I have been sceptical about the decision to use Ruby due to performance. I was excited to discover JRuby with its Java integration. This has made the project massively easier for me. And now I have just been totally tickled even more to discover that JRuby can be compiled down to Java bytecode . ...

Failing to connect to oracle database

I'm trying to write a jruby script that connects to an oracle database using jdbc. Thusfar I've got: require 'rubygems' require 'jdbc_adapter' require 'active_record' require 'active_record/version' ActiveRecord::Base.establish_connection( :adapter => 'jdbc', :driver => 'oracle.jdbc.driver.OracleDriver', :url => 'jdbc:oracle...

Using a self-signed certificate

I am just trying to get my head around SSL. I have set up a Jetty server on my localhost, and generated my own certificate using Keytool. Now when I go to https://localhost:8443/ I get the can't trust this certificate error. I use keytool -export -alias pongus -keystore keystore -file certfile.cer To create the certificate whic...

Jruby Gem For Heroku

I am trying to deploy a Jruby app on Heroku. Unfortunately, when I try to install gem for Heroku using jruby, I get following error: /proj/jruby-1.3.1/lib/ruby/1.8/mkmf.rb:7: JRuby does not support native extensions. Check wiki.jruby.org for alternatives. (NotImplementedError) from /proj/jruby-1.3.1/lib/ruby/1.8/mkmf.rb:1:in `requir...

Install Mysql Gem for Ruby along with JRUBY Gem

Hi. I have Jruby gem Mysql installed on my machine. However due to some reason, I had to move to ruby instead of ruby and everything seems to be working fine except that mysql gem for ruby isn't installed and now when I try to install Mysql gem i get following error: Building native extensions. This could take a while... ERROR: Error...

Which is the best database strategy for a JRuby on Rails + legacy Java code?

We have a medium size Java application that needs some refactoring. We are considering migrating towards JRuby on Rails. Mainly because of the productivity that Ruby on Rails offers and for the many existing plugins that will reimplement the web logic. However a large part of the application should stay in Java, we do not want to rewri...

Would it be feasible to write parts of an application in JRuby?

I'm thinking of refactoring a somewhat large Java based application. There are some parts of it that should be able to run at a pretty decent speed, so I thought about keeping those in pure Java ... and the rest in JRuby. Do you think it would be worth doing this "refactoring"? ...

Any tutorial-like articles out there that explain how to use jRuby on Android?

Hi there, I'm planning to perhaps purchase an android phone, and would love to be able to script some simple apps in Ruby on it. I found this article from back in August where the author was able to get the scripts working, but since I'm not a Java head, I had a hard time understanding all the steps. http://amazing-development.com/arch...

What can I leave out when creating an executable JRuby jar ?

I've attached an image of what JRuby.jar contains: http://www.freeimagehosting.net/uploads/fbfd966375.png The problem is that even for simple scripts, the resulting jars have about 8mb. Can you tell me which folders I could remove from there, and still have it running ... or what's the purpose of some of that folders? ...

JRuby and Test::Unit's assert_raise

I'm having trouble making assert_raise recognize java exceptions. I can do assert_raise(NativeException) { @iter.next } which works fine, but if I try to get more specific java_import 'java.util.NoSuchElementException' #... assert_raise(NoSuchElementException) { @iter.next } I get the error Should expect a class of exception, Ja...

Instantiating a non-static Java Inner Class from JRuby

So given the following java class: class Outer { private int x; public Outer(int x) { this.x = x; } public class Inner { private int y; public Inner(int y) { this.y = y; } public int sum() { return x + y; } } } I can create an instance of the inner class from Java in the following manner: Outer o = new Outer(1);...

How to improve jRuby load time?

I have to wait quite long time (comparing to my friends machines) for executing scripts on jRuby, especially when I'm running rake tasks or tests. I've tried jRuby version 1.3.1 and 1.4.1 with and without ruby-debug gem and the same problem occurred in each configuration. The question is simple: Is there any way to improve jRuby load p...

Making calls to a ruby lib from a java web app

We have a j2ee/spring/hibernate/tomcat web application already running on production. We are planning to integrate with a 3rd party service(recurly) which provides a ruby client lib. They don't have a java client lib yet. Their service is RESTful and their client is a thin custom wrapper over ActiveResource. I can think of a few ways to ...

JRuby and Swing DefaultTableModel ("no constructor with arguments matching[...]")

I use Swing from JRuby and I am trying to set up a JTable with a TableModel as input. table_headers looks something like this: ["bla", "narf", "poit"] table_data looks something like this: [["one", "two"], ["test, test"], ["hello", "world"]] my_model = javax.swing.table.DefaultTableModel.new(table_data,table_headers) results in ...

Where does JRuby look for scripts?

Running the command jruby -S spec gives the following error No such file, directory, or command -- spec The location of spec is /usr/bin, which is in the path. Rspec is installed. MRI Ruby can find the script. JRuby can find the rspec gem. So what goes wrong? ...

Keybinding move word in JRuby irb on OSX

Similar to this question, except in JRuby (it works in MRI Ruby). Alt-left prints a "b" in my console. Very annoying! To clarify, I've setup my terminal as described in this article, mapping option-left to escape-b. ...

Installing gems inside (J)Ruby code

I am using JRuby along with Cucumber and is looking for a way of running jruby -S gem update --system jruby -S gem install cucumber from within the Java ScriptEngine. No amount of Googling have let me to a solution to this problem. Basically I want to be able to do something like this ScriptEngineManager manager = new ScriptEngin...

take the table element while clicking on the same table element

I'm developing a project and I have a problem about this subject. I'm constructing ruby on rails project which will provide listing students with name. First of all , I will list my students information in a table and one part is missing. When the user clicks on Student Name , another table will appear and show the other information o...