0

I have an ear application deployed to liberty profile. And I also have OSGi bundles as product extensions (deployed in /wlp/usr/extension..)

In one of the OSGi bundles, it refers to classes in the xml.jar of jre runtime. (i.e org.apache.xpath.XPathParser or javax.xml.parsers.DocumentBuilderFactory). At run time, I encountered ClassNotFoundException when these parts of code invoked.

I tried to Import-Package of these classes in the OSGi's bundle MANIFEST file. But then my bundle will fail to load when liberty starts. Error in trace.log says that the imported package (i.e org.apache.xpath) is missing.

Is there a limitation on liberty side on the use of jre 's library? Any idea of what is wrong ?

Thank you very much.

Khue Vu
  • 3,112
  • 4
  • 37
  • 40
  • 2
    See the answer to [this question](http://stackoverflow.com/questions/23406448/error-after-converting-org-pbjar-library-to-osgi-bundle), they have the same problem. – Tassos Bassoukos May 02 '14 at 06:53

1 Answers1

0

Importing the packages in the bundle manifests is the right thing to do. The fact that the bundles don't start is the system's way of telling you early that there's a problem. You may need to explicitly include the Apache xpath libraries in your product extension, since Apache classes are not shipped in the JRE's xml.jar.

Holly Cummins
  • 10,767
  • 3
  • 23
  • 25
  • Thanks. I have checked that the org.apache.xpath classes are included in the xml.jar together with some other apache libraries like xerces. I tried to explicitly include the xml.jar, because of xerces (http://stackoverflow.com/questions/11677572/dealing-with-xerces-hell-in-java-maven) i have another exception. I will try getting the xpath jar and include it alone. Will update later – Khue Vu May 05 '14 at 02:51
  • Turn out that Liberty profile limits the access to those implementation specific classes by Apache and only allow access to JAXP classes. I was migrating the code which use the library specific classes, previously running on WAS without any problem. Explicitly add the xpath jar file help. – Khue Vu May 05 '14 at 14:48