3

我正在使用 ruby​​ daemons gem 为我的 rails 项目创建自定义守护程序。唯一的问题是,当我尝试启动守护进程时ruby lib/daemons/test_ctl start,它会失败并且不会启动。日志文件具有此输出。

# Logfile created on Wed Oct 22 16:14:23 +0000 2008 by /  
*** below you find the most recent exception thrown, this will be likely (but not certainly) the exception that made the application exit abnormally \*\*\*  
# MissingSourceFile: no such file to load -- utf8proc_native  
*** below you find all exception objects found in memory, some of them may have been thrown in your application, others may just be in memory because they are standard exceptions ***  
# NoMemoryError: failed to allocate memory>  
# SystemStackError: stack level too deep>  
# fatal: exception reentered>  
# LoadError: no such file to load -- daemons>  
# LoadError: no such file to load -- active_support>  
# MissingSourceFile: no such file to load -- lib/string>  
# MissingSourceFile: no such file to load -- utf8proc_native>  

当我生成一个守护进程(从 rails 插件)并尝试运行它时,它甚至会发生。有谁知道如何解决这个问题?

4

2 回答 2

3

好的,我实际上找到了这个问题的答案。我需要两个自定义文件config/environment.rb。我使用了相对路径名,因为守护进程是在 rails 主目录中执行的,所以找不到这两个文件。在使它们成为绝对路径后,它解决了问题。

于 2008-10-22T09:17:17.730 回答
1

在尝试使守护程序插件正常工作时,我只花了 30 分钟尝试解决类似的错误:

LoadError: no such file to load -- active_support

出于某种原因,它没有找到active_supportlib,即使它已安装。(也许是因为我有冻结的铁轨)。
就我而言,解决方案是在我的
ctl 文件中使用 active_support 的绝对路径(例如lib/daemons/mailer_ctl)。

我需要将第 5 行从:

   require 'active_support'

 require './vendor/rails/activesupport/lib/active_support.rb'
于 2008-12-14T06:48:29.397 回答