-
Notifications
You must be signed in to change notification settings - Fork 968
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
com.typesafe.config.impl.SerializedConfigValue should be exported in OSGi manifest #49
Comments
AFAIK this was already fixed in later versions of Typesafe Config, just exclude the Akka Typesafe Config dependency and add your own. Does that fix the issue? |
Assuming that you're on Akka 2.0.4 (which is the latest release for 2.0) |
Hi Viktor and thank you for the quick response. Yes i'm on 2.0.4. I can't exclude the dependency on Config as it is very useful and used by other components of the application as well. For now i just changed the Manifest of the Config so that the class in question is exported as well, but i think it could be the issue for somebody else. Thanks again |
But why does OSGi need internal implementation details to be exported? That seems buggy to me. |
Java serialization is just full of hacks. We use the writeReplace() mechanism to provide an internal object to be serialized rather than the original object. Normally, serialization doesn't care that the replacement object has a private class, but with OSGi the class loader actively blocks loading the private class I guess, so the Java deserializer can't load it to call readExternal(). Putting the internal class in the manifest does sound like the only solution, though I don't really understand OSGi in much detail. Hopefully there's a way to export just the one class and not the whole "impl" package. |
Basically, all classes that are needed to construct (or clone or deserialize) an object must be available for the class loader. In OSGi some class is available if it's package is exported by some bundle (with respect to the version information). If some package declared private, it is available only for the declaring bundle. I would say that if an application relies on the serialised form of something, than this serialised form should be considered to be a part of the API. Yes, i think there is no need to export full package. I'd export the serialised form only. For example, by moving this class from the "impl" package. This will work but it will also create another issue with cyclic package dependencies :) |
I'm not sure what the actual appropriate change in the typesafe config code is; I've never dealt with OSGi. I would like to keep this class "as private as possible" while still keeping OSGi working. I might need a patch or at least a description of the changes. |
What about moving |
If default access would work that sounds fine, but renaming the class would break serialization back-compat, which could cause akka upgrade problems (I think? I know we've discussed it). In retrospect, a class name which appears in the serialization probably should not have had "impl" in it. Ugh. |
Where I currently have |
No huge downside - just what you already listed. The package has |
Now the com.typesafe.config.impl package is defined as private, which prevents akka 2.0 from working in remote scenarios with remote deployment. The reason for this is that the
com.typesafe.config.impl.SerializedConfigValue
class is not available for theakka.remote.MessageSerializer
:Thanks for looking into this!
The text was updated successfully, but these errors were encountered: