Hi,
I am migrating from rails 2.3.5 to rails 3 and jruby 1.5 to jruby 1.6.
When i deploy my application in tomcat 6 and access it i get the
following error:
======================================================================
SEVERE: unable to create shared application instance
org.jruby.rack.RackInitializationException: No such file to load –
java.lang.NullPointerException: null
from
C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:216:in
require_dependency' from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:138:in
eager_load!’
from
C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:137:in
each' from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:137:in
eager_load!’
from
C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:135:in
each' from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:135:in
eager_load!’
from
C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application.rb:108:in
eager_load!' from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application/finisher.rb:41 ... 19 levels... from file:/C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.0.jar!/vendor/rack-1.1.0/rack/builder.rb:46:in
initialize’
from :2:in `new’
from :2
at
org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:184)
at
org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:59)
at
org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:27)
at
org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:40)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at
org.apache.catalina.core.StandardService.start(StandardService.java:519)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.jruby.exceptions.RaiseException: No such file to load –
java.lang.NullPointerException: null
at
Kernel.raise(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:304)
at
ActiveSupport::Dependencies.depend_on(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:216)
at
ActiveSupport::Dependencies::Loadable.require_dependency(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:138)
at
Rails::Engine.eager_load!(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:137)
at
Array.each(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:137)
at
Rails::Engine.eager_load!(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:135)
at
Array.each(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:135)
at
Rails::Engine.eager_load!(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application.rb:108)
at
Rails::Application.eager_load!(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application/finisher.rb:41)
at
(unknown).(unknown)(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/initializable.rb:25)
at
Kernel.instance_exec(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/initializable.rb:25)
at
Kernel.instance_exec(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/initializable.rb:25)
at
Rails::Initializable::Initializer.run(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/initializable.rb:50)
at
Rails::Initializable.run_initializers(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/initializable.rb:49)
at
Array.each(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/initializable.rb:49)
at
Rails::Initializable.run_initializers(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application.rb:134)
at
Rails::Application.initialize!(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application.rb:77)
at
#Class:01x1a49182.method_missing(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/config/environment.rb:5)
at
(unknown).(unknown)(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/config/environment.rb:239)
at
Kernel.require(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239)
at
ActiveSupport::Dependencies::Loadable.require(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225)
at
ActiveSupport::Dependencies::Loadable.load_dependency(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591)
at
ActiveSupport::Dependencies.new_constants_in(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225)
at
ActiveSupport::Dependencies::Loadable.load_dependency(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239)
at
ActiveSupport::Dependencies::Loadable.require(file:/C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.0.jar!/jruby/rack/rails.rb:161)
at
JRuby::Rack::RailsBooter::Rails3Environment.load_environment(file:/C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.0.jar!/jruby/rack/rails.rb:165)
at
JRuby::Rack::RailsBooter::Rails3Environment.to_app(file:/C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.0.jar!/jruby/rack/rails.rb:186)
at #Class:01x148083b.new(:2)
at
(unknown).(unknown)(file:/C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.0.jar!/vendor/rack-1.1.0/rack/builder.rb:46)
at
Kernel.instance_eval(file:/C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.0.jar!/vendor/rack-1.1.0/rack/builder.rb:46)
at
Kernel.instance_eval(file:/C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.0.jar!/vendor/rack-1.1.0/rack/builder.rb:46)
at Rack::Builder.initialize(:2)
at (unknown).new(:2)
at (unknown).(unknown)(:1)
Sep 28, 2011 7:48:25 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Error: application initialization failed
org.jruby.rack.RackInitializationException: unable to create shared
application instance
at
org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:39)
at
org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:40)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at
org.apache.catalina.core.StandardService.start(StandardService.java:519)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.jruby.rack.RackInitializationException: No such file to
load – java.lang.NullPointerException: null
from
C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:216:in
require_dependency' from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:138:in
eager_load!’
from
C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:137:in
each' from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:137:in
eager_load!’
from
C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:135:in
each' from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:135:in
eager_load!’
from
C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application.rb:108:in
eager_load!' from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application/finisher.rb:41 ... 19 levels... from file:/C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.0.jar!/vendor/rack-1.1.0/rack/builder.rb:46:in
initialize’
from :2:in `new’
from :2
at
org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:184)
at
org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:59)
at
org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:27)
… 25 more
I am using warbler version 1.2.0 to create the war and deploy in tomcat.
The contents of my warble.rb file is:
Warbler::Config.new do |config|
Features: additional options controlling how the jar is built.
Currently the following features are supported:
- gemjar: package the gem repository in a jar file in WEB-INF/lib
config.features = %w(gemjar)
Application directories to be included in the webapp.
config.dirs = %w(app config lib log vendor tmp)
Additional files/directories to include, above those in config.dirs
config.includes = FileList[“db”]
Additional files/directories to exclude
config.excludes = FileList[“lib/tasks/*”]
Additional Java .jar files to include. Note that if .jar files are
placed
in lib (and not otherwise excluded) then they need not be mentioned
here.
JRuby and JRuby-Rack are pre-loaded in this list. Be sure to
include your
own versions if you directly set the value
config.java_libs += FileList[“lib/java/*.jar”]
Loose Java classes and miscellaneous files to be placed in
WEB-INF/classes.
config.java_classes = FileList[“target/classes/**.*”]
One or more pathmaps defining how the java classes should be copied
into
WEB-INF/classes. The example pathmap below accompanies the
java_classes
configuration above. See
http://rake.rubyforge.org/classes/String.html#M000017
for details of how to specify a pathmap.
config.pathmaps.java_classes << “%{target/classes/,}p”
config.gems += [“activerecord-jdbcpostgresql-adapter”, “jruby-openssl”]
Path to the pre-bundled gem directory inside the war file. Default
is ‘WEB-INF/gems’. Specify path if gems are already bundled
before running Warbler. This also sets ‘gem.path’ inside web.xml.
config.gem_path = “WEB-INF/vendor/bundler_gems”
Bundler support is built-in. If Warbler finds a Gemfile in the
project directory, it will be used to collect the gems to bundle
in your application. If you wish to explicitly disable this
functionality, uncomment here.
config.bundler = false
An array of Bundler groups to avoid including in the war file.
Defaults to [“development”, “test”].
config.bundle_without = []
Files for WEB-INF directory (next to web.xml). This contains
web.xml by default. If there is an .erb-File it will be processed
with webxml-config. You may want to exclude this file via
config.excludes.
config.webinf_files += FileList[“jboss-web.xml”]
Other gems to be included. You need to tell Warbler which gems
your application needs so that they can be packaged in the war
file.
The Rails gems are included by default unless the vendor/rails
directory is present.
config.gems += [“activerecord-jdbcmysql-adapter”, “jruby-openssl”]
config.gems << “tzinfo”
Uncomment this if you don’t want to package rails gem.
config.gems -= [“rails”]
The most recent versions of gems are used.
You can specify versions of gems by using a hash assignment:
config.gems[“rails”] = “2.0.2”
You can also use regexps or Gem::Dependency objects for flexibility
or
fine-grained control.
config.gems << /^merb-/
config.gems << Gem::Dependency.new(“merb-core”, “= 0.9.3”)
Include gem dependencies not mentioned specifically. Default is
true, uncomment to turn off.
config.gem_dependencies = false
Array of regular expressions matching relative paths in gems to be
excluded from the war. Defaults to empty, but you can set it like
below, which excludes test files.
config.gem_excludes = [/^(test|spec)//]
Files to be included in the root of the webapp. Note that files in
public
will have the leading ‘public/’ part of the path stripped during
staging.
config.public_html = FileList[“public//*", "doc//*”]
Pathmaps for controlling how public HTML files are copied into the
.war
config.pathmaps.public_html = [“%{public/,}p”]
Pathmaps for controlling how application files are copied into the
.war
config.pathmaps.application = [“WEB-INF/%p”]
Name of the war file (without the .war) – defaults to the basename
of RAILS_ROOT
config.war_name = “mywar”
Name of the MANIFEST.MF template for the war file. Defaults to a
simple
MANIFEST.MF that contains the version of Warbler used to create the
war file.
config.manifest_file = “config/MANIFEST.MF”
When using the ‘compiled’ feature and specified, only these Ruby
files will be compiled. Default is to compile all .rb files in
the application.
config.compiled_ruby_files = FileList[‘app/**/*.rb’]
Value of RAILS_ENV for the webapp – default as shown below
config.webxml.rails.env = ENV[‘RAILS_ENV’] || ‘production’
config.webxml.rails.env = ::Rails.env
Application booter to use, one of :rack, :rails, or :merb
(autodetected by default)
config.webxml.booter = :rails
When using the :rack booter, “Rackup” script to use.
- For ‘rackup.path’, the value points to the location of the rackup
script in the web archive file. You need to make sure this file
gets included in the war, possibly by adding it to config.includes
or config.webinf_files above.
- For ‘rackup’, the rackup script you provide as an inline string
is simply embedded in web.xml.
The script is evaluated in a Rack::Builder to load the application.
Examples:
config.webxml.rackup.path = ‘WEB-INF/hello.ru’
config.webxml.rackup = %{require ‘./lib/demo’; run
Rack::Adapter::Camping.new(Demo)}
config.webxml.rackup = require ‘cgi’ &&
CGI::escapeHTML(File.read(“config.ru”))
Control the pool of Rails runtimes. Leaving unspecified means
the pool will grow as needed to service requests. It is recommended
that you fix these values when running a production server!
config.webxml.jruby.min.runtimes = 2
config.webxml.jruby.max.runtimes = 4
config.gems[“rack”] = “1.2.1”
It was working earlier in Rails 2.3.5 and Jruby 1.5. I have upgraded
warbler too since earlier version of warble had some issues with
bundler.
Has anyone faced any such issue? or is anyone could suggest the cause
pls?