Need Hints for using Java into MRI Ruby application

350 Views Asked by At

I need some hints.

I have application which is builded on MRI Ruby (1.9.3) + Passenger

Now this application is needed to extend with "Apache POI" (http://poi.apache.org/) functionality. "Apache POI" is Java API for Microsoft Documents.

During investigation time I tested:

  • "Apache POI" + JRuby. This combination worked very well.

  • "Apache POI" + rjb (a bridge between Ruby and Java) + MRI Ruby. This combination worked very well. But during investigation time I various comments that this combination could have some problems work together with Passenger. (I not tested yet)

If "Apache POI + rjb + MRI Ruby + Passenger" combination will not work what possibilities/hints you all can provide to me to get "Apache POI" inside my application?

My opinions:

  • Create small JRuby application (support Apache POI), then using REST APIs make connection between MRI Ruby application and JRuby application.
2

There are 2 best solutions below

0
On

If you need Java to deal with Excel shreadsheets only, you may want to consider pure Ruby ways to create an Excel instead of involving Java.

The simplest is to generate Excel XML like I've done for our prod app: https://gist.github.com/1252406 .

Another way is to use spreadsheet gem: https://rubygems.org/gems/spreadsheet

0
On

If you use "Apache POI + rjb + MRI Ruby + Passenger" you need to configur Passenger to restart after each request.

http://www.modrails.com/documentation/Users%20guide%20Apache.html#_making_the_application_restart_after_each_request