-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
Reopen java.net.MalformedURLException in executable jar with OSGi Connect (Atomos) #6245
Comments
Found the problem and a fix. In aQuite.launcher.Launcher.java in lines 909..911 there is a check for JRT protocol
This check needs to be commented out like above or also allow "jar:" protocol (simple comment seems to work for both embedded and normal eclipse launch). The problem is that in embedded case the internal bundle location is just a path within the executable jar like /jar/bundle.jar without any protocol hence java.net.MalformedURLException: no protocol exception. Correct URL, however, is already generated in lines 905..906 as a resource URL
in the form jar:file:/executable.jar!/jar/bundle.jar, i.e. with correct protocol "jar:file:/". If you pass this as a location into context.installBundle(path) bundle jar is read from executable jar correctly. Now the problem is how to build biz.aQute.launcher-full,jar with modified file. Tried to add modified sources to my maven project, but got a whole bunch of missing dependencies and weird compilation errors (e.g. aQute.lib.collections.SortedList implements both List and SortedSet interfaces which have incompatible reversed() methods). I did not spend much time figuring this out and simply collected all dependencies, compiled modified Launcher.java and patched the existing jar. Everything worked after that. It would be nice if somebody explained how to correctly build biz.aQute.launcher.jar with correct Launcher and including aQute.bnd.build package without resorting to hacks and patches. Thanks in advance |
If I understood everything correctly, you have a customized Launcher and want to know how to use this launcher in your exported jar right? In that case you can simply copy the whole bnd launcher project, rename it a bit, do your fix and let bnd build it. Then you have to put the bundle with your launcher in it on the |
I will close the issue, given my comment above. If you have the feeling, that my answer is not what you wanted feel free to reopen this issue. |
OK, Obviously I was not clear of what I want.
Apparently aQute.bnd.build package must be included in the launcher jar as, apparently, it must be able to build connector before any other bundles are loaded.
In a meanwhile I'd also like you to explain to me how to build launcher jar from sources.
Second I've tried to copy the whole repo and run the same command from within biz.aQute.launcher folder. I've got the following output:
and generated biz.aQute.launcher.jar is empty. |
How do I reopen the issue? It looks like I am not allowed. |
Did you tried co checkout this project, fix as you expect and test if then still everything works, and then do a PR? |
As I've mentioned earlier, I don't know how to build the project. After the build the resulting jar is empty. I can try if you provide instructions on how to build. |
Have you tried the build instructions here? |
Found an old issue (java.net.MalformedURLException in executable jar with OSGi Connect (Atomos)) which was closed without positive solution, I guess. Now I have the same problem in the same situation:
Everything works from eclipse. Executable jar fails with the above exception. Here is the content of .bndrun file:
As you can see I have
so launcher can start framework with connector. I had to repackage biz.aQute.launcher into biz.aQute.launcher-full to include aQute.bnd.build package which seem to be required to build the connector. With default launcher I'm getting the following error at startup:
It does work eventially even with this error due to framework refresh at some point (so bundles get rewired), I guess, but I can't stand having exception as a first thing in the log.
The whole excersise is to allow running python code in OSGi environment via graalvm polyglot. With graal v23.1.1 I used to just build polyglot bundle and disable classpath isolation, but with the latest v24.0.2 polyglot only works from module path hence the necessity to use atomos. It works nicely when run from eclipse.
Now how do I make it work from executable jar? What am I doing wrong here?
The text was updated successfully, but these errors were encountered: