On 4/5/10 11:10 AM, Dan H wrote: > >> >> >> On 4/4/10 8:01 PM, Dan H wrote: >>> Has anyone managed to embed Hibernate within their bundle using Maven >>> and maven-bundle-plugin? I'm getting errors that seem to be the result >>> of bad manifest "Import-Package" sections: >>> >>> ---- >>> ERROR: Error starting file:/C:/dev/felix/bundle/kurt-handler-a-1.0.0.jar >>> (org.osgi.framework.BundleException: Unresolved >>> constraint in bundle de.huss.kurt-handler-a [2]: package; >>> (package=com.sun.jdmk.comm)) >>> org.osgi.framework.BundleException: Unresolved constraint in bundle >>> de.huss.kurt-handler-a [2]: package; (package=com.su >>> n.jdmk.comm) >>> at >>> org.apache.felix.framework.Felix.resolveBundle(Felix.java:3295) >>> at org.apache.felix.framework.Felix.startBundle(Felix.java:1653) >>> at >>> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1124) >>> at >>> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264) >>> at java.lang.Thread.run(Thread.java:619) >>> ---- >>> >>> There is a lot of guesswork involved, but I think that the bundle plugin >>> does not handle the<exclusions> node of a dependency and adds a package >>> import to the manifest anyway. It also seems possible to me that the >>> bundle plugin is adding imports for dependencies that are flagged as >>> optional. I've attached the pom.xml and the generated manifest for those >>> who care. >>> >> >> Well, if you don't need that package, try adding this to the >> maven-bundle-plugin configuration: >> >> <Import-Package>!com.sun.jdmk.*,*</Import-Package> >> >> This will exclude jdmk and all subpackages from your imports, but still >> import everything else. >> > Yeah, that's what I did for the first four imports: jdmk, javassist, > org.jaxen.pattern, org.apache.commons.logging, etc. etc. > > However, I realized that this trial&error approach throws us back to > manual (non-)dependency management: having to make a list of all things > that we *don't* want to be imported doesn't really solve the problem. It's ultimately very difficult, if not impossible, for someone repackaging a JAR to know what imports are required and which are optional.
AFAIK, commons-logging is required for Hibernate as is javassist. Take a look at the manifest of the SpringSource packaged Hibernate: http://www.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.hibernate&version=3.2.6.ga > > Well, instead of crying in your face I'm going to try make myself > useful. I'll take a look at the plugin code. Perhaps I can hack > something in that makes this fantastic plugin it do its job as > advertised :-) Best of luck, but I think your time would be better spent articulating to the Hibernate team why they need to provide proper OSGi bundles. The plugin can be improved for sure, but you shouldn't need to embed Hibernate in your bundle in the first place IMHO. Justin > > To those who found this email when googling "Maven Hibernate OSGi" or > something like that: if I ever find a solution, I'll make sure to post > it here. > > -Dan > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

