JRuby, Rails and MYSQL Ready for Primetime?

View: New views
8 Messages — Rating Filter:   Alert me  

JRuby, Rails and MYSQL Ready for Primetime?

by Ray Hooker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is a follow-up to my previous post raising the question of JRuby, Rails and mysql integration.  As my previous post indicated, I was able to bring up the app which connects to MYSQL just fine under the Netbeans built-in JRuby, GlassFish and Mongrel (though Glassfish does not display the images in my layout for some reason).   Since I may need to deploy to a server other than Glassfish, I tried the WAR file generation.  When I try to bring the app up under both Glassfish and Tomcat, it gives the error "unable to connect".

Yes I know that it may be that it now is trying to access MYSQL like it is remote versus an inner process call but I cannot confirm that.  Does anyone have a hint or cookbook on how to achieve this? I have tried posting my question to the MYSQL forum but noone is answering... the docs indicate that skip-networking should be commented out, but it does not exist in my.ini.. also I disabled my windows firewall for the test.  

Also wondered about JDBC, but I saw quite a few errors reported last year but no resolution reported.  As before, is there a well-worn path for bringing this up under windows with MYSQL, JRuby, Rails?

Thanks,

Ray

RE: JRuby, Rails and MYSQL Ready for Primetime?

by Brandon Hauff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ray,

I have been using JRuby on Rails for a while now.  I use a local mysql
database for testing, but normally connect to a DB2 database.  I will
describe what works for me:

JRuby 1.2.0 installed at c:\jruby-1.2.0
Gems:
- Rails 2.2.2
- Rails 2.3.2
- activerecord-jdbc-adapter 0.9.0 (There are some problem with 0.9.1)
- activerecord-jdbcmysql-adapter 0.9.0
- jdbc-mysql 5.0.4
- glassfish 0.9.3
- mongrel 1.1.5
- rack 0.9.1

Your database.yml should look like this:

development:
  adapter: jdbcmysql
  database: fulfillment_development
  username: user
  password: password
  host: localhost

I always use mongrel for testing my app in development.  I use the
glassfish gem, not the glassfish v3, for deployment.  It is a simple as
changing to your projects directory and then executing 'glassfish -e
production -p port -d'.  Vivek Pandey has some great blog posts about
using the glassfish gem: http://weblogs.java.net/blog/vivekp/

Hope this helps,

Brandon

> -----Original Message-----
> From: Ray Hooker [mailto:rhooker@...]
> Sent: Wednesday, May 20, 2009 8:02 AM
> To: users@...
> Subject: JRuby, Rails and MYSQL Ready for Primetime?
>
>
> This is a follow-up to my previous post raising the question of JRuby,
> Rails
> and mysql integration.  As my previous post indicated, I was able to
> bring
> up the app which connects to MYSQL just fine under the Netbeans built-
> in
> JRuby, GlassFish and Mongrel (though Glassfish does not display the
> images
> in my layout for some reason).   Since I may need to deploy to a
server
> other than Glassfish, I tried the WAR file generation.  When I try to
> bring
> the app up under both Glassfish and Tomcat, it gives the error "unable
> to
> connect".
>
> Yes I know that it may be that it now is trying to access MYSQL like
it
> is
> remote versus an inner process call but I cannot confirm that.  Does
> anyone
> have a hint or cookbook on how to achieve this? I have tried posting
my
> question to the MYSQL forum but noone is answering... the docs
indicate

> that
> skip-networking should be commented out, but it does not exist in
> my.ini..
> also I disabled my windows firewall for the test.
>
> Also wondered about JDBC, but I saw quite a few errors reported last
> year
> but no resolution reported.  As before, is there a well-worn path for
> bringing this up under windows with MYSQL, JRuby, Rails?
>
> Thanks,
>
> Ray
> --
> View this message in context:
http://www.nabble.com/JRuby%2C-Rails-and-
> MYSQL--Ready-for-Primetime--tp23635002p23635002.html
> Sent from the NetBeans Ruby Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: JRuby, Rails and MYSQL Ready for Primetime?

