Why is the db directory not included in JRuby WAR when using Warbler?
I've created a simple 'hello' type JRuby application and use Warbler to WAR up and then deploy to JBoss. However, I get the following error when using the application:
ActiveRecord::JDBCError (The driver encountered an unknown error: java.sql.SQLException: path to '/opt/jboss/server/ruby/tmp/deploy/tmp8791905909469840942demo-exp.war/WEB-INF/db/production.sqlite3': '/opt/jboss/server/ruby/tmp/deploy/tmp87919059094698409开发者_如何学C42demo-exp.war/WEB-INF/db' does not exist):
Sure enough when I dig into the demo.war file the db directory is missing from WEB-INF directory. The db directory exists in the app directory though along with test, development and production database files.
Any ideas?
Usually the db directory contains migrations only. If you're using sqlite3 it contains the database file, but since when you deploy a war in production it gets unpacked somewhere in the server innards and potentially gets deleted on redeploy, your database file would go away with the redeploy. If the file is read-only and you're not worried about that consideration then you can easily add the db directory by running warble config
and editing config/warble.rb
and adding db
to the config.dirs
array.
精彩评论