clojure-solr-0.2.0 and solr4 - solr

I'm trying to get clojure-solr-0.2.0 working with solr4 (trunk nightly build). I'm getting the following exception:
Caused by: java.lang.RuntimeException: Invalid version or the data in not in 'javabin' format
at org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:99)
at org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:39)
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:466)
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:243)
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89)
I'm assuming this is because clojure-solr is using some version of solrj library that is from solr3 codebase and javabin format changed between versions.
Is there some easy way to get this to work?
EDIT:
I deleted solrj from my project's lib folder, and replaced it with lib/apache-solr-solrj-4.0-2012-05-15_08-20-37.jar. I was hoping that would just work since the same classes (should) be found on the classpath at runtime (the transitive dependency should only be required when lein deps is run to fetch dependencies (or so I reasoned). The result was a class not found at runtime:
Caused by: java.lang.ClassNotFoundException: org.apache.solr.client.solrj.impl.CommonsHttpSolrServer
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at clojure_solr$eval1423$loading__4414__auto____1424.invoke(clojure_solr.clj:1)
at clojure_solr$eval1423.invoke(clojure_solr.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
... 95 more
And the problem is that CommonsHttpSolrServer is no longer present in the jar:
$ jar tf lib/apache-solr-solrj-4.0-2012-05-15_08-20-37.jar |grep Http
org/apache/solr/client/solrj/impl/HttpSolrServer$1.class
org/apache/solr/client/solrj/impl/HttpSolrServer$2.class
org/apache/solr/client/solrj/impl/HttpSolrServer$3.class
org/apache/solr/client/solrj/impl/HttpSolrServer$DeflateDecompressingEntity.class
org/apache/solr/client/solrj/impl/HttpSolrServer$GzipDecompressingEntity.class
org/apache/solr/client/solrj/impl/HttpSolrServer$UseCompressionRequestInterceptor.class
org/apache/solr/client/solrj/impl/HttpSolrServer$UseCompressionResponseInterceptor.class
org/apache/solr/client/solrj/impl/HttpSolrServer.class
org/apache/solr/client/solrj/impl/LBHttpSolrServer$1.class
org/apache/solr/client/solrj/impl/LBHttpSolrServer$Req.class
org/apache/solr/client/solrj/impl/LBHttpSolrServer$Rsp.class
org/apache/solr/client/solrj/impl/LBHttpSolrServer$ServerWrapper.class
org/apache/solr/client/solrj/impl/LBHttpSolrServer.class
$ jar tf lib/apache-solr-solrj-4.0-2012-05-15_08-20-37.jar |grep CommonsHttp
$

you will very likely need to make your own build of clojure-solr and fix it to work with the latest solr4. This is actually not that hard.
clone it from the github project
lein install
add it as a dependency in your main project
hack and repeat.

Related

Karaf feature:install throws Unsupported 'Bundle-ManifestVersion' value: 1

I am new to Karaf and trying to learn how to handle it.
On the way I tried to add Camunda features.
Like described on https://github.com/camunda/camunda-bpm-platform-osgi/tree/master/camunda-bpm-karaf-feature
at first, I added the repo:
feature:repo-add mvn:org.camunda.bpm.extension.osgi/camunda-bpm-karaf-feature/4.1.0/xml/features
then I tried to install them;
feature:install camunda-bpm-karaf-feature-full
unfortunately I got this Exception
org.osgi.framework.BundleException: Unable to build resource for mvn:xmlpull/xmlpull/1.1.3.1: Unsupported 'Bundle-ManifestVersion' value: 1
at org.apache.felix.utils.resource.ResourceBuilder.build(ResourceBuilder.java:82)
at org.apache.felix.utils.resource.ResourceBuilder.build(ResourceBuilder.java:67)
at org.apache.karaf.features.internal.region.SubsystemResolver.prepare(SubsystemResolver.java:180)
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:379)
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.osgi.framework.BundleException: Unsupported 'Bundle-ManifestVersion' value: 1
at org.apache.felix.utils.resource.ResourceBuilder.doBuild(ResourceBuilder.java:90)
at org.apache.felix.utils.resource.ResourceBuilder.build(ResourceBuilder.java:80)
... 9 more
Error executing command: Unable to build resource for mvn:xmlpull/xmlpull/1.1.3.1: Unsupported 'Bundle-ManifestVersion' value: 1
I am using Karaf version 4.2.1
Does somebody know what I am doing wrong?
One of the features depend on xmlpull 1.1.3.1 which has Manifest-Version: 1.0 in MANIFEST.MF thus making it an OSGi R3 bundle.
Apache Felix supports bundles conforming the OSGi Release 4 (or newer) only (Manifest-Version: 2.0) which is why it rejects xmlpull. See the Felix source for reference.
If you control the source consider wrapping xmlpull and installing the wrapped bundle from the features. You can also play around with the Karaf console; for example, install -s wrap:mvn:xmlpull/xmlpull/1.1.3.1.

