I'm trying to generate a compiled application of the Rails project using jruby and host it on Tomcat server.
I'm struggling to establish the connection with elasticsearch after compiling.
Following are the steps I've taken:
- Installed
Jruby-9.2.0.0 - Created a
jruby on railsapplication Gemfile contains
gem 'rails', '~> 5.2.1' gem 'listen' gem 'activerecord-jdbcmysql-adapter' gem 'therubyrhino' gem 'java' gem 'ruby-debug', '~> 0.10.6' gem 'elasticsearch' gem 'warbler'warble.confcontainsWarbler::Config.new do |config| config.features = %w(FEATURE) config.features = %w(gemjar) endController contains:
def index $es_client = Elasticsearch::Client.new log: true products = $es_client.search index: 'production-products' render json: products endRan
warble compiled warcommand in the project folder to create.warfile
When I run the application directly using rails s it is working as expected.
But when I compile the application and run on Tomcat server I'm getting the following error
Internal Server Error (500)
Request Method: GET
Request URL: http://localhost:8080/blog/
java.lang.NullPointerException
You're seeing this error because you use JRuby::Rack::ErrorApp::ShowStatus.
The solution is to include the required gem in
warble.conffile.