繁体   English   中英

ActiveRecord :: JDBCError:错误:无法打开扩展控制文件

[英]ActiveRecord::JDBCError: ERROR: could not open extension control file

这可能是Google界面问题的主持人,但我还无法发现任何内容。 任何指针都会有所帮助。

JRuby 1.6.8 Rails 3.2.11 Postgres 9.1 Ubuntu 12.04

我有一个RAILS迁移:

class AddDblinkToEnrollmentsShards < ActiveRecord::Migration
  db_magic :connections => [:enrollments_shard_one, :enrollments_shard_two, :enrollments_shard_three, :enrollments_shard_four]

  def change
    execute "CREATE EXTENSION IF NOT EXISTS dblink WITH SCHEMA public;"
  end
end

而且我不断收到此错误:

-- execute("CREATE EXTENSION IF NOT EXISTS dblink WITH SCHEMA public;")
  [enrollments_shard_one]   (16.0ms)  CREATE EXTENSION IF NOT EXISTS dblink WITH SCHEMA public;
ActiveRecord::JDBCError: ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/dblink.control": No such file or directory: CREATE EXTENSION IF NOT EXISTS dblink WITH SCHEMA public;
==  AddDblinkToEnrollmentsShards: Switching connection back ===================
rake aborted!
An error has occurred, this and all later migrations canceled:

ActiveRecord::JDBCError: ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/dblink.control": No such file or directory: CREATE EXTENSION IF NOT EXISTS dblink WITH SCHEMA public;
arjdbc/jdbc/RubyJdbcConnection.java:195:in `execute'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-jdbc-adapter-1.2.5/lib/arjdbc/jdbc/adapter.rb:217:in `_execute'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-jdbc-adapter-1.2.5/lib/arjdbc/jdbc/adapter.rb:209:in `execute'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `log'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/bundler/gems/db-charmer-f12baa3d23aa/lib/db_charmer/rails3/abstract_adapter/connection_name.rb:14:in `instrument'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/newrelic_rpm-3.5.6.46/lib/new_relic/agent/instrumentation/active_record.rb:32:in `log_with_newrelic_instrumentation'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/newrelic_rpm-3.5.6.46/lib/new_relic/agent/method_tracer.rb:240:in `trace_execution_scoped'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/newrelic_rpm-3.5.6.46/lib/new_relic/agent/instrumentation/active_record.rb:29:in `log_with_newrelic_instrumentation'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-jdbc-adapter-1.2.5/lib/arjdbc/jdbc/adapter.rb:209:in `execute'
org/jruby/RubyBasicObject.java:1704:in `__send__'
org/jruby/RubyKernel.java:2130:in `send'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:466:in `method_missing'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:438:in `say_with_time'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:438:in `say_with_time'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:458:in `method_missing'
/home/scott/source/unicon/unicon-ttm-sandbox/db/migrate/20130103134257_add_dblink_to_enrollments_shards.rb:5:in `change'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:407:in `migrate'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:407:in `migrate'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:389:in `migrate'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/bundler/gems/db-charmer-f12baa3d23aa/lib/db_charmer/active_record/migration/multi_db_migrations.rb:86:in `migrate_with_db_wrapper'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/bundler/gems/db-charmer-f12baa3d23aa/lib/db_charmer/active_record/migration/multi_db_migrations.rb:125:in `on_db'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/bundler/gems/db-charmer-f12baa3d23aa/lib/db_charmer/active_record/migration/multi_db_migrations.rb:123:in `on_db'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/bundler/gems/db-charmer-f12baa3d23aa/lib/db_charmer/active_record/migration/multi_db_migrations.rb:85:in `migrate_with_db_wrapper'
org/jruby/RubyArray.java:1620:in `each'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/bundler/gems/db-charmer-f12baa3d23aa/lib/db_charmer/active_record/migration/multi_db_migrations.rb:84:in `migrate_with_db_wrapper'
org/jruby/RubyBasicObject.java:1704:in `__send__'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:528:in `migrate'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:720:in `migrate'
org/jruby/RubyProc.java:258:in `call'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:775:in `ddl_transaction'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/transactions.rb:208:in `transaction'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/newrelic_rpm-3.5.6.46/lib/new_relic/agent/method_tracer.rb:491:in `transaction_with_trace_ActiveRecord_self_name_transaction'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/newrelic_rpm-3.5.6.46/lib/new_relic/agent/method_tracer.rb:240:in `trace_execution_scoped'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/newrelic_rpm-3.5.6.46/lib/new_relic/agent/method_tracer.rb:486:in `transaction_with_trace_ActiveRecord_self_name_transaction'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:775:in `ddl_transaction'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:719:in `migrate'
org/jruby/RubyArray.java:1620:in `each'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:700:in `migrate'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:570:in `up'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/migration.rb:557:in `migrate'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/gems/activerecord-3.2.11/lib/active_record/railties/databases.rake:179:in `(root)'
org/jruby/RubyProc.java:258:in `call'
org/jruby/RubyArray.java:1620:in `each'
org/jruby/RubyArray.java:1620:in `each'
org/jruby/RubyKernel.java:1097:in `load'
org/jruby/RubyKernel.java:1117:in `eval'
/home/scott/.rvm/gems/jruby-1.6.8@jruby168-unicon/bin/ruby_noexec_wrapper:14:in `(root)'

dblink扩展未随该系统上的主要PostgreSQL软件包一起安装,因此用户必须单独安装它。 看评论。

在CentOS上:

sudo yum install postgres*contrib

登录数据库,运行:

CREATE EXTENSION dblink;

对于安装了多个pg版本的实例,用户还需要通过指定版本来安装contrib软件包:

sudo apt-get install postgresql-contrib-9.1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM