-
Notifications
You must be signed in to change notification settings - Fork 1
Improper OSGi manifest #32
Comments
Reported by herr-herner |
Was assigned to snajper |
herr-herner said: Here is the solution. Can you please add it? webservices-osgi:pom.xml The packages com.sun.xml.xsom.* are exported by jaxb-osgi, but without any versions. The fix in the import statements allows OSGi to bind the optional package dependency to jaxb-osgi bundle. The dynamic package import of * is necessary, because we must load classes listed in the @webservice annotation at runtime, e.g. @webservice(endpointInterface = "webservice.TestWebService"). Otherwise, we get a ClassNotFoundException because the interfaces are not known in advance, so that the packages dependencies cannot be declared in form of import statements. |
snajper said: |
herr-herner said: Without the DynamicImport-Package statement, a web service containing e.g. @webservice(endpointInterface = "webservice.TestWebService") fails with a ClassNotFoundException because the package "webservice" is not visible to the classloader of webservices-osgi that you are using for loading the class. If you use another classloader, this will be possible. One way is to get the classloader of the class containing the annotation (that is acually the WebService implementation) and get the class from him. This classloader sees the class in OSGi because it is the classloader of the corresponding bundle. If you are willing to make some code adaptions, I would try to test it directly in my OSGi environment. My aim is to get a full working version of Metro in the OSGi world. |
herr-herner said: |
petr_dolezal said: Originally, we wrapped Metro and other problematic libraries in a single monolithic bundle. It was few years ago, when the OSGi support was weak for most libraries. However, although it works, this approach is not really viable, it has some limitations and brings other problems. Therefore we were separating the bundled parts from the monolithic behemoth step after step, as the upgrades of the libraries allowed. The remaining part now is basically the web-related stuff and Metro is the the major reason why we were not able to finish the separation so far. Now we need to upgrade a part of our dreadful monolith, so we attempted again to break its hard core and finally get rid of it. My setup starts from quite small core based on Equinox (Mars) with basic Jetty 9 parts, running on JRE 8. Then I tried to add Metro and it began. It seems that Metro requires really many other bundles, which are often difficult to find. Some of imported packages (even not optional!) look very dubious: I really don't understand why a WS framework requires javax.mail (just one example) or why a web service client application running in an OSGi container must provide the Servlet API. I have the suspicion that the release might be tried with Glassfish, where it perhaps works fine, because Glassfish is capable of providing all those dependencies, although that are not usually needed. But for other, more light-weight containers these dependencies provide a very difficult obstacle. OK, my humble request calls for adapting Metro, so that it can be deployed easily into a generic OSGi container that provides minimal, but sufficient support for running a web service or for acting as a web service client. My situation can be replicated easily. Although we use Equinox as the OSGi container, any other comparable container can be used; e.g., Felix is very easy to use. Just download the container and supply following bundles. And then try to make even the Metro bundles resolved/active. Being desperate, I started to mark some imports as optional and even then it took non-trivial effort to make it start at least. Here is the set of bundles that I start with, webservices-osgi.jar is the only troublemaker then: // Bundle list: bundle symbolic name, version, file name // Jetty // Web Services |
This issue was imported from java.net JIRA METRO-32 |
I am using the OSGi version of Metro in version 2.3.1, but I cannot create an OSGi runtime environment so that all package dependencies get fulfilled. I have a minimum standalone runtime (without OSGi) using:
jetty:9.2.10.v20150310, stax:1.7.7, gmbal:4.0.0.b001, management-api:3.2.1.b002, pfl-tf:4.0.0.b004, pfl-basic:4.0.0.b004, ha-api:3.1.9, javax.servlet-api:3.1.0.
Everything is working fine, but in OSGi I have tried to fulfill all package dependencies, but there is no way of getting Metro working. Some packages are not available on the OSGi package layer by third party bundles and some come directly from the underlying JRE. I think that the manifest file must be fixed to get a working version of Metro in OSGi and make all packages optional that are not required by Metro.
That's a hard blocker for me and hopefully there is an OSGi expert available that can help me getting Metro running under OSGi.
The text was updated successfully, but these errors were encountered: