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

Jruby on Rails application changes initialization sequence when used with jdbc adapter #5644

Open
joshianand opened this Issue Mar 6, 2019 · 5 comments

Comments

Projects
None yet
3 participants
@joshianand
Copy link

joshianand commented Mar 6, 2019

Environment

jruby 9.1.17.0 (2.3.3)

  • Operating system: Found issue on Windows as well as centos

Other relevant info you may wish to add:
gem 'activerecord-jdbcmysql-adapter'
gem 'therubyrhino'
gem 'jruby-openssl'

Expected Behavior

Initilization sequence should load enviornments/developemet.rb or production.rb before database.yaml is executed

Actual Behavior

I had been working on my rails application with ruby 2.3.3 and everything was working fine . I had requirement to create war package from my existing rails code, so I switched to jruby and installed required gems . as soon as i start my sever in production mode or development mode Rails stats processing database.yaml and none of initializers files or the group files (production.rb or development.rb files under config/enviornments) are loaded before that (they are loaded after database.yaml is initialised). This does not happen when using ruby and associated mysql gem.

@joshianand

This comment has been minimized.

Copy link
Author

joshianand commented Mar 7, 2019

@kares

This comment has been minimized.

Copy link
Member

kares commented Mar 7, 2019

not sure how much jruby-rack affects the initialization order, but it sure does not patch any Rails internals.
if this is really that different from a non-embedded mode (please confirm with a minimal reproducible if possible) than we might try changing the booter: https://github.com/jruby/jruby-rack/blob/master/src/main/ruby/jruby/rack/rails_booter.rb#L25-L40 (believe you could also sub-class and set your own booter class - just poke around the Java initialization part)

@joshianand

This comment has been minimized.

Copy link
Author

joshianand commented Mar 7, 2019

@kares, the boot method addresses rails 2 and rails 3 , I am working on rails 5 can that be an issue ? I have no experience of < rails 4

@kares

This comment has been minimized.

Copy link
Member

kares commented Mar 7, 2019

if you read the code ... non Rails 2 applies to all Rails 3+ ... so do not worry about you having Rails 5

@headius

This comment has been minimized.

Copy link
Member

headius commented Mar 9, 2019

I guess I could see the sequence in the Rails 3+ boot logic might cause things to load in a different order. Isn't there one file we can load to do this whole sequence properly for Rails?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.