rubysinatrajrubywarblerjruby-rack

Jruby Warbler generated war on Tomcat for Sinatra -- View file not found


I'm running into the following issue with a WAR I am generating using Warbler to deploy to Tomcat. When I run 'rake war' it correctly generates the war file to deploy; however, upon deploying to Tomcat and navigating to the application base, I get the following message:

Errno::ENOENT at /micro_reg_90day/login No such file or directory - jndi:/localhost/micro_reg_90day/WEB-INF/views/login.erb file: RubyFile.java location: initialize line: 464

Within the browser. The strange thing is that when I go to the expanded webapp within the file system--I am seeing this within the webapp/WEB-INF/views directory:

MacBook-Pro:views ejlevin1$ ls -l
-rw-r--r--  1 ejlevin1  wheel    740 Dec  9 16:20 login.erb
-rw-r--r--  1 ejlevin1  wheel   1309 Dec  9 16:20 next_steps.erb
-rw-r--r--  1 ejlevin1  wheel   8957 Dec  9 16:20 ninety_day.erb
-rw-r--r--  1 ejlevin1  wheel  10237 Dec  9 16:20 try_it_tuesdays.erb

As you can see, the login.erb file is being packaged into the war; however, not being found by JRuby when trying to call

render :erb, :login

Within the Sinatra app. The following is my config/warbler.rb:

Warbler::Config.new do |config|
  config.dirs += ['views']
  config.includes = FileList["app.rb","init.rb"]
  config.gem_dependencies = true
  config.webxml.rack.env = ENV['RACK_ENV'].nil? || ENV['RACK_ENV'] =='' ? 'development' : ENV['RACK_ENV']
  config.webxml.jruby.compat.version = "1.9"
end

the only thing I am noticing is that the path that Tomcat is telling me is not found is prefixed by a jndi: -- Would this indicate that warbler is suppose to package the .erb files as some sort of named resource within the war?

Thanks for the help!


Solution

  • So it turns out this was related to the config.ru file that I was using within my sinatra app. The following config.ru file worked:

    require 'rubygems'
    
    load File.join(File.dirname(__FILE__), 'app.rb')
    
    set :run, false
    set :public_folder, './public'
    set :views, './views'
    
    run App
    

    I previously did not have the set :variable declarations.