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
Akka remoting does not work with Akka OSGi unless I copy its reference.conf file #18846
Comments
The activator is now derived from an akka base class. Added a test class. Unfortunately, there is currently a problem with akka-remoting together with akka-osgi: the reference.conf for remoting has to be copied, otherwise it is not found. See akka/akka#18846.
Are you using the BundleDelegatingClassLoader to start the ActorSystem? |
Hi @PhilAndrew, apologies for the delay in getting an answer to you here. I looked through your code and couldn't find any use of
I'm in the process of better documenting Thanks! Brian |
How do I use BundleDelegatingClassLoader? I don't see any documentation on how to use it or any sample code. :( |
@PhilAndrew It's easier to start with |
Thanks, I use OsgiActorSystemFactory in my code here: https://github.com/PhilAndrew/sbt-osgi-felix-akka-blueprint-camel/blob/master/src/main/scala/osgidemo/impl/AkkaBean.scala The code I have written works, but the main problem is the reference.conf which I manually merged and created from jar files. You can see other people have tried to merge reference.conf http://letitcrash.com/post/21025950392/howto-sbt-assembly-vs-referenceconf As I understand, reference.conf has multiple files in multiple jars, now when I'm in Akka in OSGi and I want to run my application, it wants to find reference.conf. So my current solution is just to get all the Akka jars, extract all reference.conf files and merge each one of them manually. I tried using BundleDelegatingClassLoader for this problem, it didn't seem to work for me, perhaps I don't understand its purpose. Is there some simple way I can change my code to run without the reference.conf file in resources directory? |
Did you see how What you are describing is what I have also done. If you want to have configuration packaged with the OSGi bundle that it serves, there's really no other good way to handle this. Typesafe Config is immutable and the only way to set the config for an |
This is a bit of a unfriendly barrier to using Akka within OSGi. |
@PhilAndrew OSGi does not have enough traction to keep the greater team focused on it's benefits. There are no incentives for the team to learn OSGi and solve these kinds of issues because they don't see the value in OSGi for their own projects. We can't judge others on their lack of need. I'd be happy to work with you on finding a solution to the problem, but I ran out of time to keep pushing on this myself. Would you like to contribute on a branch and work together on it? |
Thanks for the offer of help, for me its just mostly a barrier to a destination. I just want to use Akka within OSGi in a nice way and then move on. Then added some code as you suggested PhilAndrew/sbt-osgi-felix-akka-blueprint-camel@4920e15 Are you then suggesting I do something in OSGi to get a bundle, then get a resource from the bundle and then merge the 3 resource.conf in memory? eg val resources = bundle.getResources(name) I see I get a org.apache.felix.framework.util.CompoundEnumeration back. |
Yes, it would be great if things just worked. I put a fair bit of time into getting the manifests and build cleaned up. There's only so much time in the day. I'll check on your other questions shortly. |
Your correct! with my last commit it no longer needs reference.conf. Also I don't need to merge the files, I get all the bundles from the bundle context and get all the urls and return them. So refer to latest version of my github https://github.com/PhilAndrew/sbt-osgi-felix-akka-blueprint-camel Then, really this type of code should be in Akka OSGi? The code is just short and in the util folder. https://github.com/PhilAndrew/sbt-osgi-felix-akka-blueprint-camel/tree/master/src/main/scala/osgidemo/impl/util |
I haven't had a chance to look at your code, but I'd assume if you're having better luck, that's a good sign. If you'd like me to take a look at a PR for Akka, I'm happy to review. |
I find that changing only one method on this class BundleDelegatingClassLoader.scala, change findTransitiveBundles to the following, makes it work.
Since I don't understand what this method is trying to achieve, I'll try to work out what this method is trying to do. I read from another ticket "findTransitiveBundles method returns a list of bundles to use when loading classes specified in the configuration" - #13977 I also worry that with bundles coming and going, shouldn't it try all bundles loaded when the resource is requested? |
Sleuthing. I tried to track down how this method came to exist. In https://github.com/costamojan/xbean/commit/2216fe66f0dfca6bd217ed450baaa523a682b4eb there is |
Obsolete, see #28304 |
I am trying to use Akka remoting with Akka OSGi.
Example project
https://github.com/PhilAndrew/sbt-osgi-felix-akka-blueprint-camel/tree/136f8af2a40eea8ce2c8aae066cbb08f94559c19
The example project can be used to test this problem.
This does not work, it says:
I believe it should work, if I want it to work I have to copy the reference.conf file out of this Akka Remoting jar and put it in resources folder, that is a workaround for the problem, I should not have to do a workaround like this for Akka Remoting in OSGi to work.
The text was updated successfully, but these errors were encountered: