POI 3.17 is not working on weblogic server - java

Good day,
I tried to use POI in my application to load excel sheet.
everything is working fine on local tomcat but when I move it to server WebLogic 12.2 that run on Java 8, I got an error as follow.
I tried all versions from POI 3.8 to 3.17(latest) but none of them is working correctly on the server.
Error checking for java lib
java.lang.ExceptionInInitializerError
at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:161)
at org.apache.poi.openxml4j.opc.OPCPackage.(OPCPackage.java:141)
at org.apache.poi.openxml4j.opc.ZipPackage.(ZipPackage.java:97)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324)
at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassCastException:
com.ctc.wstx.stax.WstxEventFactory cannot be cast to
javax.xml.stream.XMLEventFactory
at javax.xml.stream.XMLEventFactory.newInstance(XMLEventFactory.java:30)
at org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.(PackagePropertiesMarshaller.java:41)
at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:161)
at org.apache.poi.openxml4j.opc.OPCPackage.(OPCPackage.java:141)
at org.apache.poi.openxml4j.opc.ZipPackage.(ZipPackage.java:97)
Truncated. see log file for complete stacktrace
commons-codec-1.11
commons-collections4-4.1
commons-logging-1.2
junit-4.12
poi-3.17
poi-excelant-3.17
poi-ooxml-3.17
poi-ooxml-schemas-3.17
poi-scratchpad-3.17
xmlbeans-2.6.0
what could be missed?
Note: I cannot use Maven or similer technologies.
thanks

We found one jar file causes the issue. the name is jsr173_api.jar. once this is deleted, all works fine.

Related

java.lang.NoClassDefFoundError: oracle/dms/console/DMSConsole

My OS = CentOS-7
Oracle 18.4 XE
Java 8 JDK + Tomcat 8
I facing the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/dms/console/DMSConsole
at oracle.jdbc.driver.DMSFactory.<clinit>(DMSFactory.java:46)
at oracle.jdbc.driver.PhysicalConnection.createDMSSensors(PhysicalConnection.java:1713)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:849)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:443)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:712)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at Test.main(Test.java:9)
Caused by: java.lang.ClassNotFoundException: oracle.dms.console.DMSConsole
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 9 more
I searched a lot but was unable to find any forum where I can see aforementioned error related to oracle 18.4.0.
I searched my whole server even unzipped all ojdbc*.jar but not found DMSConsole anywhere
I removed all previous jdbc jar drivers and downloaded latest ojdbc8-full.tar.gz driver form this LINK but nothing fixed the problem
Best Regards
What are you trying to do? If you are planning to use dms jar then you should use
ojdbc8dms.jar. Check out the question "What are the different JAR files on the 19.3 JDBC driver download page for?" in JDBC FAQ
You can get these jars from maven. Check out the blog for details. You can also download these from ojdbc8-debug.tar.gz from OTN. Make sure to have dms.jar in the classpath.
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8dms</artifactId>
<version>19.6.0.0</version>
This can be solved by adding a correct dms.jar but when not detailled log is needed the following jars are the minimum to include
ojdbc8.jar
orai18n.jar

Apache Tika ArchiveStreamFactory.detect error

I'm using java with apache tika 1.18 to convert some files to TXT.
When I try to use the AutoDetectParser(), I'm getting the error :
[ERROR ] Error occurred during error handling, give up!
org.apache.commons.compress.archivers.ArchiveStreamFactory.detect(Ljava/io/InputStream;)Ljava/lang/String;
[ERROR ] SRVE0777E: Exception thrown by application class 'org.apache.cxf.service.invoker.AbstractInvoker.createFault:162'
org.apache.cxf.interceptor.Fault: org.apache.commons.compress.archivers.ArchiveStreamFactory.detect(Ljava/io/InputStream;)Ljava/lang/String;
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
at [internal classes]
Caused by: java.lang.NoSuchMethodError: org.apache.commons.compress.archivers.ArchiveStreamFactory.detect(Ljava/io/InputStream;)Ljava/lang/String;
I was dinging on internet and found this error related wrong version of commom_compress, appears this method doesn't exist in versions previous of 1.14 of commom_compress. In my case the version is 1.16.1.
After build the project, I checked the libs inside and there is only the correct version.
I'm using IBM Liberty 18.0 ... and now I'm really lost about options to solve this problem.
When I use the specific parser, like PDFParser(), everything works fine!
Any ideas?
Thanks
Source of the issue:
Spark 2.x distributions include old versions of commons-compress, while Tika library depends on version 1.18 of commons-compress library.
Solution
Use --driver-class-path argument in your spark-shell or spark-submit to point to a the right version of commons-compress library.
spark-submit
--driver-class-path ~/.m2/repository/org/apache/commons/commons-compress/1.18/commons-compress-1.18.jar
--class {you.main.class}
....
Check my detailed answer here.

