`
zzhang
  • 浏览: 17311 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

诡异的"already initialized constant OPTIONS"及解决方案

阅读更多
最近要为公司一个程序加数据统计代码。在Ubuntu环境下checkout下整个程序,发现无法打开server,出错信息如下:

=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Ruby version is not up-to-date; loading cgi_multipart_eof_fix
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
ActiveScaffold: extending RESTful routes for students
ActiveScaffold: extending RESTful routes for student_profiles
ActiveScaffold: extending RESTful routes for discount_codes
ActiveScaffold: extending RESTful routes for trainers
ActiveScaffold: extending RESTful routes for trainer_profiles
ActiveScaffold: extending RESTful routes for certified_modules
ActiveScaffold: extending RESTful routes for scenarios
Exiting
/var/lib/gems/1.8/gems/rails-1.2.4/lib/commands/servers/mongrel.rb:15: warning: already
initialized constant OPTIONS
/var/lib/gems/1.8/gems/rails-1.2.4/lib/commands/servers/mongrel.rb:18: undefined method
`options' for []:Array (NoMethodError)
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:33:in `gem_original_require'
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:33:in `require'
        from /var/lib/gems/1.8/gems/activesupport-
1.4.3/lib/active_support/dependencies.rb:495:in `require'
        from /var/lib/gems/1.8/gems/activesupport-
1.4.3/lib/active_support/dependencies.rb:342:in `new_constants_in'
        from /var/lib/gems/1.8/gems/activesupport-
1.4.3/lib/active_support/dependencies.rb:495:in `require'
        from /var/lib/gems/1.8/gems/rails-1.2.4/lib/commands/server.rb:39
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from script/server:3



开始以为是环境出错,但发现新建的空项目可以运行。

于是搜索:"warning: already initialized constant OPTIONS"
得到
http://blog.1sters.com/?action=show&id=32

http://www.dansketcher.com/2007/05/07/warning-already-initialized-constant-options/
解决方法都说是缺少app中使用的gem,但查看environment.rb,安装所有require,server依然启动不起来。

搜索:"undefined method `options' for []:Array (NoMethodError)"
得到:
http://bpdp.wordpress.com/2007/08/27/what-does-mongrelrb15-warning-already-initialized-constant
-options-means/

作者的解决方案如下:
"All I have to do is remove all of the plugins (I just move it to directory
$RAILS_ROOT/tmp/plugins which I created myself) and then start move it one by one to
$RAILS_ROOT/vendor/plugins and test it using $RAILS_ROOT/script/server webrick.Then I found that
activemerchant is my problem. I need builder gem.It is all easy but the error messages was
really a mess"

按照他的方法,我把$RAILS_ROOT/vendor/plugins中的所有文件剪切出来再逐一拷贝回去并测试服务器,最终
发现是tzinfo_timezone导致的出错。

安装tzinfo_timezone,启动server,问题解决。

简单的问题,不过真是“ error messages was really a mess
顺便说下,
http://blog.1sters.com/?action=show&id=32中说在environment.rb添加“require ‘nonexistingfile’”
可启动服务器,实际上这是复现这个错误的方法。


找可以运行的环境,查看安装的gem list,把缺少的安装一遍就行。上面好笨~~~

分享到:
评论
1 楼 dazuiba 2007-11-12  
rails-1.2.4
update to 1.2.5
update your mongrel.

相关推荐

    Win10从Office2007安装MODI组件仍调用失败的解决方案.rar

    Win10从Office2007安装MODI组件后用C#调用Interop.MODI.dll仍然报错“Object hasn't been initialized and can't be used yet”,调用Office2007的OCR组件Microsoft office document imaging也是失败的解决方案。

    java异常解决方案.docx

    Java 异常解决方案 Java 异常是 Java 开发中经常遇到的问题,本文档将提供 Java 异常解决方案,涵盖 Hibernate、Tomcat、Java 基本、JSP、SSH 整合等多个方面的异常解决方案。 一、Hibernate 异常解决方案 * org....

    C++常见错误及解决方案

    ### C++常见错误及解决方案 #### 一、在源码中遗失“;” **错误信息**: `syntax error: missing ‘;’` **错误示例**: ```cpp int test, number, test = 12; ``` **解决方案**: 在编程时,忘记在语句末尾加上...

    ruby 类常量 解析

    # 错误:(eval):1: uninitialized constant C1 ``` 但是,如果我们通过类名来引用这些常量,就可以正确访问: ```ruby ruby> ConstClass::C1 # 输出:101 ``` 同样,我们可以通过类实例来调用`show`方法,展示类...

    hudson插件加载失败解决方案.pdf

    hudson插件加载失败解决方案 本文档将讨论hudson插件加载失败的解决方案,涵盖hudson版本、环境信息、插件安装、Tomcat日志分析、问题排查等方面的知识点。 一、hudson版本信息 hudson版本:hudson-2.2.1.war ...

    Plsql 12连接Oracle时出现Could not initialize oci.dll解决方案 oracle 客户端

    以下是一些解决“Could not initialize oci.dll”问题的步骤: 1. **下载Oracle Instant Client**: 首先,你需要从Oracle官方网站下载适合你的操作系统的Oracle Instant Client版本。在这个案例中,我们看到的...

    光盘刻录大师crt not initialized修复文件

    完美修复光盘刻录大师报crt not initialized的错误 使用方法:将文件覆盖到安装目录即可 解压密码:17

    解决Delphi DBX和MySQL连接的噩梦:DBX Error: Driver could not be properly initialized.

    (DBX Error: Driver could not be properly initialized. Client library may be missing, not installed properly, ...),我找到了合适的libmysql.dll和dbxmys.dll组合,把下面这个libmysql.dll拷贝到XE的bin目录...

    jQuery下拉框美化插件 支持带图标的下拉项

    select-mania是一款基于jQuery的下拉框美化插件,这款插件可以很好地解决浏览器原生下拉框的丑陋以及不同浏览器的样式不同的问题。select-mania不仅可以在初始化的时候指定下拉框的尺寸,而且还可以指定下拉项的背景...

    框架集合错误解决方案

    ### 框架集合错误解决方案 #### 包含包冲突等常见问题 在软件开发过程中,尤其是使用多种框架和技术栈时,经常会遇到各种各样的错误和异常。本文将基于提供的内容,详细介绍几个常见的错误及其解决方案。 ### 1. ...

    oracle错误代码大全

    - **解决方案**: 检查数据是否重复,并确保每个字段值都是唯一的。 #### ORA-00017: Resource busy and acquire with NOWAIT specified - **解释**: 当尝试获取一个资源(如锁)时,如果该资源被其他进程占用,...

    Spring使用redis遇到的问题及解决方案

    主要介绍了Spring使用redis遇到的问题及解决方案,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下

    20种VC++编译错误信息

    **解决方案**: - 确保在项目设置中正确配置了预编译头文件。 - 在源代码文件顶部明确包含预编译头文件,例如`#include "stdafx.h"`。 #### 2. fatal error C1083: Cannot open include file: 'R.h': No such file ...

    hibernate 自动导入 sql 文件 import.sql 国际化编码的问题的解决方案

    ### Hibernate自动导入SQL文件import.sql国际化编码问题的解决方案 #### 背景介绍 在使用Hibernate框架时,经常需要在项目启动初期或者数据库更新时自动执行一些SQL脚本(如DDL脚本)来创建或更新数据库结构。这些...

    最常见的20种VC++编译错误信息.txt

    ### 最常见的20种VC++编译错误信息详解 在使用Visual C++(VC++)进行编程时,遇到编译错误是在所难免...通过以上详细的错误分析和解决方案,可以帮助开发者快速定位问题所在,并采取相应措施解决问题,提高开发效率。

    iccavr编译putchar未定义时解决方案实用.pdf

    ### ICCAVR 编译器中 putchar() 未定义问题详解及解决方案 #### 一、问题背景 在使用 ICCAVR 编译器进行 AVR 单片机编程时,经常遇到 `_putchar` 符号未定义的问题。该问题通常出现在尝试在程序中使用 `putchar()`...

    常见的21种VC++编译错误信息集合

    - **解决方案**:确保项目设置中指定了预编译头文件,并且在源文件的顶部包含了预编译头文件。 #### 2. fatal error C1083: Cannot open include file: 'R.h': No such file or directory (无法打开包含文件 'R.h':...

    最常见的VC20种编译错误

    - **解决方案**: - 检查源文件中是否缺少`#include "stdafx.h"`。 - 如果项目中启用了预编译头文件功能,则确保所有需要使用预编译头文件的源文件都包含了这条指令。 #### 2. fatal error C1083: Cannot open ...

    VC++常见错误一览表

    ### VC++常见错误一览表详解 #### 1. fatal error C1010: unexpected end of file while looking for precompiled header directive ...了解这些问题的原因及解决方法对于提高代码质量和编译效率至关重要。

    libiomp5md.dll

    OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized. OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is ...

Global site tag (gtag.js) - Google Analytics