Solr custom RequestHandler ClassNotFoundException - java

I was following this tutorial - http://www.slideshare.net/searchbox-com/develop-a-solr-request-handler-plugin and built the required jar file in Netbeans then put it into the lib path and added the request handler to solrconfig.xml:
<requestHandler name="/newendpoint" class="com.searchbox.DemoPlugin">
<lst name="words">
<str name="word">body</str>
<str name="word">fish</str>
<str name="word">dog</str>
</lst>
</requestHandler>
I see the jar being loaded:
INFO - 2015-02-06 12:32:21.903; org.apache.solr.core.SolrResourceLoader; Adding 'file:/data/solr/lib/DemoPlugin-1.0.jar' to classloader
But then I get an error when I try to restart solr:
ERROR - 2015-02-06 12:39:02.942; org.apache.solr.core.CoreContainer; Error creating core [test]: RequestHandler init failure
org.apache.solr.common.SolrException: RequestHandler init failure
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:873)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:646)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:491)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:255)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:249)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.solr.common.SolrException: RequestHandler init failure
at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:172)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:792)
... 8 more
Caused by: org.apache.solr.common.SolrException: Error loading class 'com.searchbox.DemoPlugin'
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:490)
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:421)
at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:543)
at org.apache.solr.core.SolrCore.createRequestHandler(SolrCore.java:616)
at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:158)
... 9 more
Caused by: java.lang.ClassNotFoundException: com.searchbox.DemoPlugin
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 java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:789)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:474)
... 13 more
I confess I'm no java expert so am wondering if I've missed something obvious, or mechanics have changed since the tutorial was created, expanding the DemoPlugin jar it has the required com/searchbox/DemoPlugin.class file in, so I'm at a bit of a loss.
Any pointers appreciated.
Si

I have tried this tutorial and I can confirm that it works as explained.
For you I can only assume the jar is not loaded where it should (even if the log sais the classloader gets it).
I have put the jar in {solr.home}/{core.name}/lib.
A little more info on how to deploy new plugins into solar is here.
Try to use a solr.xml file and configure there exactly where the plugin should be loaded from.

Related

Tomcat7.0.100 can't provide java backend api services

To resolve the AJP problem, we updated tomcat to v7.0.100 and config the conf/server.xml file in Host item as below :
<Context docBase="D:\app" path="/" reloadable="true" />
The front resources such as js, html
But the API backend service does not start and any requests return 404 error.
Catalina.out shows below error:
java.lang.IllegalArgumentException: 创建类型为 [xxx.manager.inter.websocket.service.WebSocketDemo] 的 POJO 实例失败
at org.apache.tomcat.websocket.pojo.PojoEndpointServer.onOpen(PojoEndpointServer.java:60)
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:135)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:680)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:317)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.InstantiationException
at org.apache.tomcat.websocket.server.DefaultServerEndpointConfigurator.getEndpointInstance(DefaultServerEndpointConfigurator.java:40)
at org.apache.tomcat.websocket.pojo.PojoEndpointServer.onOpen(PojoEndpointServer.java:57)
... 7 more
Caused by: java.lang.reflect.InvocationTargetException
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.apache.tomcat.websocket.server.DefaultServerEndpointConfigurator.getEndpointInstance(DefaultServerEndpointConfigurator.java:36)
... 8 more
Caused by: java.lang.NullPointerException
at xxx.common.context.ApplicationContextManagement.getBean(ApplicationContextManagement.java:26)
at xxx.manager.inter.websocket.service.WebSocketDemo.<init>(WebSocketDemo.java:36)
... 13 more
Code line 36 in WebSocketDemo.java:
private SpeedService speedService = (SpeedService)ApplicationContextManagement.getBean("speedService");
We debugged the Tomcat source code and found a bug at line 111 in /org/apache/catalina/startup/WebappServiceLoader.java:
Enumeration<URL> resources = ((URLClassLoader) loader).findResources("/" + configFile);
did you add secretRequired="false" to connector in server.xml ?, this something new to tomcat
or you can make it true also but need to provide secret phase.

