Hi,
Not sure if this is a Glassfish, Warbler or JRuby issue, but this seemed
the best place to get an answer. I’m trying to setup a very simple
webapp with Sinatra, ActiveRecord and SQLite, testing using Webrick and
deploying to a Glassfish server using Warbler. Everything works
beautifully apart from the working directory of the app when run under
Glassfish. It seems to be set to
~/glassfish/domains/domain1/config/
Whereas the app is installed in:
~/glassfish/domains/domain1/applications/j2ee-modules/test/WEB-INF/
My SQLite database is in ‘db’ under the application root, so this means
I need:
ActiveRecord::Base.establish_connection(
:adapter => ‘jdbcsqlite3’,
:database => ‘…/applications/j2ee-modules/test/WEB-INF/db/test.db’
)
to connect when running under Glassfish instead of the cleaner
ActiveRecord::Base.establish_connection(
:adapter => ‘jdbcsqlite3’,
:database => ‘db/test.db’
)
I need using Webrick. What trick do I need to use to tell
Glassfish/Warbler to use my application root as the working directory?
Or am I stuck with using two different paths like this? This is my first
time using Glassfish so I’m sure I’m missing something simple.
Alex G.
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
On Wed, Dec 16, 2009 at 5:40 AM, Alex G.
[email protected] wrote:
Hi,
Not sure if this is a Glassfish, Warbler or JRuby issue, but this seemed the best place to get an answer. I’m trying to setup a very simple webapp with Sinatra, ActiveRecord and SQLite, testing using Webrick and deploying to a Glassfish server using Warbler. Everything works beautifully apart from the working directory of the app when run under Glassfish. It seems to be set to
~/glassfish/domains/domain1/config/
Whereas the app is installed in:
~/glassfish/domains/domain1/applications/j2ee-modules/test/WEB-INF/
I believe there’s a property/method in jruby-rack that gives you
access to the deployed directory for the application, but it escapes
me right now. Anyone remember it?
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
On Wed, Dec 16, 2009 at 5:40 AM, Alex G.
[email protected] wrote:
My SQLite database is in ‘db’ under the application root, so this means I need:
:database => ‘db/test.db’
)
I need using Webrick. What trick do I need to use to tell Glassfish/Warbler to use my application root as the working directory? Or am I stuck with using two different paths like this? This is my first time using Glassfish so I’m sure I’m missing something simple.
Are you using the latest versions of Warbler and JRuby-Rack?
JRuby-Rack has code to change Ruby’s notion of current working
directory to the WEB-INF directory, so relative-pathing within the
Rails application should work. I wonder what’s preventing that from
happening in your case?
/Nick
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
On 16 Dec 2009, at 19:16, Nick S. wrote:
~/glassfish/domains/domain1/applications/j2ee-modules/test/WEB-INF/
ActiveRecord::Base.establish_connection(
happening in your case?
/Nick
I got this to work (using Warbler-0.9.14) by making sure the production
environment was set. E.g. I needed
set :environment, :production
In my config.ru. Not sure if this is as designed or not. Either way it
works fine now.
Alex G.
Systems Biology Centre
University of Cambridge
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email