代码之家  ›  专栏  ›  技术社区  ›  Tim Post

Ruby守护进程将无法启动

  •  3
  • Tim Post  · 技术社区  · 16 年前

    我正在使用Ruby守护进程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插件)生成一个守护进程并尝试运行它时,也会发生这种情况。有人知道怎么解决这个问题吗?

    2 回复  |  直到 13 年前
        1
  •  3
  •   Tim Post    16 年前

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

        2
  •  1
  •   Dave Smylie    16 年前

    我只花了30分钟试图解决类似的错误,当试图让守护进程插件工作:

    LoadError: no such file to load -- active_support
    

    因为某种原因,它没有找到 active_support 即使安装了lib。(也许是因为我的铁轨冻住了)。
    在我的例子中,解决这个问题的方法是使用绝对路径在我的
    CTL文件(如 lib/daemons/mailer_ctl )

    我需要把第5行从:

       require 'active_support'
    

     require './vendor/rails/activesupport/lib/active_support.rb'