Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 4.2 with a JNDI connection breaks with use of ActiveRecord in config/initializers/*.rb #649

Closed
ericgascoine opened this issue May 16, 2015 · 5 comments
Assignees

Comments

@ericgascoine
Copy link
Contributor

NOTE The nature of this has been isolated, and rather than being a JNDI regression in the 1.3 stable line, is a change in the expectations of Rails initializations in 4.2 and the way it interacts with JNDI. An appropriate solution and/or test suite is not available yet.

This MAY not be an issue with the activerecord-jdbc*-adapter, but
JNDI is now failing for the ActiveRecord 4.2 rails support (1.3.16)

This was NOT failing in the same tomcat server and setup for 4.1 rails (1.3.16) -
conf/server.xml, /META-INF/context.xml and /WEB-INF/web.xml are identical, and work with rails 4.1.10 and do not for the 4.2.1 version of rails

It produces this error (Full tomcat log attached as a file)

16-May-2015 18:40:01.473 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log An exception happened during JRuby-Rack startup
ActiveRecord::ConnectionNotEstablished: no connection available:             SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
            FROM pg_type as t
            LEFT JOIN pg_range as r ON oid = rngtypid

from the Exception

--- Backtrace
ActiveRecord::StatementInvalid: ActiveRecord::ConnectionNotEstablished: no connection available:             SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
            FROM pg_type as t
            LEFT JOIN pg_range as r ON oid = rngtypid

                                     log at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:475
                                 execute at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.3.16/lib/arjdbc/jdbc/adapter.rb:557
                   load_additional_types at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.3.16/lib/arjdbc/postgresql/oid_types.rb:248
                     initialize_type_map at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.3.16/lib/arjdbc/postgresql/oid_types.rb:221
                              initialize at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.3.16/lib/arjdbc/postgresql/adapter.rb:1408
                         jdbc_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.3.16/lib/arjdbc/jdbc/connection_methods.rb:12
                         jndi_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.3.16/lib/arjdbc/jdbc/connection_methods.rb:15
                   postgresql_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.3.16/lib/arjdbc/postgresql/connection_methods.rb:6
                          new_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438
                 checkout_new_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448
                      acquire_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422
                                checkout at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349
                         mon_synchronize at /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211
                                checkout at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348
                              connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263
                         mon_synchronize at /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211
                              connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262
                     retrieve_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:567
                     retrieve_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:113
                              connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:87
                           table_exists? at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/model_schema.rb:230
                                  (root) at config/initializers/permissions.rb:1
                                    load at org/jruby/RubyKernel.java:1091

Relevant database.yaml is as follows

default: &default
  driver: org.postgresql.Driver
  encoding: unicode
  adapter: jdbcpostgresql
  prepared_statements: false

jndi: &jndi
  <<: *default
  jndi: java:comp/env/jdbc/protospace

production:
  <<: *jndi
  prepared_statements: false
  properties:
    prepareThreshold: 0

I have tested against master as well with

gem 'activerecord-jdbc-adapter', :require => 'arjdbc', :git => 'https://github.com/jruby/activerecord-jdbc-adapter', :branch => 'master'
gem 'activerecord-jdbcpostgresql-adapter', :git => 'https://github.com/jruby/activerecord-jdbc-adapter', :branch => 'master'

I'm going to continue trying to isolate this problem, and see If I can produce a test to diagnose it or fix it outright.

@ericgascoine
Copy link
Contributor Author

Full Tomcat log file:

16-May-2015 19:06:55.211 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log INFO: jruby 1.7.20 (1.9.3p551) 2015-05-04 3086e6a on OpenJDK 64-Bit Server VM 1.7.0_75-b13 +jit [linux-amd64]
16-May-2015 19:06:55.211 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log INFO: using a shared (threadsafe!) runtime
16-May-2015 19:07:07.107 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log D, [2015-05-16T19:07:07.102000 #1] DEBUG -- :   �[1m�[36m (2.0ms)�[0m  �[1mSELECT version()�[0m

16-May-2015 19:07:07.108 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log E, [2015-05-16T19:07:07.107000 #1] ERROR -- : ActiveRecord::ConnectionNotEstablished: no connection available: SELECT version()

16-May-2015 19:07:07.130 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log An exception happened during JRuby-Rack startup
ActiveRecord::ConnectionNotEstablished: no connection available: SELECT version()
--- System
jruby 1.7.20 (1.9.3p551) 2015-05-04 3086e6a on OpenJDK 64-Bit Server VM 1.7.0_75-b13 +jit [linux-amd64]
Time: 2015-05-16 19:07:07 +0000
Server: Apache Tomcat/8.0.20
jruby.home: file:/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home

--- Context Init Parameters:
jruby.initial.runtimes = 1
jruby.max.runtimes = 1
public.root = /

--- Backtrace
ActiveRecord::StatementInvalid: ActiveRecord::ConnectionNotEstablished: no connection available: SELECT version()
                                     log at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:475
                              exec_query at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/jdbc/adapter.rb:413
                                  select at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/jdbc/adapter.rb:500
                              select_all at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:32
                              select_all at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:70
                              select_one at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:38
                            select_value at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:43
                          select_version at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/adapter.rb:60
                      postgresql_version at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/adapter.rb:50
                        supports_ranges? at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/adapter.rb:324
                   load_additional_types at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/oid_types.rb:225
                     initialize_type_map at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/oid_types.rb:221
                              initialize at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/adapter.rb:1311
                         jdbc_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/jdbc/connection_methods.rb:16
                         jndi_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/jdbc/connection_methods.rb:24
                   postgresql_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/connection_methods.rb:6
                          new_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438
                 checkout_new_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448
                      acquire_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422
                                checkout at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349
                         mon_synchronize at /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211
                                checkout at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348
                              connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263
                         mon_synchronize at /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211
                              connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262
                     retrieve_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:567
                     retrieve_connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:113
                              connection at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:87
                           table_exists? at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/model_schema.rb:230
                                  (root) at config/initializers/permissions.rb:1
                                    load at org/jruby/RubyKernel.java:1091
                                    load at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268
                         load_dependency at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240
                                    load at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268
                                  (root) at /usr/local/tomcat/temp/0-ROOT/WEB-INF/config/initializers/permissions.rb:1
                                    load at org/jruby/RubyKernel.java:1091
                                  (root) at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:1
                         load_dependency at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240
                                    load at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268
                                    load at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268
                 load_config_initializer at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/engine.rb:652
                              instrument at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166
                 load_config_initializer at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/engine.rb:651
                                    each at org/jruby/RubyArray.java:1613
                                  Engine at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/engine.rb:616
                           instance_exec at org/jruby/RubyBasicObject.java:1566
                                     run at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/initializable.rb:30
                                  Engine at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/engine.rb:615
                        run_initializers at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/initializable.rb:55
                              tsort_each at /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:150
  each_strongly_connected_component_from at /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:210
  each_strongly_connected_component_from at /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:219
  each_strongly_connected_component_from at /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:208
                                    each at org/jruby/RubyArray.java:1613
                        tsort_each_child at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/initializable.rb:44
  each_strongly_connected_component_from at /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:203
       each_strongly_connected_component at /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:183
                                    each at org/jruby/RubyArray.java:1613
       each_strongly_connected_component at /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:182
       each_strongly_connected_component at /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:180
                              tsort_each at /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:148
                        run_initializers at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/initializable.rb:54
                                  (root) at config/environment.rb:5
                                    load at org/jruby/RubyKernel.java:1091
                             initialize! at /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/application.rb:352
                                 require at org/jruby/RubyKernel.java:1072
                                  (root) at /usr/local/tomcat/temp/0-ROOT/WEB-INF/config/environment.rb:1
                                  (root) at file:/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:1
                        load_environment at file:/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:25

--- RubyGems
Gem.dir: /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems
Gem.path:
/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/
/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems
Activated gems:
  bundler-1.9.8
  rake-10.4.2
  i18n-0.7.0
  json-1.8.2-java
  minitest-5.6.1
  thread_safe-0.3.5-java
  tzinfo-1.2.2
  activesupport-4.2.1
  builder-3.2.2
  erubis-2.7.0
  nokogiri-1.6.6.2-java
  rails-deprecated_sanitizer-1.0.3
  rails-dom-testing-1.0.6
  loofah-2.0.2
  rails-html-sanitizer-1.0.2
  actionview-4.2.1
  rack-1.6.1
  rack-test-0.6.3
  actionpack-4.2.1
  globalid-0.3.5
  activejob-4.2.1
  mime-types-2.5
  mail-2.6.3
  actionmailer-4.2.1
  activemodel-4.2.1
  arel-6.0.0
  activerecord-4.2.1
  jar-dependencies-0.1.14
  activerecord-jdbc-adapter-1.4.0.dev-java
  jdbc-postgres-9.4.1200
  activerecord-jdbcpostgresql-adapter-1.4.0.dev
  execjs-2.5.2
  autoprefixer-rails-5.1.11
  awesome_print-1.6.1
  bcrypt-3.1.10-java
  thor-0.19.1
  railties-4.2.1
  bootstrap-datepicker-rails-1.4.0
  sass-3.2.19
  bootstrap-sass-3.3.4.1
  cancancan-1.10.1
  climate_control-0.0.3
  cocaine-0.5.7
  coffee-script-source-1.9.1.1
  coffee-script-2.4.1
  coffee-rails-4.0.1
  orm_adapter-0.5.0
  responders-2.1.0
  warden-1.2.3
  devise-3.4.1
  multipart-post-2.0.0
  faraday-0.9.1
  gravatar-ultimate-2.0.0
  tilt-1.4.1
  haml-4.0.6
  sexp_processor-4.5.1
  ruby_parser-3.6.6
  html2haml-2.0.0
  haml-rails-0.9.0
  hike-1.2.3
  multi_json-1.11.0
  jbuilder-2.2.13
  jquery-rails-4.0.3
  jquery-ui-rails-4.0.3
  jquery-ui-sass-rails-4.0.3.0
  jruby-jars-1.7.20
  jruby-rack-1.1.18
  jwt-1.5.0
  multi_xml-0.5.5
  oauth-0.4.7
  oauth2-1.0.0
  oauth-plugin-0.5.1
  paper_trail-3.0.8
  paperclip-4.2.1
  roxml-3.3.1
  quickbooks-ruby-0.2.3
  sprockets-2.12.3
  sprockets-rails-2.3.1
  rails-4.2.1
  sass-rails-4.0.5
  simple_form-3.1.0
  therubyrhino_jar-1.7.6
  therubyrhino-2.0.4
  turbolinks-2.5.3
  uglifier-2.7.1

--- Bundler
Bundler.bundle_path: /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems
Bundler.root: /usr/local/tomcat/temp/0-ROOT/WEB-INF
Gemfile: /usr/local/tomcat/temp/0-ROOT/WEB-INF/Gemfile
Settings:
  gemfile = /usr/local/tomcat/temp/0-ROOT/WEB-INF/Gemfile
  without = development:test:assets
  bin_path = /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/bundler-1.9.8/bin/bundle

--- JRuby-Rack Config
compat_version = 
default_logger = org.jruby.rack.logging.StandardOutLogger@28553675
equals = <error: >
err = org.apache.tomcat.util.log.SystemLogHandler@2e84fa40
filter_adds_html = true
filter_verifies_resource = false
ignore_environment = false
initial_memory_buffer_size = 
initial_runtimes = 
jms_connection_factory = 
jms_jndi_properties = 
logger = org.jruby.rack.logging.ServletContextLogger@4dc19cdf
logger_class_name = servlet_context
logger_name = jruby.rack
maximum_memory_buffer_size = 
maximum_runtimes = 1
num_initializer_threads = 
out = org.apache.tomcat.util.log.SystemLogHandler@7cad967c
rackup = 
rackup_path = 
rewindable = true
runtime_arguments = 
runtime_environment = 
runtime_timeout_seconds = 
serial_initialization = false
servlet_context = org.apache.catalina.core.ApplicationContextFacade@4118f883
throw_init_exception = false

16-May-2015 19:07:07.131 SEVERE [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ERROR: initialization failed
 org.jruby.rack.RackInitializationException: ActiveRecord::ConnectionNotEstablished: no connection available: SELECT version()
    from arjdbc/jdbc/RubyJdbcConnection.java:1027:in `execute_query'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/jdbc/adapter.rb:413:in `exec_query'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `log'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/jdbc/adapter.rb:413:in `exec_query'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/jdbc/adapter.rb:500:in `select'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:32:in `select_all'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:38:in `select_one'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:43:in `select_value'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/adapter.rb:60:in `select_version'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/adapter.rb:50:in `postgresql_version'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/adapter.rb:324:in `supports_ranges?'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/oid_types.rb:225:in `load_additional_types'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/oid_types.rb:221:in `initialize_type_map'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/adapter.rb:1311:in `initialize'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/jdbc/connection_methods.rb:16:in `jdbc_connection'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/jdbc/connection_methods.rb:24:in `jndi_connection'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/connection_methods.rb:6:in `postgresql_connection'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `checkout'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `connection'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:567:in `retrieve_connection'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:87:in `connection'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/model_schema.rb:230:in `table_exists?'
    from config/initializers/permissions.rb:1:in `(root)'
    from org/jruby/RubyKernel.java:1091:in `load'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/config/initializers/permissions.rb:1:in `(root)'
    from org/jruby/RubyKernel.java:1091:in `load'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:1:in `(root)'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/engine.rb:652:in `load_config_initializer'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/engine.rb:651:in `load_config_initializer'
    from org/jruby/RubyArray.java:1613:in `each'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/engine.rb:616:in `Engine'
    from org/jruby/RubyBasicObject.java:1566:in `instance_exec'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/engine.rb:615:in `Engine'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `run_initializers'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:150:in `tsort_each'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:210:in `each_strongly_connected_component_from'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:219:in `each_strongly_connected_component_from'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:208:in `each_strongly_connected_component_from'
    from org/jruby/RubyArray.java:1613:in `each'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `tsort_each_child'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:203:in `each_strongly_connected_component_from'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:183:in `each_strongly_connected_component'
    from org/jruby/RubyArray.java:1613:in `each'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:182:in `each_strongly_connected_component'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:180:in `each_strongly_connected_component'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:148:in `tsort_each'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'
    from config/environment.rb:5:in `(root)'
    from org/jruby/RubyKernel.java:1091:in `load'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'
    from org/jruby/RubyKernel.java:1072:in `require'
    from /usr/local/tomcat/temp/0-ROOT/WEB-INF/config/environment.rb:1:in `(root)'
    from file:/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:1:in `(root)'
    from file:/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:25:in `load_environment'

    at org.jruby.rack.RackInitializationException.wrap(RackInitializationException.java:29)
    at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:104)
    at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:50)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4728)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5162)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:917)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1701)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.jruby.exceptions.RaiseException: (StatementInvalid) ActiveRecord::ConnectionNotEstablished: no connection available: SELECT version()
    at RUBY.log(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:475)
    at RUBY.exec_query(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/jdbc/adapter.rb:413)
    at RUBY.select(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/jdbc/adapter.rb:500)
    at RUBY.select_all(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:32)
    at RUBY.select_all(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:70)
    at RUBY.select_one(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:38)
    at RUBY.select_value(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:43)
    at RUBY.select_version(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/adapter.rb:60)
    at RUBY.postgresql_version(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/adapter.rb:50)
    at RUBY.supports_ranges?(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/adapter.rb:324)
    at RUBY.load_additional_types(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/oid_types.rb:225)
    at RUBY.initialize_type_map(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/oid_types.rb:221)
    at RUBY.initialize(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/adapter.rb:1311)
    at RUBY.jdbc_connection(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/jdbc/connection_methods.rb:16)
    at RUBY.jndi_connection(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/jdbc/connection_methods.rb:24)
    at RUBY.postgresql_connection(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/bundler/gems/activerecord-jdbc-adapter-94aea4328dbc/lib/arjdbc/postgresql/connection_methods.rb:6)
    at RUBY.new_connection(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438)
    at RUBY.checkout_new_connection(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448)
    at RUBY.acquire_connection(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422)
    at RUBY.checkout(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349)
    at RUBY.mon_synchronize(/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211)
    at RUBY.checkout(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348)
    at RUBY.connection(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263)
    at RUBY.mon_synchronize(/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211)
    at RUBY.connection(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262)
    at RUBY.retrieve_connection(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:567)
    at RUBY.retrieve_connection(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:113)
    at RUBY.connection(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:87)
    at RUBY.table_exists?(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activerecord-4.2.1/lib/active_record/model_schema.rb:230)
    at config.initializers.permissions.(root)(config/initializers/permissions.rb:1)
    at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1091)
    at RUBY.load(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268)
    at ActiveSupport::Dependencies::Loadable.load_dependency(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240)
    at RUBY.load(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268)
    at RUBY.(root)(/usr/local/tomcat/temp/0-ROOT/WEB-INF/config/initializers/permissions.rb:1)
    at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1091)
    at RUBY.(root)(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:1)
    at ActiveSupport::Dependencies::Loadable.load_dependency(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240)
    at RUBY.load(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268)
    at RUBY.load(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268)
    at RUBY.load_config_initializer(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/engine.rb:652)
    at RUBY.instrument(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166)
    at RUBY.load_config_initializer(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/engine.rb:651)
    at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1613)
    at RUBY.Engine(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/engine.rb:616)
    at org.jruby.RubyBasicObject.instance_exec(org/jruby/RubyBasicObject.java:1566)
    at Rails::Initializable::Initializer.run(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/initializable.rb:30)
    at RUBY.Engine(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/engine.rb:615)
    at RUBY.run_initializers(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/initializable.rb:55)
    at RUBY.tsort_each(/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:150)
    at TSort.each_strongly_connected_component_from(/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:210)
    at TSort.each_strongly_connected_component_from(/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:219)
    at TSort.each_strongly_connected_component_from(/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:208)
    at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1613)
    at Rails::Initializable::Collection.tsort_each_child(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/initializable.rb:44)
    at TSort.each_strongly_connected_component_from(/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:203)
    at RUBY.each_strongly_connected_component(/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:183)
    at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1613)
    at RUBY.each_strongly_connected_component(/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:182)
    at RUBY.each_strongly_connected_component(/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:180)
    at RUBY.tsort_each(/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-stdlib-1.7.20.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:148)
    at RUBY.run_initializers(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/initializable.rb:54)
    at config.environment.(root)(config/environment.rb:5)
    at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1091)
    at RUBY.initialize!(/usr/local/tomcat/temp/0-ROOT/WEB-INF/gems/gems/railties-4.2.1/lib/rails/application.rb:352)
    at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1072)
    at RUBY.(root)(/usr/local/tomcat/temp/0-ROOT/WEB-INF/config/environment.rb:1)
    at RUBY.(root)(file:/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:1)
    at RUBY.load_environment(file:/usr/local/tomcat/temp/0-ROOT/WEB-INF/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:25)

16-May-2015 19:07:07.132 SEVERE [localhost-startStop-1] org.apache.tomcat.util.descriptor.web.SecurityConstraint.findUncoveredHttpMethods For security constraints with URL pattern [/*] only the HTTP methods [POST GET DELETE OPTIONS PUT HEAD TRACE] are covered. All other methods are uncovered.
16-May-2015 19:07:07.492 INFO [ajp-nio-8009-exec-1] org.apache.catalina.core.ApplicationContext.log DEBUG: due a previous initialization failure application instance can not be returned
16-May-2015 19:07:07.492 INFO [ajp-nio-8009-exec-1] org.apache.catalina.core.ApplicationContext.log DEBUG: resetting rack response due exception

@ericgascoine
Copy link
Contributor Author

Pull request 650 added to fix this problem (In master)

@ericgascoine
Copy link
Contributor Author

Tracked down the issue down further, but not sure how to solve this one

It does not apply to rails 4.1, but does to 4.2
In callbacks.rb (below). It calls disconnect! on the connection in the prepare callback.

    module JndiConnectionPoolCallbacks

      def self.prepare(adapter, connection)
        if adapter.is_a?(ConnectionPoolCallbacks) && connection.jndi?
          adapter.extend self # extend JndiConnectionPoolCallbacks
          connection.disconnect! # disconnect initial (JNDI) connection if any
        end
      end

      def on_checkin
        disconnect!
      end

      def on_checkout
        reconnect!
      end
    end

The disconnect! works well, as long as you don't need to perform any ActiveRecord operations in your config/initializers
As soon as you do, the connection for a JNDI connection has been disconnected and you have a "no connection available" error.

Rails 4.1 does something like this:

--- Calling initializers here (with AR Connection)
   (13.0ms)  SELECT version()
== Calling on prepare callback . calling disconnect. 
#<ActiveRecord::ConnectionAdapters::PostgreSQLJdbcConnection:0x7e49354a> connection.disconnect! occured: 
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/callbacks.rb:34:in `disconnect!'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/callbacks.rb:34:in `prepare'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/adapter.rb:79:in `initialize'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/postgresql/adapter.rb:1404:in `initialize'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/connection_methods.rb:12:in `jdbc_connection'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/connection_methods.rb:15:in `jndi_connection'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/postgresql/connection_methods.rb:6:in `postgresql_connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:435:in `new_connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:445:in `checkout_new_connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `acquire_connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:351:in `checkout'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:350:in `checkout'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `connection'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `retrieve_connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_handling.rb:87:in `connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/model_schema.rb:209:in `table_exists?'
/home/eric/projects/protospace/config/initializers/permissions.rb:5:in `(root)'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:1:in `load'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:1:in `(root)'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:232:in `load_dependency'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:241:in `load'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:241:in `load'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/engine.rb:648:in `load_config_initializer'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/notifications.rb:161:in `instrument'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/engine.rb:647:in `load_config_initializer'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/engine.rb:612:in `each'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/engine.rb:612:in `Engine'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/initializable.rb:30:in `run'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/engine.rb:611:in `Engine'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/initializable.rb:55:in `run_initializers'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:150:in `tsort_each'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:210:in `each_strongly_connected_component_from'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:219:in `each_strongly_connected_component_from'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:208:in `each_strongly_connected_component_from'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/initializable.rb:44:in `each'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/initializable.rb:44:in `tsort_each_child'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:203:in `each_strongly_connected_component_from'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:183:in `each_strongly_connected_component'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:182:in `each'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:182:in `each_strongly_connected_component'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:180:in `each_strongly_connected_component'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:148:in `tsort_each'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/application.rb:300:in `initialize!'
/home/eric/projects/protospace/config/environment.rb:5:in `require'
/home/eric/projects/protospace/config/environment.rb:5:in `(root)'
file:/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/jruby-rack-1.1.18/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:1:in `(root)'
file:/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/jruby-rack-1.1.18/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:25:in `load_environment'
== Calling on checkout callback 
   (1.0ms)  SELECT COUNT(*) FROM "app_roles"
== Calling on checkin callback 
#<ActiveRecord::ConnectionAdapters::PostgreSQLJdbcConnection:0x7e49354a> connection.disconnect! occured: 
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/adapter.rb:294:in `disconnect!'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/adapter.rb:294:in `disconnect!'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/callbacks.rb:40:in `on_checkin'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:429:in `make_lambda'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:256:in `call'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:256:in `simple'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:503:in `call'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:503:in `call'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:503:in `each'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:503:in `call'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:86:in `run_callbacks'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:364:in `checkin'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:363:in `checkin'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:322:in `clear_reloadable_connections!'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:321:in `each'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:321:in `clear_reloadable_connections!'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:319:in `clear_reloadable_connections!'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:528:in `each'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:528:in `clear_reloadable_connections!'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/connection_handling.rb:129:in `clear_reloadable_connections!'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.1.10/lib/active_record/railtie.rb:145:in `Railtie'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:443:in `instance_exec'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:443:in `make_lambda'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:187:in `call'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:187:in `simple'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:501:in `call'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:501:in `call'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:501:in `each'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:501:in `call'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:86:in `run_callbacks'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/actionpack-4.1.10/lib/action_dispatch/middleware/reloader.rb:83:in `prepare!'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/actionpack-4.1.10/lib/action_dispatch/middleware/reloader.rb:55:in `prepare!'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/application/finisher.rb:52:in `Finisher'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/initializable.rb:30:in `run'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/initializable.rb:55:in `run_initializers'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:150:in `tsort_each'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:183:in `each_strongly_connected_component'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:219:in `each_strongly_connected_component_from'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:182:in `each_strongly_connected_component'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:180:in `each'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:180:in `each_strongly_connected_component'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:148:in `tsort_each'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.1.10/lib/rails/application.rb:300:in `initialize!'
/home/eric/projects/protospace/config/environment.rb:5:in `(root)'
file:/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/jruby-rack-1.1.18/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:1:in `require'
file:/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/jruby-rack-1.1.18/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:1:in `(root)'
file:/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/jruby-rack-1.1.18/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:25:in `load_environment'
file:/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/jruby-rack-1.1.18/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails_booter.rb:83:in `load_environment'
== Calling on checkout callback 

Rails 4.2 does something like this

--- Calling initializers here (with AR Connection)
   (13.0ms)  SELECT version()
== Calling on prepare callback . calling disconnect. 
#<ActiveRecord::ConnectionAdapters::PostgreSQLJdbcConnection:0x63d3017> connection.disconnect! occured: 
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/callbacks.rb:34:in `disconnect!'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/callbacks.rb:34:in `prepare'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/adapter.rb:79:in `initialize'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/postgresql/adapter.rb:1404:in `initialize'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/connection_methods.rb:12:in `jdbc_connection'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/connection_methods.rb:15:in `jndi_connection'
/home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/postgresql/connection_methods.rb:6:in `postgresql_connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `checkout'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `connection'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:567:in `retrieve_connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:87:in `connection'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/model_schema.rb:230:in `table_exists?'
/home/eric/projects/protospace/config/initializers/permissions.rb:5:in `(root)'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:1:in `load'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:1:in `(root)'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/engine.rb:652:in `load_config_initializer'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/engine.rb:651:in `load_config_initializer'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/engine.rb:616:in `each'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/engine.rb:616:in `Engine'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/engine.rb:615:in `Engine'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `run_initializers'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:150:in `tsort_each'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:210:in `each_strongly_connected_component_from'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:219:in `each_strongly_connected_component_from'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:208:in `each_strongly_connected_component_from'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `each'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `tsort_each_child'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:203:in `each_strongly_connected_component_from'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:183:in `each_strongly_connected_component'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:182:in `each'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:182:in `each_strongly_connected_component'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:180:in `each_strongly_connected_component'
/usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:148:in `tsort_each'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'
/home/eric/projects/protospace/config/environment.rb:5:in `require'
/home/eric/projects/protospace/config/environment.rb:5:in `(root)'
file:/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/jruby-rack-1.1.18/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:1:in `(root)'
file:/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/jruby-rack-1.1.18/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:25:in `load_environment'

AND THEN

ActiveRecord::ConnectionNotEstablished: no connection available:             SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
            FROM pg_type as t
            LEFT JOIN pg_range as r ON oid = rngtypid

An exception happened during JRuby-Rack startup
ActiveRecord::ConnectionNotEstablished: no connection available:             SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
            FROM pg_type as t
            LEFT JOIN pg_range as r ON oid = rngtypid
--- System
jruby 1.7.20 (1.9.3p551) 2015-05-04 3086e6a on OpenJDK 64-Bit Server VM 1.7.0_79-b14 +jit [linux-amd64]
Time: 2015-05-18 17:37:49 -0600
Server: Apache Tomcat/7.0.55
jruby.home: /usr/local/rvm/rubies/jruby-1.7.20

--- Context Init Parameters:
jruby.compat.version = 1.9.3
jruby.initial.runtimes = 1
jruby.max.runtimes = 1
jruby.min.runtimes = 1
jruby.rack.error = false
jruby.rack.layout_class = JRuby::Rack::FileSystemLayout
jruby.rack.logging = JUL
jruby.rack.logging.name = org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[.]
jruby.runtime.acquire.timeout = 5.0
public.root = public
rails.env = development
rails.root = /home/eric/projects/protospace

--- Backtrace
ActiveRecord::StatementInvalid: ActiveRecord::ConnectionNotEstablished: no connection available:             SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
            FROM pg_type as t
            LEFT JOIN pg_range as r ON oid = rngtypid

                                     log at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:475
                                 execute at /home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/adapter.rb:557
                   load_additional_types at /home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/postgresql/oid_types.rb:248
                     initialize_type_map at /home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/postgresql/oid_types.rb:221
                              initialize at /home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/postgresql/adapter.rb:1408
                         jdbc_connection at /home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/connection_methods.rb:12
                         jndi_connection at /home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/jdbc/connection_methods.rb:15
                   postgresql_connection at /home/eric/projects/activerecord-jdbc-adapter/lib/arjdbc/postgresql/connection_methods.rb:6
                          new_connection at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438
                 checkout_new_connection at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448
                      acquire_connection at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422
                                checkout at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349
                         mon_synchronize at /usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/monitor.rb:211
                                checkout at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348
                              connection at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263
                         mon_synchronize at /usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/monitor.rb:211
                              connection at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262
                     retrieve_connection at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:567
                     retrieve_connection at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:113
                              connection at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:87
                           table_exists? at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activerecord-4.2.1/lib/active_record/model_schema.rb:230
                                  (root) at /home/eric/projects/protospace/config/initializers/permissions.rb:5
                                    load at org/jruby/RubyKernel.java:1091
                                  (root) at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:1
                         load_dependency at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240
                                    load at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268
                                    load at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268
                 load_config_initializer at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/engine.rb:652
                              instrument at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166
                 load_config_initializer at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/engine.rb:651
                                    each at org/jruby/RubyArray.java:1613
                                  Engine at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/engine.rb:616
                           instance_exec at org/jruby/RubyBasicObject.java:1566
                                     run at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/initializable.rb:30
                                  Engine at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/engine.rb:615
                        run_initializers at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/initializable.rb:55
                              tsort_each at /usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:150
  each_strongly_connected_component_from at /usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:210
  each_strongly_connected_component_from at /usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:219
  each_strongly_connected_component_from at /usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:208
                                    each at org/jruby/RubyArray.java:1613
                        tsort_each_child at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/initializable.rb:44
  each_strongly_connected_component_from at /usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:203
       each_strongly_connected_component at /usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:183
                                    each at org/jruby/RubyArray.java:1613
       each_strongly_connected_component at /usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:182
       each_strongly_connected_component at /usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:180
                              tsort_each at /usr/local/rvm/rubies/jruby-1.7.20/lib/ruby/1.9/tsort.rb:148
                        run_initializers at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/initializable.rb:54
                             initialize! at /usr/local/rvm/gems/jruby-1.7.20@protospace/gems/railties-4.2.1/lib/rails/application.rb:352
                                 require at org/jruby/RubyKernel.java:1072
                                  (root) at /home/eric/projects/protospace/config/environment.rb:5
                                  (root) at file:/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/jruby-rack-1.1.18/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:1
                        load_environment at file:/usr/local/rvm/gems/jruby-1.7.20@protospace/gems/jruby-rack-1.1.18/lib/jruby-rack-1.1.18.jar!/jruby/rack/rails/environment3.rb:25

(instead of
--------
== Calling on checkout callback 
   # this is the initializers code.
   (0.0ms)  SELECT COUNT(*) FROM "app_roles"
== Calling on checkin callback 
== Calling on checkout callback 
--------

A workaround can performed by adding this to an initializer if you want to use ActiveRecord in your initializers

  module ActiveRecord::ConnectionAdapters
    module Jdbc
      # JNDI specific connection pool callbacks that make sure the JNDI connection
      # is disconnected on check-in and looked up (re-connected) on-checkout.
      module JndiConnectionPoolCallbacks

        def self.prepare(adapter, connection)
          if adapter.is_a?(ConnectionPoolCallbacks) && connection.jndi?
            adapter.extend self # extend JndiConnectionPoolCallbacks
          end
        end
      end
    end
  end

Changing the issue name to more accurately reflect the problem

@ericgascoine ericgascoine changed the title JNDI data source Regression failure for master Rails 4.2 with a JNDI connection breaks with use of ActiveRecord in config/initializers/*.rb May 19, 2015
@ericgascoine
Copy link
Contributor Author

The workaround listed above will consume a connection from the connection pool This connection is not released appropriately.

@kares kares self-assigned this Jun 10, 2015
kares added a commit that referenced this issue Jun 11, 2015
…alize`

... which is probably for the best, but for the record this is due to changes in AR 4.2
as we now (postgresql adapter) follow code and eagerly load the type map (in initialize)
this presents itself to be problematic as we disconnect! the initial connection while we still expect to execute statements as part of (PostgresqlAdapter's) initialize

resolves #649
@kares
Copy link
Member

kares commented Jun 11, 2015

as noted at #620 (comment) ... 4679495 + a work-around due rails/rails#20516 should resolve this, thanks

@kares kares closed this as completed Jun 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants