SolrJ HttpSolrServer throwing NoHttpResponseException during instantiation - solr

SolrJ is throwing NoHttpResponseException when trying to instantiate HttpSolrServer. Anyone knows why?
In the code I do:
SolrServer server = new HttpSolrServer ("http://localhost:8983/solr/"); // or some other url.
and it throws:
javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/http/NoHttpResponseException
I'm using Solr and SolrJ 4.1.0

I dont know if your problem was the same as mine but i thought that i'm getting the same exception until i noticed that i'm having the exception noClassFound :NoHttpResponseException and just by adding this package httpclient-4.1.3 the issue was solved.
hope this helps.

I had the same problem, but I used solrj-4.3.1. You need org.apache.httpcomponents:httpcore jar on your classpath to resolve this problem.
I used httpcore-4.2.5.jar

My problem wasn't even solved after adding httpclient-4.x.x. I added all the libraries being distrubuted by solr-4.4.0 , dist folder. After that my problem got resolved.

you problem was the same as mine. i solved the problem by adding the package httpclient-.jar and the package httpcore-.jar. i hope this help for you

I to had same problem but after adding the following 3 jars I was able to fix it.
1. httpclient
2. httpcore
3. httpmime
And these suitable jars provided in your respective solr framework.
Example I am using solr4.7.2 and these jars are present in folder as solr-4.7.2\dist\solrj-lib\

Related

The Angular Universal (SSR) cannot integrate with the external libraries like puppeteer, bulljs

This is just for describing the issue and sharing my solution, I got stuck a lot of time on it.
This issue happened after I upgraded the Angular 10 -> 11 and changed the builder from udk:udk-runner to #angular-devkit
The issue I was facing is when I set the field bundleDependencies in angular.json to true . The Puppeteer cannot start with the error cannot launch the browser
Then I found it also happened on the other external libraries I'm using at the Server side like BullJS Bull-Board Puppeteer-Cluster with the below error
Github source for demo the issue: https://github.com/phattranky/angular-ssr-error-with-pupepteer
The solution is quite simple you just need to add externalDependencies below the field bundleDependencies, which are the libraries we are using.
"externalDependencies": ["puppeteer", "puppeteer-cluster", "bull", "bull-board"]
Sample:
What is the externalDependencies ?
https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/src/builders/server/schema.json
If you have the better solution and any feedbacks, please share for me. Thanks

appengine error - java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.com.sun.org.apache.xerces

I re-deployed my app (google appengine), it seems to be working fine, but when I try to parse Xml I get:
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.com.sun.org.apache.xerces.internal.parsers")
what does it mean? and how I can solve it?
on previous version of the app I didn't got this error.
when running the app locally I don't get this error.
I made minor changes - I pass some data from the UI to the datastore
Here is the code that parse the XML:
public static <T extends BaseDataObject> T xml2Bean(Class<T> clazz,
String xmlData) throws UnsupportedEncodingException, JAXBException {
Reader reader = new StringReader(xmlData);
JAXBContext context = getContext(clazz);
Unmarshaller um = context.createUnmarshaller();
return (T) um.unmarshal(reader);
}
My guess is that Google use to support com.sun.org.apache.xerces.internal.parsers but now they don't, and my old code still working because it was pushed when it was still supported...
how can I verify this guess? i.e. where can I find the list of unsupported packages?
I'm thinking of dropping the XML code and use json instead, how can I make sure json is supported?
Problem was solved: I've downloaded xerces and added the jars to war\WEB-INF\lib and to the build path in eclipse.
I also upgrade to the latest JDK (java 7).
I'm not sure which of those solved the problem...
Something in your code or a dependency of your code, is trying to refer to the package com.sun.org.apache.xerces.internal.parsers, which is not allowed on GAE. Just a guess: maybe a dependency has been upgraded and this dependency is trying to access that package.

GAE: java.lang.NoSuchMethodError: com.google.api.client.json.GenericJson.set

Starting from June, 12 my app that is used DriveAPI faced the following error (it's shown in GAE server log):
java.lang.NoSuchMethodError: com.google.api.client.json.GenericJson.set(Ljava/lang/String;Ljava/lang/Object;)Lcom/google/api/client/json/GenericJson;
at com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets$Details.set(GoogleClientSecrets.java:166)
at com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets$Details.set(GoogleClientSecrets.java:87)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:357)
at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:586)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:350)
at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:586)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:289)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:266)
at com.google.api.client.json.JsonParser.parseAndClose(JsonParser.java:141)
at com.google.api.client.json.JsonFactory.fromInputStream(JsonFactory.java:223)
at com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.load(GoogleClientSecrets.java:195)
at finbudget.server.handlers.lists.cronimport.AutoImportBackend.doImport(AutoImportBackend.java:112)
at finbudget.server.handlers.lists.cronimport.AutoImportBackend.doPost(AutoImportBackend.java:76)
......
It seems like this problem comes with 1.8.1 version of AppEngine release. Before it worked well... Did someone have the same problem? And what could be the solution for this?
It's a classpath collision.
If war/WEB-INF/lib contains multiple versions of the DriveAPI jars, strange issues may result from the wrong version loading during runtime. Removing outdated jars solves the problem.
(Note: I copied and formatted the answer that the original asker added to the question via an edit. I did this as a cleanup task.)

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

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

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! :|

Resources