-
Notifications
You must be signed in to change notification settings - Fork 40
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
Unable to use in OSGi container #4
Comments
This is kind of weird, as I'm using |
I have created a simple OSGi bundle that uses your library and demonstrates the errors (both for marshal and unmarshal) - https://github.com/apiticas/ph-ubl-osgi-client. Instructions for install and use are in the README. |
Thanks a lot - I'm investigating... |
This guy had the same problem: http://blog.kusandriadi.com/problem-using-jaxb-marshallingunmarshalling-within-osgi-container/ - I will also investigate respective changes in ph-commons |
Yes, it seems that either by passing the class instead of the package name, or the package name together with a bundle classloader to the JAXBContext newInstance method, the marshalling succeeds: |
Thanks a lot for testing this out. I already modified the ph-commons API but unfortunately this makes caching a bit more difficult. As soon as I release 6.0.1 I can provide a ph-ubl* 4.0.0-RC1 version for testing (hopefully tomorrow). And when using ph-ubl with OSGI I noticed that it always requires ph-ubl20 and ph-ubl21. I will therefore modify the API so that there is a generic "ph-ubl-api" project and the main content is only in the ph-ubl20 or ph-ubl21 projects. The "ph-ubl" project will therefore be eliminated. |
I will test the RC1 with my application as soon as you provide it. |
Regarding the second problem:
It is a classloader issue as well.
without specifying the classpath:
|
I'm already doing this locally, but there is a follow-up error ClassPathResource.getInpuStream if a ClassLoader is specified - you see that may ClassLoader experience is growing heavily these days ;-) |
With my local modifications I'm a step further:
One difference was to use Update: this means that resource resolving in SAX still fails - work in progress |
I'm still trying to figure out what the problem is and I'm stil stuck with the XML resource resolving. I finally managed to get all paths and ClassLoaders right, but Felix debug states e.g.
So probably just joining URLs is not enough. E.g. http://stackoverflow.com/questions/6474634/how-do-i-access-a-file-inside-an-osgi-bundle suggests to use Maybe a special |
Now I added a special LSResourceResolver but struggeling how I make it available in a nice way. |
Ok, thanks. |
Finally the trunk versions (ph-commons 6.0.2-SNAPSHOT and ph-ubl21 4.0.0-SNAPSHOT) can handle the issue. It was basically a problem in the SimpleLSResourceResolver that was handling base URLs with a filename (like ".../ApplicationResponse.xsd") and a relative system URL incorrectly. This has now been fixed. There is now one little incident open so that the namespace mapper (mapping prefix to namespace URL) does not yet work:
|
Pleas try ph-commons 6.1.0, ph-jaxb 6.1.0 and the ph-ubl 4.0.0-RC2 artefacts. |
ph-ubl 4.0.0 is out... |
Thanks a lot! |
Hello!
Can the library be used in OSGi containers? (like Apache Felix or Apache Karaf)
I noticed the libraries are bundled so I tried using the read/write/marshal utils in a project that runs on Karaf.
The following exception was thrown when the JAXB Context was created:
What may cause this is described here
Thanks!
The text was updated successfully, but these errors were encountered: