Open dschmitz opened 11 years ago
Hello,
What versions are you using?
Also, I don't know that much about OSGi, so the package restriction you mention is indeed a problem. Not sure how to fix it, though...
Latest development head. The fix is quite trivial either you rename the package scope of your core component to com.github.fge.jsonschema.core ... or you can fusion both components into a single component.
Hello,
Sorry for the long time lapse. I am only resuming work on the projects right now. I'll look into it more seiourly from now on.
Hi, I'm also having same problem. When I check the Manifest of "json-schema-validator" I see the following Import-Package entry:
com.github.fge;version="[1.1,2)"
Which causes the following error:
Unresolved constraint in bundle com.github.fge.json-schema-validator [316]: Unable to resolve 316.0: missing requirement [316.0] osgi.wiring.package; (&(osgi.wiring.package=com.github.fge)(version>=1.1.0)(!(version>=2.0.0)))
Uuh, where does that 316 come from?
@hmozaffari which version? I will release 2.2 soon and hope to steer clear out of this problem but I'll need help. I don't do OSGi and I do gradle, so a reproducible test case would help a lot! Like, for instance, a small github repository demonstrating the problem.
Thanks for quick response! 316 is the bundle Id. I'm using version 2.1.8 and I'm trying to deploy it to JBoss Fuse 6.1.0. The issue happens during deployment of "json-schema-validator" bundle. As dschmitz mentioned I believe the root cause is common packages between "json-schema-validator" and "json-schema-core". It made OSGI gradle plugin to produce wrong entries in manifest. I guess other than refactoring the packages overwriting the jar task may fix it. Something like code bellow:
jar { manifest { ... instruction 'Import-Package', 'com.github.fge;version="2.1.8"' } }
@hmozaffari I intend to release a 2.1.9 soon, would you be able to test it? I did move classes around in different packages, so maybe that will help (in -core, not -validator). That means though that you'd have to fix some code.
Note that generally speaking 2.1.x is a devel version... But 2.2 is around the corner, 2.1.x won't change much anymore.
@fge I will have a look at it and see whether the issue I have raised still exists expect some result from my side until tomorrow afternoon
OK, version 2.1.9 released. Should be available soon on Maven central.
@dschmitz and @hmozaffari let me know if this solves your problems! If no, I'll have another go at it...
@fge I still have same problem. I checked the manifest of "json-schema-validator" and have highlighted the sample entry that I believe is the root cause. The version of Jar is 2.1.9 but it only imports versions [1.1 to 2.0) of com.github.fge package which is already in same Jar file
Uuh, OK, so I must ask here.
What is a package as defined by OSGi? None of the dependencies of json-schema-validator have any classes in this package...
I'd appreciate if you could do a test for me... That is, only depend on -core (1.1.10) instead of -validator in your setup. In this case, do you have the same problem?
@fge OSGI packages are Java packages. I checked other projects which are separated into mutiple Jars/Bundles but share same package structure. Since they use same version in all bundles they don't face this issue. For example take a look at generated manifests of these bundles:
They all are in same version.
Well, I don't understand since I have no classes at all in com.github.fge?
Is it possible for you to obtain a list of conflcts, if any? I am afraid I am missing something fundamental here...
As a work around I included the libraries in my classpath and instide my Jar, it didn't use OSGI instructions in manifest and managed to deploy it. But obviously that's not the fundamental fix.
As a side activity and as an experiment I rebuilt "json-schema-validator" and "json-schema-core" with same version number and still got the same error message.
I scanned all the dependencies and noticed btf project has some classes directly inside "com.github.fge" package: https://github.com/fge/btf/tree/master/src/main/java/com/github/fge
I suspect refactoring those classes and moving them to a sub-package will resolve the ambiguity.
@hmozaffari I fail to see how the fact that this package has classes within com.github.fge can cause a problem since it is the only package in dependencies which has?
Hi all, FYI I just created issue #111 to get json-schema-validator as a ready to use OSGi bundle. Maybe too close to this issue but..
Hi,
json-schema-validator and json-schema-core share for some packages the same scope / name. This is not allowed in OSGi as package names have to be unique per bundle. If I throw in the bundles of json-schema-validator and json-schema-core OSGi is not able to load the stuff as there can only be one package scope at a time not two or more from different bundles.
Affected packages are:
com.github.fge.jsonschema.exceptions com.github.fge .jsonschema.keyword com.github.fge .jsonschema.messages com.github.fge .jsonschema.processors
The solution would be either make one bundle / jar out of both components or to distinguish scope e.g. com.github.fge.jsonschema.core.exceptions
Regards David