by Ray Hooker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Brandon,  I started by first trying to upgrade to Rails 2.3.2.   I did the upgrade for both Jruby and regular.  You can see the gem list below.  I changed the environment to specify Rails 2.3.2, but when I try to run the app again under Glassfish using Netbeans, it says:
SEVERE: Missing the Rails 2.3.2 gem. Please `gem install -v=2.3.2 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.
SEVERE:

It says the same thing for WEBrick. What is going on?  Is there a separate install for Netbeans??

Ray
*** LOCAL GEMS ***

actionmailer (2.3.2, 2.1.0)
actionpack (2.3.2, 2.1.0)
activerecord (2.3.2, 2.1.0)
activerecord-jdbc-adapter (0.9.1)
activerecord-jdbcmysql-adapter (0.9.1)
activeresource (2.3.2, 2.1.0)
activesupport (2.3.2, 2.1.0)
jdbc-mysql (5.0.4)
jruby-ldap (0.0.1)
rails (2.3.2, 2.1.0)
rake (0.8.4)
rspec (1.2.0)
ruby-net-ldap (0.0.4)
sources (0.0.1)
warbler (0.9.13)

RE: JRuby, Rails and MYSQL Ready for Primetime?

by Ray Hooker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I thought I found the problem but...   I see that I needed to specify a new platform.  So I decided to add the JRuby 1.2.0 where everything is installed.  I left Glassfish as the server but every time I bring it up, it runs the built in JRuby.  

When I try WEBBrick instead, it does come up but has a routing error when I try to specify a particular route (e.g. http://localhost:8080/myapplication/customers).  It works under the previous version. Did something change with routing in 2.3.2 or is there another issue?

Ray

RE: RE: JRuby, Rails and MYSQL Ready for Primetime?

by Brandon Hauff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ray,

I do not use Glassfish in development because I have never had luck with
it.  I always use mongrel, and I suggest you give that a whirl.  I
forgot to mention that if you installed JRuby into C:\jruby-1.2.0 like I
suggested that you would need to add it as a platform in Netbeans.  I
never have used the Built-in Netbeans JRuby platform.

Just to try and eliminate some extra variables try this.

Make sure your command line is using c:\jruby-1.2.0 and try:

Rails -d mysql testing
cd testing
jruby script/generate scaffold Post title:string body:text
edit the database.yml to match my earlier email
rake db:create:all
rake db:migrate
jruby script/server # make sure the mongrel gem is installed

goto http://localhost:30000/posts and see if you have a functioning
rails app!

Thanks,

Brandon

> -----Original Message-----
> From: Ray Hooker [mailto:rhooker@...]
> Sent: Wednesday, May 20, 2009 10:27 AM
> To: users@...
> Subject: RE: JRuby, Rails and MYSQL Ready for Primetime?
>
>
> I thought I found the problem but...   I see that I needed to specify
a

> new
> platform.  So I decided to add the JRuby 1.2.0 where everything is
> installed.  I left Glassfish as the server but every time I bring it
> up, it
> runs the built in JRuby.
>
> When I try WEBBrick instead, it does come up but has a routing error
> when I
> try to specify a particular route (e.g.
> http://localhost:8080/myapplication/customers).  It works under the
> previous
> version. Did something change with routing in 2.3.2 or is there
another
> issue?
>
> Ray
> --
> View this message in context:
http://www.nabble.com/JRuby%2C-Rails-and-
> MYSQL--Ready-for-Primetime--tp23635002p23637444.html
> Sent from the NetBeans Ruby Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: JRuby, Rails and MYSQL Ready for Primetime?

by Peter Williams-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ray,

First, for NetBeans + JRuby + GlassFish, Arun's blog has lots of helpful
information -- http://weblogs.java.net/blog/arungupta/

Regarding database configuration, the current implementations of
jdbc${dbtype} seem to work ok -- specifically, I've had good luck with
jdbcmysql and jdbcpostgres.  Note Nick's comment regarding "rack
db:create*" not working well.

Ray Hooker wrote:
> I thought I found the problem but...   I see that I needed to specify a new
> platform.  So I decided to add the JRuby 1.2.0 where everything is
> installed.  I left Glassfish as the server but every time I bring it up, it
> runs the built in JRuby.
>  
It depends on whether you are using the GlassFish V3 gem or the full
GlassFish V3 server.

GlassFish gem should work the same as Mongrel or WEBrick.  If you are
using NetBeans, 6.7 (in beta) works better than 6.5 (or you can run the
gem from a console outside the IDE.)  The gem also uses the same context
paths (e.g. app at root context) as the other server gems.

For V3 server, here are some of the bigger differences:

1) HTTP over 8080 instead of 3000.  The V3 server ignores whatever value
you have specified for a Rails project in NetBeans, so you can put 3000
there for WEBrick/Mongrel/GlassFish gem.
2) JRuby runtime specified at server startup (or in
glassfish/config/asenv.[conf/bat]).  If you are using NetBeans but not
it's integrated JRuby platform, you can add the JRuby platform you are
using and then configure it for your V3 server via the server's property
dialog.  If you start the server from within the IDE, this is the
platform that will be used regardless of what is in asenv.conf/asenv.bat.
3) Applications are deployed with their context = /$projectname, though
if you are developing just one application, you can (via server
properties in NetBeans) have it deployed at the root context as well.  
Not recommended for multiple apps because of routing complexity.

I've seen some routing issues lately with Rails 2.3.2 and latest builds
of NetBeans 6.7/V3.  But I don't know at this time if this is a rails
thing and the app needs to be fixed, or if it's a bug in NetBeans or
GlassFish.  The issue seemed independent of GlassFish at the time, as I
believe I saw a failure with WEBrick also.
> When I try WEBBrick instead, it does come up but has a routing error when I
> try to specify a particular route (e.g.
> http://localhost:8080/myapplication/customers).
This doesn't look like a correct WEBrick URL and it might just be a
bug.  It probably should have been http://localhost:8080/customers.

Hope this helps.

-Peter

>   It works under the previous
> version. Did something change with routing in 2.3.2 or is there another
> issue?
>
> Ray
>  

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: RE: JRuby, Rails and MYSQL Ready for Primetime?

by Ray Hooker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

So thanks for the suggestions.  I was finally able to sync up the gems (for both JRuby and standard Ruby).    I did have to fix the MYSQL connection which was a pain. I am using MYSQL 5.1 and so I had to get the libmysql.dll from version 5.0.  So mongrel does indeed work.

I am having trouble with warbler.  Have you used warbler?  I would like the option of deploying to tomcat (or Glassfish if it works).  I ran into a number of issues.  If you have gotten it to work, what are your versions, etc.?

Ray

RE: RE: RE: JRuby, Rails and MYSQL Ready for Primetime?

by Brandon Hauff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ray,

Glad you got your setup running.  Unfortunately, I have not used
warbler.  Only the glassfish gem.

> -----Original Message-----
> From: Ray Hooker [mailto:rhooker@...]
> Sent: Thursday, May 21, 2009 8:57 PM
> To: users@...
> Subject: RE: RE: JRuby, Rails and MYSQL Ready for Primetime?
>
>
> So thanks for the suggestions.  I was finally able to sync up the gems
> (for
> both JRuby and standard Ruby).    I did have to fix the MYSQL
> connection
> which was a pain. I am using MYSQL 5.1 and so I had to get the
> libmysql.dll
> from version 5.0.  So mongrel does indeed work.
>
> I am having trouble with warbler.  Have you used warbler?  I would
like
> the
> option of deploying to tomcat (or Glassfish if it works).  I ran into
a
> number of issues.  If you have gotten it to work, what are your
> versions,
> etc.?
>
> Ray
> --
> View this message in context:
http://www.nabble.com/JRuby%2C-Rails-and-
> MYSQL--Ready-for-Primetime--tp23635002p23663258.html
> Sent from the NetBeans Ruby Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...