Tomcat not running for a JAR file

I am using Postman alongside a JAR file that runs a REST service that holds some contacts. However when I try to run the JAR file by using: java -jar ContactListRESTService.jar in Powershell, I am seeing a bunch of errors that Apache Tomcat could not run. Postman also doesn't recognize the localhost.
Caused by: java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:159)
Caused by: java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletCntainer.java:159) ~[spring-boot 1.3.7.RELEASE.jar!/:1.3.7.RELEASE]
I have tried uninstalling and reinstalling JAVA SE per some guidance from a mentor with no results.
If anyone can point me in the right direction please.

Java NoSuchMethodError when connecting via JDBC to Hive

I'm getting the following error when attempting to connect to Hive from a simple java program in Eclipse. It looks like it connects then throws this error. I can connect to Hive Thrift server locally through beeline without issues.
both libthrift .jar files are 0.9.2. Same on client and server. Version for server and client for the following .jar files are the same:
hive-jdbc*.jar 1.2.0
hive-service*.jar 1.2.0
libfb303-0.9.0.jar 0.9.2
libthrift-0.9.0.jar 0.9.2
log4j-1.2.16.jar 1.2.16
slf4j-api-1.6.1.jar 1.7.5
slf4j-log4j12-1.6.1.jar 1.7.5
commons-logging-1.0.4.jar 1.1.3
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.thrift.protocol.TProtocol.getScheme()Ljava/lang/Class;
at org.apache.hive.service.cli.thrift.TCLIService$OpenSession_args.write(TCLIService.java:1854)
at org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:63)
at org.apache.hive.service.cli.thrift.TCLIService$Client.send_OpenSession(TCLIService.java:150)
at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:142)
at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:578)
at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:192)
at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
The libthrift version I am using is listed by Apache as having the getScheme() method.
Any help would be greatly appreciated!
Make sure you have included the required jar files on your classpath. As you said its working on your local then I guess you did. If its not working on the actual server then make sure you have deployed the required jars.

Axis 1.4 log4j-1.2.8.jar incompatible with XPages?

I'm trying to add some of the JARs from Apache Axis 1.4 into the WebContent/WEB-INF/lib directory. One of the JARs is log4j-1.2.8.jar.
As soon as this JAR is added to the lib directory, all XPages in the NSF stop working. I just get an error 500 with the following message:
"HTTP Web Server: Command Not Handled Exception".
The following message is written to the error log:
java.lang.RuntimeException: com.ibm.xsp.FacesExceptionEx: org.apache.commons.logging.LogConfigurationException: java.lang.reflect.InvocationTargetException
.
.
.
.
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:102)
Link to full stack trace
Does anyone have any ideas?
edited
The AXIS jars are included in Domino install because Domino Web Services use them. That's why there is a conflict if you include them also.
I would recommend using JAX-WS which is newer than Axis. Here is how to use it for Web Service client. No need to add any JARs. You could also use JAX-WS wsdl2java instead of Apache one.
These two permissions need to be granted in java.policy file for this to work:
permission java.lang.RuntimePermission "setContextClassLoader";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
Note that any kind of server update (f.e. fixpack install) will reset the java.policy file to default.

Categories

Resources