users@glassfish.java.net

Re: JRuby + JRails problems with connection pools

From: Arun Gupta <Arun.Gupta_at_Sun.COM>
Date: Wed, 03 Mar 2010 09:15:47 -0800

Here is a slightly old but still valid blog that explains how to
configure GlassFish v3 to use connection pool with MySQL database:

http://blogs.sun.com/arungupta/entry/totd_44_jdbc_connection_pooling

See if it helps, more in line ...

glassfish_at_javadesktop.org wrote:
> 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
It should be glassfish/domains/domain1/jre/lib/ext directory instead.

> 4. Create connection pool and JDBC resource. It successfully pings
> 5. Set database.yml to:
> production:
> adapter: jdbc
> database: jdbc/my_pool
This should be the JDBC resource, not the pool.

-Arun

> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>

-- 
Need Application Server ? Download from http://glassfish.org
Blog: http://blogs.sun.com/arungupta