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

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.

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

Related

how to add jsf com.sun.faces in websphere 9

I want to start my app using com.sun.faces jsf and primefaces dependency in websphere 9.
The part of pox.xml:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.13</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.13</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.2</version>
</dependency>
I added jsf-impl-2.2.8-30.jar and jsf-api-2.2.8-30.jar to shared libs in WebSphere (Enterprise Applications > app_name > Shared library references, for application and for module) and got exception in log:
Could not invoke an operation on object: WebSphere:name=ApplicationManager,process=server1,platform=proxy,node=OPOLSKYNode01,version=9.0.0.9,type=ApplicationManager,mbeanIdentifier=ApplicationManager,cell=OPOLSKYNode01Cell,spec=1.0 because of an mbean exception: com.ibm.ws.exception.RuntimeError: java.lang.RuntimeException: com.ibm.ws.cdi.CDIRuntimeException: com.ibm.ws.cdi.CDIDeploymentRuntimeException: org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:
Exception 0 :
javax.enterprise.event.ObserverException
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
....
Caused by: java.util.ServiceConfigurationError: com.sun.faces.util.cdi11.CDIUtil: Provider com.sun.faces.util.cdi11.CDIUtilImpl not a subtype
...
Later I found that there was a warning written in websphere (Enterprise Applications > app_name > JSP and JSF options):
Version 9.0 and later nodes use the MyFaces JSF implementation, even if SunRI is selected in a mixed-cell environment. For more configuration information, read about JavaServer Faces in the product documentation.
And I tried to add a shared libraries with mojarra-jsf-impl-2.0.0-b04.jar and mojarra-jsf-api-2.0.0-b04.jar
but got:
com.ibm.ws.classloader.CompoundClassLoader#bce1c60f[war:isclite/isclite.war]
Local ClassPath: C:\Program Files\IBM\WebSphere\AppServer\systemApps\isclite.ear\isclite.war\WEB-INF\classes;C:\Program Files\IBM\WebSphere\AppServer\systemApps\isclite.ear\isclite.war\WEB-INF\lib\abdera.client.0.2.2-incubating.jar;C:\Program
...
00000093 annotations W ScannerContextImpl getInputDataForClass Class loader [
com.ibm.ws.classloader.CompoundClassLoader#2d433080[app:isclite]
Local ClassPath: C:\Program Files\IBM\WebSphere\AppServer\systemApps\isclite.ear\lib\batik-all.jar;C:\Program
...
Help me please!
Is it possible to start app with jsf dependency in websphere ?

Elasticsearch client java.lang.ExceptionInInitializerError in 5.3

Following code listed here on TransportClient.
Using elasticsearch and client dependencies.
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>5.3.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.3.0</version>
</dependency>
Exception:
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.elasticsearch.common.logging.DeprecationLogger.<clinit>(DeprecationLogger.java:138)
at org.elasticsearch.common.xcontent.support.AbstractXContentParser.<init>(AbstractXContentParser.java:57)
at org.elasticsearch.common.xcontent.json.JsonXContentParser.<init>(JsonXContentParser.java:44)
at org.elasticsearch.common.xcontent.json.JsonXContent.createParser(JsonXContent.java:103)
at org.elasticsearch.common.settings.Setting.parseableStringToList(Setting.java:832)
at org.elasticsearch.common.settings.Setting.lambda$listSetting$27(Setting.java:786)
at org.elasticsearch.common.settings.Setting.listSetting(Setting.java:791)
at org.elasticsearch.common.settings.Setting.listSetting(Setting.java:786)
at org.elasticsearch.common.network.NetworkService.<clinit>(NetworkService.java:50)
at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:98)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:126)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:268)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:125)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:111)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:101)
at xxx.test.runner.ESRunner.initESClient(ESRunner.java:120)
at xxx.test.runner.ESRunner.inti(ESRunner.java:62)
at xxx.test.runner.ESRunner.main(ESRunner.java:46)
Caused by: java.lang.IllegalStateException: Error finding the build shortHash. Stopping Elasticsearch now so it doesn't run in subtly broken ways. This is likely a build bug.
at org.elasticsearch.Build.<clinit>(Build.java:62)
... 18 more
Could it missing some dependency, or something else? Any help is appreciated. Thanks.
i had the same problem. use 5.2.2 instead. the problem is (at least for me) that the transportClient of 5.3 reads the manifest file of the jar which isn't possible because the application runs on wildfly (the jar file is on a virtual file system)

