Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

java.lang.NoClassDefFoundError exception while using iText library

nick_popov1
Level 1
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