Solr 4.1 Core Initialization Failure [duplicate]

This question already has answers here:
Solr RequestHandler init failure
(2 answers)
Closed 7 years ago.
I have updated my version of Solr from 3.5 to 4.1
I have removed the old war file from my apache tomcat (7) webapps, and deployed the new war file that has been provided in the apache-solr package.
I got the following error upon trying to access solr from the web browser!
I have one core only(dbTrial)
Solr opens but this error appears.
SolrCore Initialization Failures
dbTrial: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: RequestHandler init failure
There are no SolrCores running.
Using the Solr Admin UI currently requires at least one SolrCore.
Unable to load environment info from null/admin/system?wt=json.
This interface requires that you activate the admin request handlers in all SolrCores by adding the following configuration to your solrconfig.xml:
Can you help me out? I have tried adding the request handler as specified, but it didn't work.
It seems that the new versions of solr need a new format for solrconfig file. can you assist please! thank you!
the log is the following:
????? ?????? 21, 2014 9:19:05 ? org.apache.solr.common.SolrException log
SEVERE: null:org.apache.solr.common.SolrException: RequestHandler init failure
at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:168)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:657)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:566)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:850)
at org.apache.solr.core.CoreContainer.load(CoreContainer.java:534)
at org.apache.solr.core.CoreContainer.load(CoreContainer.java:356)
at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:308)
at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:107)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4624)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5281)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.solr.common.SolrException: Error loading class 'solr.DisMaxRequestHandler'
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:436)
at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:469)
at org.apache.solr.core.SolrCore.createRequestHandler(SolrCore.java:540)
at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:154)
... 25 more
Caused by: java.lang.ClassNotFoundException: solr.DisMaxRequestHandler
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.net.FactoryURLClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:420)
... 28 more
Check the Solr log for a better error of what the issue is when Solr is starting up - you'll probably have a better error message there than the one you can see in the Admin interface (which is the error triggered when the interface attempts to access the Solr core). The reason why the core or requestHandler isn't loading will be in the log file, and not in the message produced by the UI. Remember that logging also changed at 4.3, if you've updated to 4.10 (I see that you wrote 4.1, but if you're planning on going the whole way (or meant 4.10) - the logging might have to be configured as well).
You'll also want to consider the "going from 3 to 4" document, that details the changed to the configuration files (as solrconfig.xml changed a bit).
Update
The log shows that it's complaining about loading "solr.DisMaxRequestHandler". This has been deprecated for quite some time and has been removed - just use the standard request handler from the example solrconfig.xml instead.
<requestHandler name="standard" class="solr.SearchHandler" default="true">
<lst name="defaults">
<str name="echoParams">explicit</str>
</lst>
</requestHandler>

java.lang.ClassNotFoundException: org.jboss.netty.channel.ChannelFactory while running play project in intellij idea

I am trying to create a play framework project in intellij idea .But when i am trying to run or debug my project it shows the below error in my console.
java.lang.NoClassDefFoundError: org/jboss/netty/channel/ChannelFactory
at play.api.test.TestServer.start(Selenium.scala:142)
at play.api.test.PlayRunners$class.running(Helpers.scala:59)
at play.api.test.Helpers$.running(Helpers.scala:364)
at play.api.test.WithBrowser.around(Specs.scala:57)
at org.specs2.mutable.Around$class.delayedInit(Around.scala:12)
at play.api.test.WithBrowser.delayedInit(Specs.scala:45)
at IntegrationSpec$$anonfun$1$$anonfun$apply$1$$anon$1.<init>(IntegrationSpec.scala:17)
at IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
at IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
at org.specs2.specification.FragmentsBuilder$$anon$1.asResult(FragmentsBuilder.scala:142)
at org.specs2.specification.FragmentsBuilder$$anon$1.asResult(FragmentsBuilder.scala:141)
at org.specs2.execute.AsResult$.apply(Result.scala:250)
at org.specs2.specification.Example$$anonfun$apply$1.apply(Fragment.scala:209)
at org.specs2.specification.Example$$anonfun$apply$1.apply(Fragment.scala:209)
at org.specs2.specification.Example.execute(Fragment.scala:176)
at org.specs2.specification.FragmentExecution$$anonfun$1.apply(FragmentExecution.scala:52)
at org.specs2.specification.FragmentExecution$$anonfun$1.apply(FragmentExecution.scala:52)
at org.specs2.execute.ResultExecution$class.execute(ResultExecution.scala:22)
at org.specs2.execute.ResultExecution$.execute(ResultExecution.scala:116)
at org.specs2.specification.FragmentExecution$class.executeBody(FragmentExecution.scala:28)
at org.specs2.runner.JUnitRunner$$anon$3.executeBody(JUnitRunner.scala:43)
at org.specs2.specification.FragmentExecution$class.execute(FragmentExecution.scala:52)
at org.specs2.runner.JUnitRunner$$anon$3.execute(JUnitRunner.scala:43)
at org.specs2.specification.FragmentExecution$$anonfun$executeFragment$1$$anonfun$apply$1.apply(FragmentExecution.scala:35)
at org.specs2.specification.FragmentExecution$$anonfun$executeFragment$1$$anonfun$apply$1.apply(FragmentExecution.scala:35)
at org.specs2.control.Exceptions$class.catchAllOr(Exceptions.scala:54)
at org.specs2.control.Exceptions$.catchAllOr(Exceptions.scala:109)
at org.specs2.specification.FragmentExecution$$anonfun$executeFragment$1.apply(FragmentExecution.scala:35)
at org.specs2.specification.FragmentExecution$$anonfun$executeFragment$1.apply(FragmentExecution.scala:35)
at org.specs2.reporter.JUnitReporter$$anonfun$executeFragment$1.execute$1(JUnitReporter.scala:47)
at org.specs2.reporter.JUnitReporter$$anonfun$executeFragment$1.apply(JUnitReporter.scala:54)
at org.specs2.reporter.JUnitReporter$$anonfun$executeFragment$1.apply(JUnitReporter.scala:46)
at org.specs2.reporter.DefaultExecutionStrategy$class.executeWithBarrier$1(ExecutionStrategy.scala:103)
at org.specs2.reporter.DefaultExecutionStrategy$$anonfun$executeConcurrently$1$$anonfun$apply$2.apply(ExecutionStrategy.scala:105)
at org.specs2.reporter.DefaultExecutionStrategy$$anonfun$executeConcurrently$1$$anonfun$apply$2.apply(ExecutionStrategy.scala:105)
at scalaz.concurrent.Promise$Unfulfilled$.fulfill(Promise.scala:125)
at scalaz.concurrent.Promise$Done.eval(Promise.scala:153)
at scalaz.concurrent.Promise$$anonfun$e$1.apply(Promise.scala:17)
at scalaz.concurrent.Promise$$anonfun$e$1.apply(Promise.scala:17)
at scalaz.concurrent.Actor.batchHandle(Actor.scala:73)
at scalaz.concurrent.Actor.scalaz$concurrent$Actor$$act(Actor.scala:57)
at scalaz.concurrent.Actor$$anonfun$schedule$1.apply$mcV$sp(Actor.scala:52)
at scalaz.concurrent.Actor$$anonfun$schedule$1.apply(Actor.scala:52)
at scalaz.concurrent.Actor$$anonfun$schedule$1.apply(Actor.scala:52)
at scalaz.concurrent.StrategysLow$$anon$3$$anon$4.call(Strategy.scala:65)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.channel.ChannelFactory
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:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 50 more
java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/jboss/netty/channel/ChannelFactory
at play.api.test.TestServer.start(Selenium.scala:146)
at play.api.test.PlayRunners$class.running(Helpers.scala:59)
at play.api.test.Helpers$.running(Helpers.scala:364)
at play.api.test.WithBrowser.around(Specs.scala:57)
at play.api.test.WithBrowser.delayedInit(Specs.scala:45)
at IntegrationSpec$$anonfun$1$$anonfun$apply$1$$anon$1.<init>(IntegrationSpec.scala:17)
at IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
at IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
Caused by: java.lang.NoClassDefFoundError: org/jboss/netty/channel/ChannelFactory
at play.api.test.TestServer.start(Selenium.scala:142)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.channel.ChannelFactory
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
... 8 more
Disconnected from the target VM, address: '127.0.0.1:1698', transport: 'socket'
Process finished with exit code -1
I have play plugins installed in intellij and created my project from File -> New Project -> scala ->Play2.x
Why my play project is not able to run?
Thanks
First of all , check that your class name and file name is same, if it is true.
Then , check that your class path is specified properly and after the declaration of the class path you have not edited the folders name which are there in the class path or have changed there location .

