Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.5
-
Fix Version/s: JRuby 1.7.1
-
Component/s: Core Classes/Modules, Rails WAR Deployment
-
Labels:None
-
Environment:CentOS 5.5, Java 1.6
-
Number of attachments :
Description
Tomcat 7 parallel deployment indicates versioned WARs by placing a ##VERSION suffix on the WAR file, e.g, my-app##001.war. (http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Parallel_deployment)
When deploying a JRuby on Rails packaged with Warbler, this results in a RackInitializationException, the root cause of which is a MalformedURLException thrown from line 1146 of org.jruby.runtime.load.LoadService.java. The malformed url looks like "jar:file:/opt/apache-tomcat-7.0.23/webapps/my-app##001/WEB-INF/lib/jruby-rack-1.1.2.jar!/vendor/rack-1.3.6/rack.rb".
That this is a malformed URL can be verified by simply passing the string to the constructor of java.net.URL: it will throw a MalformedURLException. Everything after the sharp symbol is being interpreted as a fragment rather than part of the file path.
One possible solution is to escape the sharp signs in a file path using standard URL escaping. '##' becomes '%23%23'. Experimentation confirms that Java is capable of parsing and reading from the example URL given above when it is escaped in this way.
This may be easy to investigate and fix if we can reproduce it or you can provide more info. I was not sure how to set up Tomcat 7 to do this parallel deployment (I have not administered Tomcat in a long time). Can you help there? Alternatively, if you can provide full logs that show the error, it would give us a hint where to look.
And of course if you think you can just go ahead and fix it yourself in jruby-rack, that would be great too