Skip to content

fix a short coming when launching jruby-rack with webspere where the war... #170

Closed
wants to merge 1 commit into from

2 participants

@mkristian
JRuby Team member

...-file gets not unpacked

see an explanation on how to setup websphere: https://github.com/mkristian/war-pack/

do not know how to provide a test case for this :( - hope that is OK

@kares
JRuby Team member
kares commented Mar 10, 2014

Thanks Kristian, last time I checked there were no issues deploying onto WS ( well all of them were fixed :) ... it's a bit unfortunate to put in an empty rescue block. do you still have the stack trace for the exception thrown and maybe report for future generations the server/jruby version used.

p.s. isn't this related to the refactorings done inside JRuby with how default gems are loaded ?
also, are you guys absolutely sure you want to force users to do/understand configuration details based on server type (assuming it somehow worked for all until now) ?

@mkristian
JRuby Team member
@mkristian
JRuby Team member

WebSphere Application Server Liberty Profile - version 8.5.5.1
https://www.ibmdw.net/wasdev/downloads/

only unexploded jars produces the error. (more later)

@kares
JRuby Team member
kares commented Mar 21, 2014

for the record of this issue ... here's the failure as reported by WAS Liberty Profile 8.5.5.1 :

org.jruby.rack.RackInitializationException: No such file or directory - /opt/apps/wlp/usr/servers/defaultServer/dropins/bug-demo.war!/WEB-INF
    from org/jruby/RubyDir.java:352:in `chdir'
    from classpath:/jruby/rack/booter.rb:125:in `change_working_directory'
    from classpath:/jruby/rack/booter.rb:105:in `boot!'
    from classpath:/jruby/rack/rails_booter.rb:26:in `boot!'
    from classpath:/jruby/rack/boot/rails.rb:10:in `(root)'
    from org/jruby/RubyKernel.java:1101:in `load'
    from <script>:1:in `(root)'

    at org.jruby.rack.RackInitializationException.wrap(RackInitializationException.java:29)
    at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:104)
    at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:50)
    at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2220)
    at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:960)
    at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6049)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:421)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:241)
    at com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:182)
    at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:169)
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:448)
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:382)
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:282)
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:253)
    at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174)
    at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83)
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:502)
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:550)
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:899)
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:981)
    at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:439)
    at com.ibm.ws.threading.internal.Worker.run(Worker.java:421)
    at java.lang.Thread.run(Thread.java:744)
Caused by: org.jruby.exceptions.RaiseException: (Errno::ENOENT) /opt/apps/wlp/usr/servers/defaultServer/dropins/bug-demo.war!/WEB-INF
    at org.jruby.RubyDir.chdir(org/jruby/RubyDir.java:352)
    at RUBY.change_working_directory(classpath:/jruby/rack/booter.rb:125)
    at RUBY.boot!(classpath:/jruby/rack/booter.rb:105)
    at RUBY.boot!(classpath:/jruby/rack/rails_booter.rb:26)
    at RUBY.(root)(classpath:/jruby/rack/boot/rails.rb:10)
    at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1101)
    at RUBY.(root)(<script>:1)
@kares
JRuby Team member
kares commented Mar 21, 2014

unfortunately ... as I was afraid it won't work with unexploded .war by default, due JRuby :

org.jruby.rack.RackInitializationException: No such file or directory - /opt/apps/wlp/usr/servers/defaultServer/dropins/bug-demo.war!/WEB-INF/gems/specifications/railties-4.0.3.gemspec
    from org/jruby/RubyFile.java:361:in `initialize'
    from org/jruby/RubyIO.java:1178:in `open'
    from org/jruby/RubyKernel.java:349:in `open'
    from classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/stub_specification.rb:61:in `data'
    from classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/stub_specification.rb:109:in `valid?'
    from classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:687:in `each_stub'
    from classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:678:in `each_gemspec'
    from org/jruby/RubyArray.java:1613:in `each'
    from classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:677:in `each_gemspec'
    from org/jruby/RubyArray.java:1613:in `each'
    from classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:676:in `each_gemspec'
    from classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:685:in `each_stub'
    from classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:705:in `stubs'
    from classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:897:in `find_inactive_by_path'
    from classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems.rb:183:in `try_activate'
    from classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:132:in `require'
    from classpath:/jruby/rack/rails/environment3.rb:23:in `load_environment'
    from classpath:/jruby/rack/rails_booter.rb:76:in `load_environment'
    from <script>:1:in `(root)'

    at org.jruby.rack.RackInitializationException.wrap(RackInitializationException.java:29)
    at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:104)
    at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:50)
    at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2220)
    at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:960)
    at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6049)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:421)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:241)
    at com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:182)
    at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:169)
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:448)
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:382)
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:282)
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:253)
    at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174)
    at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83)
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:502)
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:550)
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:899)
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:981)
    at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:439)
    at com.ibm.ws.threading.internal.Worker.run(Worker.java:421)
    at java.lang.Thread.run(Thread.java:744)