Netty class not found exception while executing JAR

I've made JAR file from a project I made, however when I try to execute it, it gives:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/netty/channel/socket/ServerSocketChannelFactory
at org.ddosdefense.httpfilter.HTTPInterceptor.main(HTTPInterceptor.java:66)
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.channel.socket.ServerSocketChannelFactory
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)
... 1 more
Inside the jar file all the libraries are present.
In the .classpath file the netty jar library is present:
<classpathentry kind="lib" path="ddos2_lib/netty-3.6.2.Final.jar"/>
When I execute the project in eclipse it works perfectly. Anyone has an idea how to solve this problem?
Thanks in advance!
Most likely you don't have the jar packaged into the jar you produce or missed to specify the netty jar via the -cp option.

java.lang.ClassNotFoundException: javax.el.ELContext

i'm trying a simple example about Struts2 ,i encountered an below issue
----------------
Mar 02, 2014 7:16:05 PM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet jsp threw exception
------------------------------------------------------------------------
java.lang.ClassNotFoundException: javax.el.ELContext
----------------------------------------------------
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:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.privateGetPublicMethods(Class.java:2562)
at java.lang.Class.privateGetPublicMethods(Class.java:2578)
at java.lang.Class.privateGetPublicMethods(Class.java:2578)
at java.lang.Class.getMethods(Class.java:1427)
at freemarker.ext.beans.BeansWrapper.discoverAccessibleMethods(BeansWrapper.java:1395)
at freemarker.ext.beans.BeansWrapper.discoverAccessibleMethods(BeansWrapper.java:1385)
at freemarker.ext.beans.BeansWrapper.populateClassMapWithBeanInfo(BeansWrapper.java:1129)
at freemarker.ext.beans.BeansWrapper.populateClassMap(BeansWrapper.java:1072)
at freemarker.ext.beans.BeansWrapper.introspectClassInternal(BeansWrapper.java:1010)
at freemarker.ext.beans.BeansWrapper.introspectClass(BeansWrapper.java:969)
at freemarker.ext.beans.BeanModel.<init>(BeanModel.java:140)
at freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
at freemarker.ext.beans.StringModel$1.create(StringModel.java:75)
at freemarker.ext.beans.BeansModelCache.create(BeansModelCache.java:45)
at freemarker.ext.util.ModelCache.getInstance(ModelCache.java:115)
at freemarker.ext.beans.BeansWrapper.wrap(BeansWrapper.java:468)
at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:867)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.ExistsExpression._getAsTemplateModel(ExistsExpression.java:71)
.........
It's it caused by the conflict of of the packages i import?
The Apache Tomcat web server already contains and loaded this classes from el-api.jar. To compile your application you might also include Java EE libraries including javax.servlet.jsp.jar but it's not necessary to deploy them. To choose which classes are available between classloaders see Apache Tomcat 7: Class Loader HOW-TO the documentation page.

Categories