为什么使用 Warbler 时 db 目录不包含在 JRuby WAR 中?

发布于 2024-12-02 14:55:17 字数 469 浏览 0 评论 0原文

我创建了一个简单的“hello”类型 JRuby 应用程序,并使用 Warbler 进行 WAR,然后部署到 JBoss。但是,在使用该应用程序时出现以下错误:

ActiveRecord::JDBCError (驱动程序遇到未知错误:java.sql.SQLException: path to '/opt/jboss/server/ruby/tmp/deploy/tmp8791905909469840942demo -exp.war/WEB-INF/db/development.sqlite3': '/opt/jboss/server/ruby/tmp/deploy/tmp8791905909469840942demo-exp.war/WEB-INF/db' 不存在):

果然,当我深入研究 demo.war 文件时,db 目录是WEB-INF 目录中丢失。 db 目录与测试、开发和生产数据库文件一起存在于应用程序目录中。

有什么想法吗?

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/tmp8791905909469840942demo-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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

维持三分热 2024-12-09 14:55:17

通常 db 目录仅包含迁移。如果您使用的是 sqlite3,它包含数据库文件,但由于当您在生产中部署战争时,它会在服务器内部的某个位置解压缩,并可能在重新部署时被删除,因此您的数据库文件将随着重新部署而消失。如果该文件是只读的并且您不担心这种情况,那么您可以通过运行 warble config 并编辑 config/warble.rb 轻松添加 db 目录,将 db 添加到 config.dirs 数组。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文