Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal rails 6.1.1 application fails in tomcat with jruby 9.3.3.0 #7096

Open
jlahtinen opened this issue Feb 14, 2022 · 1 comment
Open

Comments

@jlahtinen
Copy link
Contributor

Environment Information

  • JRuby version (jruby -v) and command line (flags, JRUBY_OPTS, etc)
  • Operating system and platform (e.g. uname -a)

jruby 9.3.3.0 (2.6.8) 2022-02-08 b26de1f5c5 OpenJDK 64-Bit Server VM 25.322-b06 on 1.8.0_322-b06 +jit [linux-x86_64]
Linux name 3.10.0-1160.31.1.el7.x86_64 #1 SMP Wed May 26 20:18:08 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
unmodified https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.75/bin/apache-tomcat-8.5.75.zip
unmodified rails application created with rails new minimal --minimal
rails version 6.1.1

made war file using bundle exec warble. Moved minimal.war to unmodifed tomcat installation under /webapps. curled page http://localhost:8080/minimal.

Before bundle exec warble works. One workaround has to be made 😓. jruby/warbler#508

Making working war file for tomcat needs 2 modifications to META-INF/init.rb 😓 😓

  • modify line ENV['RAILS_ENV'] ||= ENV_JAVA[ 'RAILS_ENV' ] || 'No value for 'env' found' to ENV['RAILS_ENV'] ||= ENV_JAVA[ 'RAILS_ENV' ] || 'production'
  • add line Gem.paths = ENV before line require 'bundler/shared_helpers'

Expected Behavior

Rails root page should be visible

Actual Behavior

11-Feb-2022 15:03:27.332 SEVERE [http-nio-8080-exec-6] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [default] in context with path [/minimal] threw exception [Filter execution threw an exception] with root cause
        java.lang.LinkageError: loader constraint violation: when resolving method "org.jruby.runtime.Helpers.constructRubyStringArray(Lorg/jruby/RubyString;Lorg/jruby/RubyString;Lorg/jruby/RubyString;)[Lorg/jruby/RubyString;" the class loader (instance of <bootloader>) of the current class, java/lang/Object, and the class loader (instance of org/apache/catalina/loader/ParallelWebappClassLoader) for the method's defining class, org/jruby/runtime/Helpers, have different Class objects for the type org/jruby/RubyString used in the signature
@jimtng
Copy link
Contributor

jimtng commented Feb 26, 2022

I'm experiencing a similar issue:

Caused by: java.lang.LinkageError: loader constraint violation: when resolving method 'org.jruby.RubyString[] org.jruby.runtime.Helpers.constructRubyStringArray(org.jruby.RubyString, org.jruby.RubyString, org.jruby.RubyString)' the class loader 'bootstrap' of the current class, java/lang/Object, and the class loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @3b354d05 for the method's defining class, org/jruby/runtime/Helpers, have different Class objects for the type org/jruby/RubyString used in the signature (java.lang.Object is in module java.base of loader 'bootstrap'; org.jruby.runtime.Helpers is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @3b354d05, parent loader java.net.URLClassLoader @9a7504c)
        at java.lang.invoke.MethodHandleNatives.resolve(Native Method) ~[?:?]
        at java.lang.invoke.MemberName$Factory.resolve(MemberName.java:1070) ~[?:?]
        at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:1098) ~[?:?]
        at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:2030) ~[?:?]
        at java.lang.invoke.MethodHandles$Lookup.findStatic(MethodHandles.java:1102) ~[?:?]

jruby 9.3.3.0 embedded in an osgi bundle, Java 11. The issue doesn't happen when I started the whole application. It only happens when I updated the bundle to a newer version, triggering a bundle reload, which eventually leads to this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants