users@glassfish.java.net

Re: JRoR WAR deployment to GF3 fails

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Mon, 03 Aug 2009 09:55:34 -0700

Hassan Schroeder wrote:
> On Sat, Aug 1, 2009 at 8:10 PM, Vivek Pandey<Vivek.Pandey_at_sun.com> wrote:
>
>
>>> Using the standard Goldspike servlet runner (packaged by Warbler).
>>>
>
>
>> It is jruby-rack and not Goldspike servlet. On GlassFish v3 server there are
>> 2 ways you can run a Rails/Sinatra/Merb or any rack compliant application.
>>
>
> Actually, the main (legacy) app I'm trying to run *doesn't* run on
> GF3 without the goldspike servlet being included.
>
>
Ok.
> I'm experimenting with a minimal app right now to see what the
> issue might be, but -- see next comment
>
>
>> 1. Just run your jRuby/Rack application without any special packaging by
>> simply deploying on glassfish v3 server.
>>
>
>
>> $ asadmin deploy yourRailsAppDir/
>>
>
> After deploying the minimal app via command line as above, it
> can't find its db driver jar (which is in the ./lib dir). How to specify?
> (The admin console shows the app, but I can't see a way to add
> a library there.)
>
>

Which DB you are using? There are bunch of JDBC equivalent drivers gems
for the DB of your choice.

$ gem list activerecord-jdbc --remote

*** REMOTE GEMS ***

activerecord-jdbcderby-adapter (0.9.1)
activerecord-jdbch2-adapter (0.9.1)
activerecord-jdbchsqldb-adapter (0.9.1)
activerecord-jdbcmysql-adapter (0.9.1)
activerecord-jdbcpostgresql-adapter (0.9.1)
activerecord-jdbcsqlite3-adapter (0.9.1)

Just install one of these gems that you need.

$ gem install activerecord-jdbcmysql-adapter

Edit database.yml

development:
  adapter: *jdbcmysql*
  ....

Currently jruby container does not load any jars form its lib directory
as there has never been a need for it. This is something I can fix.
Since it's not a servlet/ejb application so just adding a JDBC driver is
not going to help you. You would still need activerecord adapter. Hence
these gems are the simple and easy way to go.
>> 2. Use warbler gem, which uses jruby-rack, to create a WAR file and deploy
>> on GlassFish v3 or v2.
>>
>
> My legacy app uses warbler-0.9.5 as a plugin, but it includes the
> goldspike jar by default. My jruby-rack version is 1.0.0. Thoughts?
>
>
Current warbler version is 0.9.13 which uses jruby-rack 0.9.4 and it
does not use goldspike jar. Anyway, these things are hidden from you.

-vivek.