EJB ETL NoClassDefFoundError: org.apache.poi.util.SAXHelper during runtime

1.3k Views Asked by At

Root pom has the following dependencies,

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.16</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.16</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
            <version>3.16</version>
        </dependency>

But during runtime, during etl process following error occurs,

EJB threw an unexpected (non-declared) exception during invocation of method "****" on bean "BeanId(***-ear#***-ejb.jar#***ServiceImpl, null)". Exception data: java.lang.NoClassDefFoundError: org.apache.poi.util.SAXHelper

Root cause is NoClassDefFoundError in the following code snippet,

XMLReader parser = SAXHelper.newXMLReader();

Environment used,

JDK 1.6.0_35
Websphere Application Server v8.0
Eclipse Juno Service Release 2 

Full stack trace can be found here

Caused by: java.lang.ClassNotFoundException: org.apache.poi.util.SAXHelper
    at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
    at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:230)
    at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:703)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:682)
    at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:123)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:665)
    at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
    at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
    at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:566)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:665)
    ... 87 more

note: I have opened the ear archive and found the respective jars available. Checked Eclipse java build path also. Everything seems to be fine.

Thanks.

1

There are 1 best solutions below

3
PJ Fanning On

SAXHelper is in poi-ooxml-3.16.jar. I suspect that one of the static initializers in this class is failing. https://github.com/apache/poi/blob/trunk/src/ooxml/java/org/apache/poi/util/SAXHelper.java