jruby / jruby-rack

Rack for JRuby and Java appservers
MIT License
397 stars 137 forks source link

org.jruby.rack.RackInitializationException: Not a directory - jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/jquery-rails-2.2.1/vendor/assets #155

Closed rajgurung closed 11 years ago

rajgurung commented 11 years ago

I have uploaded my JrubyOnRails application on Elasticbean Stalk. I am getting a following error. Could anyone help please?

org.jruby.rack.RackInitializationException: Not a directory - jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/jquery-rails-2.2.1/vendor/assets
    from org/jruby/RubyDir.java:447:in `chdir'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:205:in `expand_dir'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:161:in `expanded'
    from org/jruby/RubyArray.java:1613:in `each'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:156:in `expanded'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:190:in `existent'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:94:in `filter_by'
    from org/jruby/RubyArray.java:2361:in `map'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:94:in `filter_by'
    from org/jruby/RubyArray.java:1613:in `each'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:91:in `filter_by'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:84:in `load_paths'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/engine.rb:654:in `_all_load_paths'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/engine.rb:525:in `Engine'
    from org/jruby/RubyBasicObject.java:1738:in `instance_exec'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `run_initializers'
    from org/jruby/RubyArray.java:1613:in `each'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
    from org/jruby/RubyBasicObject.java:1677:in `__send__'
    from org/jruby/RubyKernel.java:2103:in `send'
    from jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /usr/share/tomcat7/webapps/ROOT/WEB-INF/config/environment.rb:22:in `(root)'
    from org/jruby/RubyKernel.java:1027:in `require'
    from file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment3.rb:1:in `(root)'
    from file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment3.rb:25:in `load_environment'
    from file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/rails_booter.rb:79:in `load_environment'

    at org.jruby.rack.RackInitializationException.wrap(RackInitializationException.java:29)
    at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:98)
    at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:50)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1099)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1621)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:679)
Caused by: org.jruby.exceptions.RaiseException: (Errno::ENOTDIR) jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/jquery-rails-2.2.1/vendor/assets
    at org.jruby.RubyDir.chdir(org/jruby/RubyDir.java:447)
    at RUBY.expand_dir(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:205)
    at RUBY.expanded(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:161)
    at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1613)
    at RUBY.expanded(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:156)
    at RUBY.existent(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:190)
    at RUBY.filter_by(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:94)
    at org.jruby.RubyArray.map(org/jruby/RubyArray.java:2361)
    at RUBY.filter_by(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:94)
    at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1613)
    at RUBY.filter_by(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:91)
    at RUBY.load_paths(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/paths.rb:84)
    at RUBY._all_load_paths(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/engine.rb:654)
    at RUBY.Engine(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/engine.rb:525)
    at org.jruby.RubyBasicObject.instance_exec(org/jruby/RubyBasicObject.java:1738)
    at RUBY.run(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/initializable.rb:30)
    at RUBY.run_initializers(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/initializable.rb:55)
    at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1613)
    at RUBY.run_initializers(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/initializable.rb:54)
    at RUBY.initialize!(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/application.rb:136)
    at org.jruby.RubyBasicObject.__send__(org/jruby/RubyBasicObject.java:1677)
    at org.jruby.RubyKernel.send(org/jruby/RubyKernel.java:2103)
    at RUBY.method_missing(jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/gems.jar!/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30)
    at RUBY.(root)(/usr/share/tomcat7/webapps/ROOT/WEB-INF/config/environment.rb:22)
    at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027)
    at RUBY.(root)(file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment3.rb:1)
    at RUBY.load_environment(file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment3.rb:25)
    at RUBY.load_environment(file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/rails_booter.rb:79)
kares commented 11 years ago

try not using the gemjar feature and repackage your .war file without it (your gems won't be in a gems.jar file inside the .war and thus chdir should likely work)

prandazzo commented 11 years ago

Hi, i have the same issue in a different situation. I packed my simple program in a jar with warbler, ex:

puts \__FILE\__
puts File.dirname(__FILE__)
Dir.chdir(File.dirname(__FILE__))

When run from jar I got this:

file:/opt/piero/aptana-workspace/radm-core-new/dist/radm.jar!/radm-core/bin/radm
file:/opt/piero/aptana-workspace/radm-core-new/dist/radm.jar!/radm-core/bin
Errno::ENOTDIR: Not a directory - file:/opt/piero/aptana-workspace/radm-core-new/dist/radm.jar!/radm-core/bin
    chdir at org/jruby/RubyDir.java:447
   (root) at file:/opt/piero/aptana-workspace/radm-core-new/dist/radm.jar!/radm-core/bin/radm:6
     load at org/jruby/RubyKernel.java:1046
   (root) at file:/opt/piero/aptana-workspace/radm-core-new/dist/radm.jar!/META-INF/main.rb:1
  require at org/jruby/RubyKernel.java:1027
   (root) at file:/opt/piero/aptana-workspace/radm-core-new/dist/radm.jar!/META-INF/main.rb:1
   (root) at jar:file:/tmp/jruby8885897003644405851extract/jruby-stdlib-1.7.3.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_
require.rb:1
error: org.jruby.embed.EvalFailedException: (Errno::ENOTDIR) file:/opt/piero/aptana-workspace/radm-core-new/dist/radm.jar!/radm-core/bin

Can anybody help me please? I'm blocked on this! Thank you!

Piero
kares commented 11 years ago

Hey Pierro, I'm not sure what do you expect - it's a jar entry when packed inside an archive - not a FS directory. You clearly can not chdir to it ... you can try reporting on JRuby's tracker but I bet they won't "fix" this ...

Maybe try unpacking the .jar before running the ruby binary.

Also please do not that this seems as not a JRuby-Rack issue, thus shall be closed unless stated otherwise :)