Extracting .docx files with Tika in Apache Solr gives NoSuchMethod error - solr

I have a Solr 4.0 module in my project (basically, a maven web project with all the solr dependencies). It worked pretty well, including content extraction and everything.
But, when I tested it with a .docx document, It gives me the following error:
13:50:34,468 ERROR [org.apache.solr.servlet.SolrDispatchFilter] (http--0.0.0.0-8080-9)
null:java.lang.RuntimeException: java.lang.NoSuchMethodError:
org.apache.poi.openxml4j.opc.PackagePart.getRelatedPart(Lorg/apache/poi/openxml4j/opc/PackageRelationship;)
Lorg/apache/poi/openxml4j/opc/PackagePart;
I tried to manually add the openxml4j dependency to the project. I've downloaded the sources and looked at it, the PackagePart#getRelatedPart really doesn't exist.
What is this error? How can I fix this?
Thanks in advance.
EDIT
I noticed that poi-ooxml already had those classes inside it. Cool, but I also inspected those sources, and still doesn't have the needed method in the PackagePart class.
BTW: I tried to add openxml4j version 1.0-beta.

It was a jarhell related issue.

Thanks, "jarhell related" was the clue I needed!
My project had POI jars prior to import of the Tika app jar, which includes its own POI jars. I deleted the standalone POI jars, and then Tika was able to handle DOCX Word 2013 file without error.
Now hopefully I won't run into a situation where I need both! :|

Related

Errors with Angular.Dart tutorials

Installed Google Dart 1.0. Basically a Dart noob at this point...
angular.dart tutorial apps at - https://github.com/angular/angular.dart.tutorial
Seems broken or I am doing something wrong.
in chapter folders, file pubspec.yaml contains text: ../pubspec.yaml - which seems to be non yaml.
pub errors out with
Pub get failed, [1] Error in pubspec.yaml: The pubspec must be a YAML mapping.
There is a common pubspec.yaml in dir below chapter dirs, it contains legit yaml.
Even after editing chapter project pubspec.yaml with "common" pubspec legit yaml content and doing pub get, chapter 03..06 demos have missing package references.
Anyone who can tell me what I'm doing wrong appreciated.
There is a bug with the tutorial on Windows: https://github.com/angular/angular.dart.tutorial/issues/8
which should be fixed soon.
Having the same issue at present.
Short-term solution appears to not be to edit yaml files/links, (if you have, its probably best to re-download the tutorial files from fresh)
instead:
open the main.dart files in each affected example,
changes lines such as:
import 'package:angular_dart_demo/rating/rating_component.dart';
to
import '../lib/rating/rating_component.dart';
(you should see the ~ underlines disappear when you type this)
I think this has been due to some recent restructuring of the example files, since these were working until recently.

CakePHP searching for DebugKit at wrong path

I am trying to import DebugKit and CakePHP is producing the following error: DebugKit.ToolbarComponent could not be found.
Right below it, it says:
Create the class ToolbarComponent below in file:
/Users/SomeUser/Sites/SomeProject/app/Plugin/DebugKit//Controller/Component/ToolbarComponent.php
If you notice though, there are two slashes between DebugKit and Controller for some reason, and that's obviously not a real directory. The server running PHP 5.4.17. I have followed the exact installation instructions listed here. Any suggestions?
I had the same problem and solved it by changing the permissions to 755 to folders within DebugKit.
When I encountered this problem, I realized I had a Plugin/DebugKit folder structure in my project's root, and under the app directory. The one under app was empty, save for a blank file called empty. Strange. I have no idea how this happened. (Perhaps from accidentally running composer as non-root?) I deleted app/Plugin/DebugKit, and moved the one from the project root into app. No more error.
DebugKit does not currently seem to be compatible with cakephp 3.0 even though it is the example in the documentation.
The latest version still seems to use the 2.x methods.
I will also submit a ticket regarding this to update their documentation to prevent confusion.
If there is something I missed regarding this issue and it is actually possible to install this, let me know.

Solr 4 spatial class not found com/vividsolutions/jts/geom/Geometry

I'm running Solr 4.2.1 but I have the exception in my log file NoClassDefFoundError: com/vividsolutions/jts/geom/Geometry. I've checked similar questions, like How to install JTS in Solr 4? but that didn't solve the problem.
Listing the content of the solr.war I have the jts library in the correct path
WEB-INF/lib/jts-1.8.jar
Yet that doesn't solve my problem. Am I missing something?
You need to add also:
lib\jtsio-1.x.jar
lib\jdom.jar
lib\acme.jar

How to configure custom solr instance to use Morfologik?

I have a custom solr instance running in tomcat. I followed tomcat deployment tutorial in SolrWiki. I want to index my data which are in Polish language and I want to use Morfologik. So i followed http://solr.pl/en/2012/04/02/solr-4-0-and-polish-language-analysis/. I've created lib folder in SOLR_HOME, added all libraries to this folder, changed schema to use solr.MorfologikFilterFactory but i still get such error:
'collection1: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Plugin init failure for [schema.xml] fieldType „text_pl”: Plugin init failure for [schema.xml] analyzer/filter: Error loading class "solr.MorfologikFilterFactory"'
I assume there is a problem with paths. I hope so, because if not it might by quite hard to solve...
Anybody can help me? Thanks!
you can add lib path to the solrconfig.xml - see the xml supplied with example.
are you using the SolrCloud mode or standalone?

jTwitter, oAuth, and Google App Engine. NoClassDefFoundError

I'm trying to use jTwitter to get an oauth instance to twitter with my consumer key/secret and access token/secret. This is well documented in the javadoc here. I have downloaded signpost, signpost-jetty, and the jtwitter library, but after deploying and running the servlet, I get a error java.lang.NoClassDefFoundError: winterwell/jtwitter/OAuthSignpostClient Eclipse isn't complaining about the class not being there, because it is there-- I can see it in the JAR file itself, which is in my project. So, I said forget it, I'll try out OAuthScribeClient instead, but this generated a VERY SIMILAR ERROR java.lang.NoClassDefFoundError: org/scribe/oauth/Token This one confuses me even further because I have the following code in my java file, and it compiles without error or warning:
import org.scribe.oauth.Token;
Token token = new Token("myaccesstokeninfo", "accesstokensecret");
Clearly, I'm missing something very fundamental, but I am at an absolute loss as to what it may be. Thanks.
Usually "NoClassDefFoundError" happens when you forget to copy all jar-files to your "/war/WEB-INF/lib" directory, so those libs will be unavailable from server-side.
Xo4yHaMope is probably right.
If you're working from Eclipse but running using a web container, then your runtime classpath might be different from your project classpath - which can cause this error.
In order to complete Ben Winters answer what I actually did and worked is add the jar in
the libs folder within the project
see also here about folder hierarchy.
When you do this eclipse will normally add the jar to the android dependencies before launching the application. What I realise is that adding a jar in the build path will make classes available only during the build

Resources