Maven compilation and run time error java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z on Tomcat 8 Server

I've been converting a large Java Web App to a maven project, but I've run into an error in a handful of classes originating from the tomcat-dbcp jar. I get the following error messages from any class that needs to use BasicDataSource objects:
javax.servlet.ServletException: java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z
java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z
Now I know this jar is present on the server (as it is default in our Tomcat8 installation). So in maven I declared this dependency as such:
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-dbcp</artifactId>
<version>8.0.26</version>
<scope>provided</scope>
</dependency>
But I'm still seeing this error. What can I do to eliminate this error?
This error did go away, though I have no idea why. The pom entry is still the same and still running on Tomcat 8. We did find a hacky temporary fix:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1</version>
<scope>system</scope>
<systemPath>${basedir}/lib/ojdbc7-12.1.0.1.jar</systemPath>
</dependency>
But we reverted back at some point and it is working fine.

Does JAXB work under Java 5?

Building with maven I get "package javax.xml.bind.annotation does not exist"
What do I need to make JAXB work with Java 5?
JAXB APIs are bundled in JDK1.6, but these are not available in JDK <1.6 (ex: JDK1.5).
I have a Java to XML code written in JDK1.6 and once I switched to JDK1.5, I got the following error:
*Exception in thread "main" java.lang.RuntimeException: javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
...
Caused by: javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]*
...
JDK1.5 doesnt contain the JAXB APIs and therefore I applied the following fix:
I used JDK1.5 and the following two JARS: jaxb-api-2.0.jar and jaxb-impl-2.0.jar in my classpath and the error was resolved.
I hope this helps.
Another Reference: http://www.mkyong.com/java/jaxb-hello-world-example/
You can download the reference implementation (RI) from http://jaxb.dev.java.net/.
I can't advise you on how to make it work with maven though - more trouble than it's worth, if you ask me.
Java6 included a slightly modified version of the RI, but the RI itself works just fine with Java5.
Using the following versions will work with JDK5:
<!--
versions after 2.2.4 requires jdk6, please refer
to https://java.net/jira/browse/JAXB-890
-->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.4-1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>javax.xml.soap</groupId>
<artifactId>saaj-api</artifactId>
<version>1.3.3</version>
</dependency>
It seems there are many versions and differing paths to get JAXB from a maven repository.
My best guess for the correct artifact is javax.xml.bind:jaxb-api:2.2
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2</version>
<scope>compile</scope>
</dependency>
Jaxb should work with Java 5 but it seems that there are more people having issues with it.
Could it be that are missing some jars?
Check out this forum post.

AbstractCreatorProcessor class not found error

While setting up adopt openjdk 8 with Tomcat 9 with my existing application, I am getting the following error
Caused by: java.lang.NoClassDefFoundError: com/sun/xml/stream/buffer/AbstractCreatorProcessor
at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:363)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:321)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:230)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:211)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:207)
at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:114)
at javax.xml.ws.Service.<init>(Service.java:77)
at javax.xml.ws.Service.create(Service.java:707)
at org.springframework.remoting.jaxws.LocalJaxWsServiceFactory.createJaxWsService(LocalJaxWsServiceFactory.java:162)
at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.prepare(JaxWsPortClientInterceptor.java:357)
at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.afterPropertiesSet(JaxWsPortClientInterceptor.java:339)
It was working fine with Oracle JDK, is there anything I am missing for openjdk?
For openjdk you need the JAX-WS dependency library streambuffer.jar.
You can download it from here or, if you use Maven:
<!-- https://mvnrepository.com/artifact/com.sun.xml.stream.buffer/streambuffer -->
<dependency>
<groupId>com.sun.xml.stream.buffer</groupId>
<artifactId>streambuffer</artifactId>
<version>1.5.6</version>
</dependency>

Categories

Resources