-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
A little confused about how JRuby jar loading works #4628
Comments
yes it is. would be a bit difficult and confusing to change the CP in the system.
maybe in a .war scenario but otherwise JRuby has been using it JRubyClassLoader for a long time ... if you move the log4j.jar on the 'normal' Java CP and not require/load the .jar from JRuby you would be able to access the classes from both Java and JRuby ... and avoid all of the gotchas of duplicate classes. |
What is the 'normal' Java CP? I have tried setting Consider the following example, using the
|
@hydrogen18 java does not allow to add jars dynamically to the classloader which is associated with JRuby allows to add jars into the JRubyClassloader which has the other classloader as parent. having said this |
I am loading Apache Log4J using initializers in my Ruby on Rails project
Environment
Provide at least:
Expected Behavior
Using
require
orload
on a JAR file adds the classes to the currently running JVM.Actual Behavior
I'm not sure. They seem to be there but aren't? From Ruby code I can access the classes, but other Java code cannot access those classes
Based on the first line I get to the log4j classes from Ruby code just fine. If I go grab the JRuby class loader I get warnings about duplicate classes. Using
java.lang.Class.forName
gets meClassNotFoundException
.Is JRuby maintaining its own class loader that is separated out from the JVM's normal class loader? Historically it seemed that when I did
require somefile.jar
the classes in that JAR were accesible to all java code.The text was updated successfully, but these errors were encountered: