Expand my Community achievements bar.

java.lang.NoClassDefFoundError exception while using iText library

Avatar

Level 1

Hi all,

I'm using in my servlet code 3rd party library to dynamically generate PDFs (iText). The library have dependancies on the org.xml.sax package. Here is the relevant stack fragment:

.....

Caused by: java.lang.ClassNotFoundException: org.xml.sax.SAXException not found by iText [384]
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1499)
        at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1882)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 82 more

 

....

 

The System Bundle seems to be Exporting those packages.

I do also import (correctly IMO) all the packages in the bundle that contains my servlet:

<plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>2.0.1</version> <extensions>true</extensions> <configuration> <instructions> <Import-Package> org.osgi.framework, org.w3c.dom, org.xml.sax, org.xml.sax.ext, org.xml.sax.helpers, *;resolution:=optional </Import-Package> <Export-Package> ${export.package}.* </Export-Package> <!-- <Embed-Dependency>${embed.dependency}</Embed-Dependency> --> <!--Require-Bundle>org.springframework.beans, org.springframework.core, org.springframework.integration,org.springframework.context </Require-Bundle--> </instructions> </configuration> </plugin>

Any suggestions where I possibly go wrong.

Thanks for your help.

 

-Nick

0 Replies