We'd like to deploy multiple instances of the same Rails application within a single Tomcat container using jruby-rack.
The first instance comes up fine, but the second one fails:
INFO: Deploying web application directory app1
...
INFO: Deploying web application directory app2
Apr 10, 2017 4:48:25 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Apr 10, 2017 4:48:25 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/app2] startup failed due to previous errors
Apr 10, 2017 4:48:25 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
What solves the issue is increasing jruby.max.runtimes
in the web.xml
of app2
to 2
. But if I get this parameter right, this means that two of the jRuby 'processes' could be spawned within one instance - which is not what we want and would prevent the application from working properly. What we need is two independent 'processes', one for each instance we deployed.
Is this possible and is setting jruby.max.runtimes
the correct solution?
It looks like this was a jRuby issue and the problem was fixed in 9.1.8.0. We can't reproduce the problem anymore.