Tuesday November 04, 2008
Getting Started with Edge Rails (2.2) using JRuby and GlassFish
This blog shows how to get started with Edge Rails (2.2, almost
there)
using JRuby. The blog uses JRuby
1.1.5 and GlassFish
v3 Prelude b28c to deploy a simple Rails app.
| ~/tools/jruby-1.1.4 >bin/jruby -S gem update rake JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Updating installed gems Updating rake Successfully installed rake-0.8.3 Gems updated: rake |
| ~/tools/jruby-1.1.5 >bin/jruby -S gem install rails -s
http://gems.rubyonrails.org -v 2.2.0 JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Successfully installed activesupport-2.2.0 Successfully installed activerecord-2.2.0 Successfully installed actionpack-2.2.0 Successfully installed actionmailer-2.2.0 Successfully installed activeresource-2.2.0 Successfully installed rails-2.2.0 6 gems installed Installing ri documentation for activesupport-2.2.0... Installing ri documentation for activerecord-2.2.0... Installing ri documentation for actionpack-2.2.0... Installing ri documentation for actionmailer-2.2.0... Installing ri documentation for activeresource-2.2.0... Installing RDoc documentation for activesupport-2.2.0... Installing RDoc documentation for activerecord-2.2.0... Installing RDoc documentation for actionpack-2.2.0... Installing RDoc documentation for actionmailer-2.2.0... Installing RDoc documentation for activeresource-2.2.0... |
| ~/samples/jruby/edge >~/tools/jruby-1.1.5/bin/jruby -S
rails helloworld -d mysql JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL create create app/controllers create app/helpers . . . create log/server.log create log/production.log create log/development.log create log/test.log |
| ~/samples/jruby/helloworld
>~/tools/jruby-1.1.5/bin/jruby -S rake db:create (in /Users/arungupta/samples/jruby/helloworld) !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. rake aborted! no such file to load -- mysql (See full trace by running task with --trace) |
| ~/tools/jruby-1.1.5 >bin/jruby -S gem install
activerecord-jdbcmysql-adapter JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Successfully installed activerecord-jdbc-adapter-0.8.2 Successfully installed jdbc-mysql-5.0.4 Successfully installed activerecord-jdbcmysql-adapter-0.8.2 3 gems installed Installing ri documentation for activerecord-jdbc-adapter-0.8.2... Installing ri documentation for jdbc-mysql-5.0.4... Installing ri documentation for activerecord-jdbcmysql-adapter-0.8.2... Installing RDoc documentation for activerecord-jdbc-adapter-0.8.2... Installing RDoc documentation for jdbc-mysql-5.0.4... Installing RDoc documentation for activerecord-jdbcmysql-adapter-0.8.2... |
| ~/samples/jruby/edge/helloworld >~/tools/jruby-1.1.5/bin/jruby
script/generate scaffold runner distance:float time:integer JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL exists app/models/ exists app/controllers/ exists app/helpers/ create app/views/runners exists app/views/layouts/ exists test/functional/ exists test/unit/ exists public/stylesheets/ create app/views/runners/index.html.erb create app/views/runners/show.html.erb create app/views/runners/new.html.erb create app/views/runners/edit.html.erb create app/views/layouts/runners.html.erb create public/stylesheets/scaffold.css create app/controllers/runners_controller.rb create test/functional/runners_controller_test.rb create app/helpers/runners_helper.rb route map.resources :runners dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/runner.rb create test/unit/runner_test.rb create test/fixtures/runners.yml create db/migrate create db/migrate/20081103190813_create_runners.rb ~/samples/jruby/edge/helloworld >~/tools/jruby-1.1.5/bin/jruby -S rake db:create (in /Users/arungupta/samples/jruby/edge/helloworld) ~/samples/jruby/edge/helloworld >~/tools/edge/jruby-1.1.5/bin/jruby -S rake db:migrate (in /Users/arungupta/samples/jruby/edge/helloworld) == CreateRunners: migrating ================================================== -- create_table(:runners) -> 0.0068s -> 0 rows == CreateRunners: migrated (0.0077s) ========================================= |
| development: adapter: mysql encoding: utf8 database: helloworld_development pool: 5 username: root password: socket: /tmp/mysql.sock |
| development: adapter: jdbcmysql encoding: utf8 database: helloworld_development pool: 5 username: root password: socket: /tmp/mysql.sock |
| ~/tools/glassfish/v3/28c/glassfishv3-prelude/glassfish >java -Xmx512m -DJRUBY_HOME=/Users/arungupta/tools/jruby-1.1.5/ -jar modules/glassfish.jar |
| ~/samples/jruby/edge >~/tools/glassfish/v3/28c/glassfishv3-prelude/glassfish/bin/asadmin
deploy helloworld Command deploy executed successfully. |
Posted by Arun Gupta in web2.0 | Comments[10]
|
|
|
|
|
Today's Page Hits: 3284
Total # blog entries: 1009
I've noticed there's a "glassfish" gem out there now. What is its exact purpose? I have seen people do "gem_rails myApp" but haven't had success with this using the latest jruby and rails 2.2.0. I have glassfishv3- prelude now installed and can deploy to it using your instructions but not sure if the gem can speed up the process? Thanks.
Posted by Nabeel Zafar on November 07, 2008 at 08:16 AM PST #
Thanks for this simple guide Arun!
But there still seems to an issue with drive letters in jruby on windows.
This bug report claims to have fixed the issue, but the code on trunk doesn't seem to have the patch applied.
http://jira.codehaus.org/browse/JRUBY-1401
Could I be doing something wrong?
Posted by Carlos Kozuszko on November 29, 2008 at 03:11 PM PST #
Carlos,
Check with user@jruby.codehaus.org, somebody on that alias will know the exact state of this bug.
Posted by Arun Gupta on December 05, 2008 at 05:44 PM PST #
very very cool thanksss
Posted by çiçekçi on January 25, 2009 at 04:58 AM PST #
thank u gupta.
Posted by sinema izle on March 13, 2009 at 02:03 PM PDT #
You have a very nice blog and article. Special thank on u and we hope to get more knowledge in future
www.can-bil.com
www.online-shopp.net
Posted by Ankara Bilgisayar Satış Teknoloji Mağazası Elektronik Alışveriş on March 15, 2009 at 02:36 AM PDT #
thanks..
Posted by kelebek on April 26, 2009 at 02:33 AM PDT #
Arun: I am apprehensive of invoking 'jdbcmysql' aka 'The JDBC adapter' by removing 'mysql' from project 'config/database.yml' file. Question: 'Why invoke the line RE: 'socket: /tmp/mysql.sock' in your 'config/database.yml' configuration as shown? See: MySQL_forum_ruby <a href="http://forums.mysql.com/read.php?116,276785,276785#msg-276785" for a synopsis of my dilemma attempting to 'rake' via Aptana Studio-Rad Rails-MySQL51-Ruby 1.8(26). Perhaps my MySQL 5.1(36) installation requires further invokation. However, a valid connection has been established and verified via Aptana Studio prior to attempting initial 'rake" db:migrate. Pls review. Thank you for your most gifted insight(s). Robert.
Posted by Robert Hempaz on August 18, 2009 at 09:15 AM PDT #
Robert,
Can you please clarify your question ?
Posted by Arun Gupta on August 19, 2009 at 04:30 PM PDT #
<p><a title="cet, çet , chat" href="http://sohbetw.com/">cet</a>
<a title="bedava cet, bedava chat" href="http://sohbetw.com/">bedava cet</a></p>
thanks admin
Posted by cet on September 09, 2009 at 09:42 AM PDT #