Caused by: org.jruby.exceptions.RaiseException: (Errno::ENOENT) /opt/apps/wlp/usr/servers/defaultServer/dropins/bug-demo.war!/WEB-INF/gems/specifications/railties-4.0.3.gemspec
    at org.jruby.RubyFile.initialize(org/jruby/RubyFile.java:361)
    at org.jruby.RubyIO.open(org/jruby/RubyIO.java:1178)
    at org.jruby.RubyKernel.open(org/jruby/RubyKernel.java:349)
    at RUBY.data(classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/stub_specification.rb:61)
    at RUBY.valid?(classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/stub_specification.rb:109)
    at RUBY.each_stub(classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:687)
    at RUBY.each_gemspec(classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:678)
    at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1613)
    at RUBY.each_gemspec(classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:677)
    at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1613)
    at RUBY.each_gemspec(classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:676)
    at RUBY.each_stub(classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:685)
    at RUBY.stubs(classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:705)
    at RUBY.find_inactive_by_path(classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:897)
    at RUBY.try_activate(classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems.rb:183)
    at RUBY.require(classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:132)
    at RUBY.load_environment(classpath:/jruby/rack/rails/environment3.rb:23)
    at RUBY.load_environment(classpath:/jruby/rack/rails_booter.rb:76)
    at RUBY.(root)(<script>:1)

@mkristian do you know if this happens to get addressed on JRuby itself ?
seems to me that maybe if the path(s) had a jar:// prefix added it would work (not sure why it's not there seems to be that it used to be there), but even without it it should be detectable ... since there's a !/ in the path although that might be a bit "risky"
p.s. used bug-demo.war from https://github.com/mmc1ntyre/bug-demo just replaced the jruby-rack.jar

@mkristian
JRuby Team member
@kares
JRuby Team member
kares commented Mar 21, 2014

Thanks Kristian, that is great to know but our users likely do not now about those details thus would be great to provide them with an "out-of-the-box experience" ... instead of, you know, a "Java-EE experience" it is configurable just copy that here and there :) ... so maybe this should than go with Warbler to introduce an option of packing gems into WEB-INF/classes (I do not like that but if it works it's better than failing) ?

@mkristian
JRuby Team member

well, I try to also look at how to setup a servlet which uses JRuby's ScriptingContainer and gems. there it is easier if you do not need to worry about how to setup the ENV['GEM_PATH'] and that is how I personally pack executable jars using ScriptingContainer and gems. and to run junit-tests I just need to make sure rubygems are on the classpath.

let see what @jkutner says about the idea to add an alternative packing for warbler.

@kares
JRuby Team member
kares commented Mar 21, 2014

actually, (maybe) less of a need to. I was able to get WAS to boot a "little more" by hacking getRealPath (and related) in a more "smart-way" ... so for now it's only JRuby's load/require likely not handling WAS' "wsjar:" protocol :

after an expanded require 'wsjar:file:/opt/apps/wlp/usr/servers/defaultServer/dropins/bug-demo.war!/WEB-INF/config/boot.rb' I get (not sure why it removed .rb but I bet it's due "wsjar:")

Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- wsjar:file:/opt/apps/wlp/usr/servers/defaultServer/dropins/bug-demo.war!/WEB-INF/config/boot
    at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1085)
    at RUBY.require(classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55)
    at RUBY.load_environment(classpath:/jruby/rack/rails/environment3.rb:23)
    at RUBY.load_environment(classpath:/jruby/rack/rails_booter.rb:131)
    at RUBY.(root)(<script>:1)

should be noted that some File methods seem to work e.g. I got File.directory?("wsjar:file:/opt/apps/wlp/usr/servers/defaultServer/dropins/bug-demo.war!/WEB-INF") true ... while File.exist?("wsjar:file:/...") on files as well as dirs seems to always return false.

p.s. I was hoping you won't tell @jkutner ... he is a former IBM employee and he'll do anything to get their "Liberty Profile" working :) ... we're pretty much screwed here!

@mkristian
JRuby Team member
@kares
JRuby Team member
kares commented Jul 24, 2014

I've put out 1.1.15 (long time coming) where some of the "real-path" layout resolution is improved ...

@kares kares closed this Jul 24, 2014
@mkristian
JRuby Team member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.