Apache Tika ArchiveStreamFactory.detect error - java

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.

Related

sbt test error: java.lang.RuntimeException: /packages cannot be represented as URI

To start, I have reviewed the following response and am still struggling to resolve this issue:
Scala: packages cannot be represented as URI
I still see the following error output when I run sbt test:
error: error while loading String, class file '/modules/java.base/java/lang/String.class' is broken
(class java.lang.NullPointerException/Cannot invoke "scala.tools.nsc.Global$Run.typerPhase()" because the return value of "scala.tools.nsc.Global.currentRun()" is null)
[error] java.io.IOError: java.lang.RuntimeException: /packages cannot be represented as URI
[error] at java.base/jdk.internal.jrtfs.JrtPath.toUri(JrtPath.java:176)
[error] at scala.tools.nsc.classpath.JrtClassPath.asURLs(DirectoryClassPath.scala:204)
[error] at scala.tools.nsc.classpath.AggregateClassPath.$anonfun$asURLs$1(AggregateClassPath.scala:55)
Here is what I'm seeing when I look and my build settings:
I checked my "/Library/ directory and I actually don't see a Java folder at all.
Appears to be a compatibility issue with sbt version and java version.
I ran into a similar error when trying to import a sbt project using sbt version 1.2.7 (in project/build.properties) using openjdk 15
I found that project specified to use if I updated project/build.properties to sbt.version=1.4.7 the error would go away.
I also found I could use older jdk version openjdk 11 with sbt 1.2.7.
Screenshot seems to indicate you are using older version of java 8 and I think latest sbt requires at java 11+, so in your case I suggest upgrading java and trying again.

POI 3.17 is not working on weblogic server

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.

Apache Ignite - error 'JavaLoggerFileHandler' when running Spark shell

I am starting spark-shell (of spark 2.2) and added bunch of jars in spark-shell command (from Ignite 2.1 directory).
Still getting error:
Can't load log handler "org.apache.ignite.logger.java.JavaLoggerFileHandler"
Also followed recommendation from here:
https://apacheignite.readme.io/v1.2/docs/installation--deployment
# Optionally set IGNITE_HOME here.
# IGNITE_HOME=/path/to/ignite
IGNITE_LIBS="${IGNITE_HOME}/libs/*"
for file in ${IGNITE_HOME}/libs/*
do
if [ -d ${file} ] && [ "${file}" != "${IGNITE_HOME}"/libs/optional ]; then
IGNITE_LIBS=${IGNITE_LIBS}:${file}/*
fi
done
export SPARK_CLASSPATH=$IGNITE_LIBS
Also set logging to only ERROR as well but still getting error:
Can't load log handler "org.apache.ignite.logger.java.JavaLoggerFileHandler"
java.lang.ClassNotFoundException: org.apache.ignite.logger.java.JavaLoggerFileHandler
java.lang.ClassNotFoundException: org.apache.ignite.logger.java.JavaLoggerFileHandler
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.util.logging.LogManager$5.run(LogManager.java:965)
at java.security.AccessController.doPrivileged(Native Method)
Looks like you use documentation for an old Ignite version 1.2, while you use Ignite 2.1. Check the documentation for the latest version here: https://apacheignite-fs.readme.io/v2.2/docs/installation-deployment
Also, please make sure that have configured IGNITE_HOME in your environment. JavaLoggerFileHandler placed in the ignite-core module, looks like spark classpath doesn't see any Ignite lib at all.
The documentation describe the issue here:
https://apacheignite-fs.readme.io/v2.2/docs/troubleshooting
This issue appears when you do not have any loggers included in classpath and Ignite tries to use standard Java logging. By default Spark loads all user jar files using separate class loader. Java logging framework, on the other hand, uses application class loader to initialize log handlers. To resolve this, you can either add ignite-log4j module to the list of the used jars so that Ignite would use Log4j as a logging subsystem, or alter default Spark classpath as described

Maven1.x: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found

After OS update from Windows 7 to Windows 10, I'm facing following error:
Apache Maven
intelligent projects ~
v. 1.0.2
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not
at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:93)
at org.apache.maven.jelly.JellyUtils.compileScript(JellyUtils.java:202)
at org.apache.maven.jelly.JellyUtils.compileScript(JellyUtils.java:180)
at org.apache.maven.jelly.JellyUtils.compileScript(JellyUtils.java:146)
at org.apache.maven.plugin.PluginManager.loadScript(PluginManager.java:1109)
at org.apache.maven.plugin.PluginManager.runScript(PluginManager.java:1135)
at org.apache.maven.plugin.PluginManager.initialiseHousingPluginContext(PluginManager.java:770)
at org.apache.maven.plugin.PluginManager.prepAttainGoal(PluginManager.java:725)
at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:656)
at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
at org.apache.maven.cli.App.doMain(App.java:488)
at org.apache.maven.cli.App.main(App.java:1239)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.werken.forehead.Forehead.run(Forehead.java:551)
at com.werken.forehead.Forehead.main(Forehead.java:581)
You have encountered an unknown error running Maven. Please help us to correct
this problem by following these simple steps:
- read the Maven FAQ at http://maven.apache.org/faq.html
- run the same command again with the '-e' parameter, eg maven -e jar
As my application is using Maven1 and JDK1.4, I'm running eclipse:generate-classpath command.
I also tried to add xerces and xercesImpl jars via maven. Also added these two jars in C:\Dev\Jdks\jdk1.8.0_31\jre\lib\ext directory. Still getting the same error. Can anyone please help? I'll be greatful, Thanks in advance.

on ArtifactoryClient.create exception thrown for JFrogDev/artifactory-client-java

I am developing a Jenkins Plugin in Java, and I'm getting the following error when I try to instantiate the ArtifactoryClient class within JFrog's artifactory client java library.
I used the following code:
ArtifactoryClient artifactory = ArtifactoryClient.create(resolverServerUrl, resolverUsername, resolverPassword);
And I get the error stack trace below when it executes. I have done extensive research on this issue, and I have not found anyone with a similar error except for the ones referenced in this issue which I also opened:
https://github.com/JFrogDev/artifactory-client-java/issues/85
I found a similar stack overflow question, but their solution does not work for me and their stack trace is different, which means the error is different. (Upload to Artifactory using Java client)
I am wondering if anyone knows how to resolve this error and why it is happening?
groovy.lang.MissingMethodException: No signature of method:
com.fasterxml.jackson.databind.ObjectMapper.addMixIn() is applicable for argument types: (java.lang.Class, java.lang.Class) values: [interface
org.jfrog.artifactory.client.model.Repository, ...] at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55) at
org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46) at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120) at org.jfrog.artifactory.client.impl.ArtifactoryImpl.<init>(ArtifactoryImpl.groovy:46) at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at
java.lang.reflect.Constructor.newInstance(Constructor.java:423) at
org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at
org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCllSite.java:194) at
org.jfrog.artifactory.client.ArtifactoryClient.create(ArtifactoryClient.groovy:
7) at
org.jfrog.artifactory.client.ArtifactoryClient.create(ArtifactoryClient.groovy)
at com.jenkins.plugins.servicenow.artifactory.ArtifactoryService.<init
(ArtifactoryService.java:36) at
com.ge.integration.jenkins.notification.Phase.initialize(Phase.java:152) at
com.ge.integration.jenkins.notification.Phase.perform(Phase.java:210) at
com.ge.integration.jenkins.notification.Phase.handle(Phase.java:114) at
com.ge.integration.jenkins.notification.JobListener.onFinalized(JobListener.jav
:52) at hudson.model.listeners.RunListener.fireFinalized(RunListener.java:230)
at hudson.model.Run.onEndBuilding(Run.java:1890) at
hudson.model.Run.execute(Run.java:1809) at
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at
hudson.model.ResourceController.execute(ResourceController.java:98) at
hudson.model.Executor.run(Executor.java:381)
I am using the following versions:
I'm using the latest version of artifactory-client-java.
Jenkins 1.621
Artifactory 2.3.0
The environment I am using this for requires these versions.
The Java Versions I have tried this plugin on are Java 1.8.02 and Java 1.7.79
As #drob said in the comments above, I was using the wrong version of the Jackson Library. JFrog's client library imports and requires Jackson 2.4.6; however, I had imported Jackson 2.1.1 in a dependency that I imported before hand.
My build tool (Maven) read it as a conflict and used 2.1.1 omitting 2.4.6, causing the error described above.

Categories

Resources