jenkins htmlpublisher plugin install error

i wanted to install the HTML Publisher plugin in jenkins but when i try that, getting below error, any suggestion how to get the plugin installed.
jenkins version: 1.630.
Exception:
java.io.IOException: Failed to dynamically deploy this plugin
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1328)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1126)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:110)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Failed to install htmlpublisher plugin
at hudson.PluginManager.dynamicLoad(PluginManager.java:485)
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1324)
... 5 more
Caused by: java.io.IOException: Dependency workflow-step-api (1.4) doesn't exist
at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:480)
at hudson.PluginManager.dynamicLoad(PluginManager.java:475)
... 6 more
There may be 2 ways to install a plugin.
Download the hpi plugin file and place it in the plugin directory and restart the jenkins.
Install the plugin using the plugin section in the jenkins gui.
Looks like you are trying the first method. If so you need to first install the dependency plugins
workflow-step-api (version:1.4)
matrix-project (version:1.0)
Check this link for the same: https://wiki.jenkins-ci.org/display/JENKINS/HTML+Publisher+Plugin
If you are trying with second method, jenkins will take care of dependency installation.

Running Flink Program on a Remote Cluster

I have a program in Apache Flink. I tested and ran it on the local machine and every thing works fine. To run the program on a remote cluster, I did necessary changes as mentioned in Apache Flink Official Website.
I did the following changes:
The two points below
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
ExecutionEnvironment env = ExecutionEnvironment.createRemoteEnvironment("taskManagerName",
portNo,paralelismNo);
Fixing the necessary paths to read input files and write outputs.
Generate a thin jar out of the program and put the necessary jar
libraries into a folder besides my project jar file called
myproj.jar.
copying the data and the jar library and myproj.jar into the cluster
and run the following command remotely on the cluster:
java -cp pathToJarLib \\* -jar myproj.jar
But, I get the below error and I don't have any clue to fix the issue. There are no relevant log files which can aid me in fixing this issue.
Error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/api/common/functions/MapFunction
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2570)
at java.lang.Class.getMethod0(Class.java:2813)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: org.apache.flink.api.common.functions.MapFunction
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more
Your classpath is obviously not complete. Try to submit via bin/flink run myproj.jar. This sets up the classpath correctly.

java.lang.NoClassDefFoundError: com/google/common/collect/Maps - Selenium

Dear Selenium Experts,
I have come across the following run-time error from a JPA 2.0 program which appears to be related to Firefox Profile for some reason:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/Maps
at org.openqa.selenium.firefox.FirefoxProfile.(FirefoxProfile.java:56)
at org.openqa.selenium.firefox.FirefoxProfile.(FirefoxProfile.java:79)
at model.DownloadCarDetail.getMercedezDetail(model.DownloadCarDetail:72)
at model.DownloadCarDetail.getMercedezDetail.main (model.DownloadCarDetail.getMercedezDetail.java:47)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Maps
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more
Java Result: 1
I have kept Firefox to version 15 so that it is supported by Selenium Webdriver but suspect that the issue is to do with not able to read profile directory.
Your assistance would be very much apprecaited.
Many thanks,
George
The problem you are seeing has nothing to do with your Firefox profile.
Actually, it is the JVM classloader that complains that it can't find the com.google.common.collect.Maps class.
This usually means that you don't have Guava (which is a dependency for Selenium) on your classpath. Clean and rebuild your project, check your classpath, check the various versions of libraries that might be there. If you're using some kind of dependency management system (Maven, Ivy etc.), check it's configured right.
Import the .jar file to Eclipse downloaded from here (depending on the current version).
open this link https://www.seleniumhq.org/download/ and download Java 3.11.0(current version) open zip file to desktop on netbeans or eclips click add jars/file in selenium-java-3.11.0\libs select all file also in selenium-java-3.11.0 select client-combined-3.11.0.jar you will be ok. dont remember to add System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe"); code. you can download chromedriver this link https://chromedriver.storage.googleapis.com/index.html?path=2.38/
In my case the Guava dependency was corrupt. Worked fine after I deleted the corrupt jars and rebuilt whole project.
Thank you for offerring your suggestion for a solution to this issue. I have found the exact answer from Selenium 2 WebDriver NoClassDefFoundErrorS which has resolved the underlying issue.
George
add below maven dependency and clean and compile your code.
<!-- https://mvnrepository.com/artifact/com.google.common/google-collect -->
<dependency>
<groupId>com.google.common</groupId>
<artifactId>google-collect</artifactId>
<version>0.5</version>
</dependency>

