Tomcat occassionally failing to start jruby runtimes

We have some java jar files that we are using for a saml implementation
within jruby 1.7.10 under tomcat 7. To suppress logging we have a
logback.xml file in webapp classes directory. When the logback.xml file
is
in place sometimes when starting tomcat when jruby runtimes are starting
up
we get:

[JRuby-Rack-App-Init-1] INFO jruby.rack - An exception happened during
JRuby-Rack startup

load error: kryptcore – java.lang.NoClassDefFoundError:
org/jruby/ext/krypt/KryptCoreService

— System

jruby 1.7.10 (1.9.3p392) 2014-01-09 c4ecd6b on Java HotSpot™ 64-Bit
Server VM 1.7.0_25-b15 [linux-amd64]

Time: 2014-01-22 19:20:44 +0000

Server: Apache Tomcat/7.0.42

jruby.home:
file:/usr/local/apache-tomcat/webapps/ROOT/WEB-INF/lib/gems-gems-jruby-jars-1.7.10-lib-jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home

— Context Init Parameters:

jruby.max.runtimes = 8

jruby.min.runtimes = 8

jruby.rack.error.app.path =

jruby.rack.logging = log4j

jruby.runtime.acquire.timeout = 10

public.root = /

rails.env = production

— Backtrace

LoadError: load error: kryptcore – java.lang.NoClassDefFoundError:
org/jruby/ext/krypt/KryptCoreService

require at org/jruby/RubyKernel.java:1083

(root) at
jar:file:/usr/local/apache-tomcat/webapps/ROOT/WEB-INF/lib/gems-gems-jruby-jars-1.7.10-lib-jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/shared/krypt-core.rb:37

require at org/jruby/RubyKernel.java:1083

(root) at
jar:file:/usr/local/apache-tomcat/webapps/ROOT/WEB-INF/lib/gems-gems-jruby-jars-1.7.10-lib-jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/shared/krypt.rb:1

require at org/jruby/RubyKernel.java:1083

(root) at
jar:file:/usr/local/apache-tomcat/webapps/ROOT/WEB-INF/lib/gems-gems-jruby-jars-1.7.10-lib-jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/shared/krypt.rb:43

require at org/jruby/RubyKernel.java:1083

(root) at
jar:file:/usr/local/apache-tomcat/webapps/ROOT/WEB-INF/lib/gems-gems-jruby-jars-1.7.10-lib-jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/shared/krypt/ossl.rb:1

 load at org/jruby/RubyKernel.java:1099

(root) at
jar:file:/usr/local/apache-tomcat/webapps/ROOT/WEB-INF/lib/gems-gems-jruby-jars-1.7.10-lib-jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/shared/krypt/ossl.rb:33

require at org/jruby/RubyKernel.java:1083

(root) at
/usr/local/tomcat/webapps/ROOT/WEB-INF/gems/gems/jruby-openssl-0.9.4/lib/jopenssl19/openssl.rb:1

require at org/jruby/RubyKernel.java:1083

(root) at
/usr/local/tomcat/webapps/ROOT/WEB-INF/gems/gems/jruby-openssl-0.9.4/lib/jopenssl19/openssl.rb:23

require at org/jruby/RubyKernel.java:1083

(root) at
/usr/local/tomcat/webapps/ROOT/WEB-INF/gems/gems/jruby-openssl-0.9.4/lib/jopenssl/load.rb:1

require at org/jruby/RubyKernel.java:1083

(root) at
/usr/local/tomcat/webapps/ROOT/WEB-INF/gems/gems/jruby-openssl-0.9.4/lib/jopenssl/load.rb:18

 each at org/jruby/RubyArray.java:1613

(root) at
/usr/local/tomcat/webapps/ROOT/WEB-INF/gems/gems/jruby-openssl-0.9.4/lib/openssl.rb:1

 each at org/jruby/RubyArray.java:1613

(root) at
/usr/local/tomcat/webapps/ROOT/WEB-INF/gems/gems/jruby-openssl-0.9.4/lib/openssl.rb:1

(root) at
jar:file:/usr/local/apache-tomcat/webapps/ROOT/WEB-INF/lib/gems-gems-jruby-jars-1.7.10-lib-jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/1.9/net/https.rb:1

(root) at
jar:file:/usr/local/apache-tomcat/webapps/ROOT/WEB-INF/lib/gems-gems-jruby-jars-1.7.10-lib-jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/1.9/net/https.rb:22

require at org/jruby/RubyKernel.java:1083

(root) at
/usr/local/tomcat/webapps/ROOT/WEB-INF/gems/gems/wrest-1.5.0/lib/wrest.rb:1

require at org/jruby/RubyKernel.java:1083

(root) at
/usr/local/tomcat/webapps/ROOT/WEB-INF/gems/gems/wrest-1.5.0/lib/wrest.rb:10

(root) at
/usr/local/tomcat/webapps/ROOT/WEB-INF/gems/gems/bundler-1.5.1/lib/bundler/runtime.rb:1

require at
/usr/local/tomcat/webapps/ROOT/WEB-INF/gems/gems/bundler-1.5.1/lib/bundler/runtime.rb:76

We saw this before with jruby 1.7.8 while on our production servers.
Servers would randomly drop out. I thought it was because we were
using
the krypt-core gem so I’ve removed that and it actually seemed to be ok,
but now we are seeing the above again and I can’t seem to trace down
why.
I was wondering if it is a low memory issue but I have plenty of free
memory so thats not it. I can restart tomcat and it’ll be fine. If I
shut
it down and start it again it may or may not come up. We did not have
any
of these problem with 1.7.3. It is almost as if krypt-core that comes
with
jruby is sometimes not loading. Any ideas?

You haven’t explicitly enabled invokedynamic, have you? This sounds very
close to the NoClassDefFoundErrors generated by enabling invokedynamic
on too old of a JVM version.

Ben

We have but this is the version of java:

java version “1.7.0_25”

Java™ SE Runtime Environment (build 1.7.0_25-b15)

Java HotSpot™ 64-Bit Server VM (build 23.25-b01, mixed mode)

Actually let me correct this. I thought we had, but looks like someone
removed it. I’m putting it back.

With and without invokedynamic i still get the above error on and off.
I
cannot seem to consistently cause it to fail though. I’m at a loss as
to
what to look at for more information. It really sounds like
uninitialized constant Krypt::ASN1::BOOLEAN · Issue #1119 · jruby/jruby · GitHub because it also throws the
uninitialized
constant Krypt::ASN1::BOOLEAN error