users@glassfish.java.net

JRuby + JRails problems with connection pools

From: <glassfish_at_javadesktop.org>
Date: Wed, 03 Mar 2010 06:32:55 PST

Hello!

I've been having lots of trouble installing glassfish V3 to host my rails app using connection pool. Here's what I did:

1. Install glassfish using silent installation on linux (I don't have access to GUI)
2. Add JRuby and RubyGems from UpdateCenter in Glassfish
3. Add JConnector.jar to glassfish/lib folder
4. Create connection pool and JDBC resource. It successfully pings
5. Set database.yml to:
production:
  adapter: jdbc
  database: jdbc/my_pool
  driver: com.mysql.jdbc.Driver
6. Deploy, and test

The first problem I had was getting exception:
  Status: 500 Internal Server Error
  The driver encountered an error: cannot load Java class com.mysql.jdbc.Driver
    /glassfishv3/glassfish/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.2/lib/active_record/connection_adapters/jdbc_adapter.rb:326:in `initialize'
    /glassfishv3/glassfish/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.2/lib/active_record/connection_adapters/jdbc_adapter.rb:453:in `new'
...

I thought that for some reason JRuby doesn't "see" the mysql jar file I placed in the glassfish lib folder. So - I copied the jar file to the JRuby lib folder as well.
Then I got another error:

  Status: 500 Internal Server Error
  The driver encountered an error: no connection available
    /glassfishv3/glassfish/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.2/lib/active_record/connection_adapters/jdbc_adapter.rb:326:in `initialize'
    /glassfishv3/glassfish/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.2/lib/active_record/connection_adapters/jdbc_adapter.rb:453:in `new'
....

For some reason it seems that my JRuby doesn't want to play nice with GlassFish. Please let me know if I'm missing something?

Thanks a lot!
[Message sent by forum member 'x4861' (x4861_at_hotmail.com)]

http://forums.java.net/jive/thread.jspa?messageID=389840