java.lang.IncompatibleClassChangeError: Implementing class deploying to app engine

I wrote a couple of REST services using Jersey 1.13 on JRE 1.6. Everything runs fine locally, but after I deploy to GAE I get this error:
****Uncaught exception from servlet
java.lang.IncompatibleClassChangeError: Implementing class
at com.google.appengine.runtime.Request.process-139e1bda14d5aebc(Request.java)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:79)
at com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:104)
at com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:78)
at com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:89)
at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:700)
at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:678)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:203)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:557)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:452)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:458)
at com.google.tracing.TraceContext.runInContext(TraceContext.java:698)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:336)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:328)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:456)
at java.lang.Thread.run(Thread.java:679)****
Any help would be appreciated.
This exception is caused by compatibility issues between asm-4.0.jar and asm-3.1.jar. With the new Version of AppEngine, asm-4.0.jar is used and it is not compatible with Jersey, which relies on asm-3.1.jar. To make Jersey still work on GAE 1.7, you have to remove the dependency on asm-4.0.jar.
See this post : http://cloudvane.com/2012/09/23/problem-with-google-appengine-and-jersey-with-java/
It s tested and verified, like that:
add asm-3.3.1.jar to your war->lib
add it to you re build path
remove physically the asm-4.0.jar
Project -> Properties -> Google -> AppEngine: switch Datanuclueus to v1
That s it!
The instructions on this post took care of my problem.
Apparently the jersey-server 1.13 jar is compatible with asm3.1 and GAE 1.7.1 needs ASM 4.
Using the Jar repackaging tool jarjar you can deploy a asm 3.1 jar that will play with asm 4.
You may need to use JarJar version 1.3 if 1.4 gives an error message.
The new Jersey version 1.18.1 doens't depend on Asm 3, so it's compatible with GAE!
Maybe this will help: java.lang.IncompatibleClassChangeError: Implementing class Mongo
It's not exactly the same class, but the problem occurs when you have a library with 2 different version jars. Make sure you did not include any extra libraries or (I'll explain what happened to me):
You have A-1.0.jar and A-1.0.jar has inside another jar, let's say B-1.0.jar, but you have included separately a B-2.0.jar and in this way the two different version B jars are the problem.
Make sure you did not make this.
Same problem here, but I believe I've fixed it!
The trick was running a clean inside of eclipse, which notified me of the following error:
java.lang.RuntimeException: Unexpected exception
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:76)
at com.google.appengine.tools.enhancer.Enhance.<init>(Enhance.java:71)
at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:51)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:74)
... 2 more
Caused by: org.datanucleus.exceptions.NucleusUserException: You seem to have ASM v3 in the CLASSPATH and you need ASM v4
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:173)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1133)
... 7 more
The important bit . . .
Caused by: org.datanucleus.exceptions.NucleusUserException: You seem to have ASM v3 in the CLASSPATH and you need ASM v4
Apparently, GAE does not like having two versions of ASM loaded. On a whim, I went into the eclipse project properties and changed the datanucleus version from v2 to v1. I redeployed and now my app works. So much for catching these kinds of issues in the local dev environment . . .
I think I spent more time configuring GAE to run with jersey than I did actually writing the app. This may be my first and last GAE hosted app.
Did you update your App engine's SDK? (Recently the App engine SDK was updated from 1.7.0 to 1.7.1.)
Try to revert your app engine's SDK to 1.7.0. I have tried many solutions that I found on the Internet, none of them worked for me, but this one worked.
I have no idea how I can safely change my app engine project's sdk version for now. If anyone knows how to change the SDK version of the app, please let me know.
I got this error working on a maven project using Jersey-1.11 to develop a REST service:
cglib-3.0 depends on asm-4.0, and so I excluded it, leaving asm-3.0 to stand. This is because the Jersey version I am using uses asm-3.0.
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.0</version>
<exclusions>
<exclusion>
<artifactId>asm</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
</exclusions>
</dependency>
I changed the Persistence from JAP2 to JPA1 and it worked for me.

Resources