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
JRuby Jar comuptation fails in OSGi environment #8217
Comments
Ah whoops. Different fish different recipe I guess (this change was so some things would continue to run within jruby-complete.jar) For some reason I thought we had some OSGi test. @glatuske Since you localized this would there be any chance you can make a PR since you also can test it? It sounds like you have an idea on a fix. |
@enebo I can try ;-) Just to get it right the idea of getJRubyJar() is to retrieve the location of the JAR file it self (e.g. /path/to/jruby.jar)? |
@glatuske yeah. In the comment I thought that this was only used with jruby-complete.jar. Looking a little more this is only used by jrubyCommand but that is used for classpath_launcher ... which I think is where you are calling this from? I feel like I am missing the path where OSGi requests this. Do you think the uri stripping is the main issue? The original fix was because on newer Java's our code for determining where jruby-complete.jar (and I guess for the OSGi case) stopped working. |
@enebo I have checked debugged new and old behaviour. The old code was also not working with OSGi, but did not throw an exception. The best way to get the JAR location in an OSGi environment would be: In my case that returns: The question is, if you are ok to add some OSGi specific code. As a quick fix for us would be sufficient to fix the java.nio.file.FileSystemNotFoundException, as we are not using JRuby command at all. Call Stacktrace from 9.4.7.0
|
@glatuske I think it is ok. I can see we compile against org.osgi already in org.jruby.embed.osgi which ends up in jruby.jar. So your change would be just recognize you are in an OSGi env and then use getBundle() as the replacement to determine the location. All the rest would just be the same more or less? If so I think that is fine. If not then you may be finding a rich vein of new problems. My wonderment at this point is this is for exec'ing a new JRuby process for executing a sub-Ruby command. OSGi I would wonder if this ever worked or is even something OSGi would want. It seems like the OSGi way would be to get another instance of the service which does Ruby and run that in there (It has been ~20 years since I used OSGi so I am rusty :) ). If this was not raising but giving a bad value for the location of the jar then it is possible no one has ever used the value being produced because they are not performing subspawns of Ruby....or this entire paragraph is wrong :) It is possible this is how it works for us (not that the service idea wouldn't also be some option for OSGi). |
@enebo I would recommend to just fetch the FileSystemNotFoundException and do nothing more on that. As you said, the OSGi way would be to use OSGi services; but I guess that's to realistic to change this easily. |
It seems I am running into this same issue when I run a compiled JRuby app as an Atlassian Jira OSGi plugin (Jruby 9.4.7.0, MacOS). Here is the stacktrace:
And as @glatuske mentioned, just fetching the |
Environment Information
Provide at least:
Expected Behavior
Actual Behavior
The text was updated successfully, but these errors were encountered: