Thanks Erick, Jörn danke sehr. tldr; gradle trickery and thriftiness helped here.
detail: To make things easier, for our deployment systems, I created a plugin gradle task which is economical and yet brings in the right number of jars. in my case scala-lang jars were required, everything else was compile only. I used the compileOnly gradle dependency directive for all dependencies except scala-lang. also had to remove shading. > On Feb 10, 2019, at 11:37 PM, Erick Erickson <erickerick...@gmail.com> wrote: > > What Jörn said. > > Your jar should be nothing but your custom code. Usually I cheat in > IntelliJ and check the box for artifacts that says something like > "only compiled output".... > > On Sun, Feb 10, 2019 at 10:37 PM Jörn Franke <jornfra...@gmail.com> wrote: >> >> You can put all solr dependencies as provided. They are already on the class >> path - no need to put them in the fat jar. >> >>> Am 11.02.2019 um 05:59 schrieb Aroop Ganguly <aroopgang...@icloud.com>: >>> >>> Thanks Erick! >>> >>> I see. Yes it is a fat jar post shadowJar process (in the order of MBs). >>> It contains solrj and solr-core dependencies plus a few more scala related >>> ones. >>> I guess the solr-core dependencies are unavoidable (right ?), let me try to >>> trim the others. >>> >>> Regards >>> Aroop >>> >>>> On Feb 10, 2019, at 8:44 PM, Erick Erickson <erickerick...@gmail.com> >>>> wrote: >>>> >>>> Aroop: >>>> >>>> How big is your custom jar file? The name "test-plugins-aroop-all.jar" >>>> makes me suspicious. It should be very small and should _not_ contain >>>> any of the Solr distribution jar files, just your compiled custom >>>> code. I'm grasping at straws a bit, but it may be that you have the >>>> same jar files from the Solr distro and also included in your custom >>>> jar and it's confusing the classloader. "Very small" here is on the >>>> order of 10K given it does very little. If it's much bigger than, say, >>>> 15K it's a red flag. If you do a "jar -dvf your_custom_jar" there >>>> should be _very_ few classes in it. >>>> >>>> Best, >>>> Erick >>>> >>>> On Sun, Feb 10, 2019 at 8:33 PM Aroop Ganguly >>>> <aroop_gang...@apple.com.invalid> wrote: >>>>> >>>>> [resending due to bounce warning from the other email] >>>>> >>>>> >>>>> Hi Team >>>>> >>>>> I thought this was simple, but I am just missing something here. Any >>>>> guidance would be very appreciated. >>>>> >>>>> What have I done so far: >>>>> 1. I have created a custom querParser (class SamplePluggin extends >>>>> QParserPlugin { ), which right now does nothing but logs an info message, >>>>> and returns a new LuceneQParser() instance with the same parameters. >>>>> 2. I am on solr 7.5 and I have added the path to the jar and >>>>> referenced the plugin in the following ways in my solrconfig.xml: >>>>> >>>>> <lib path="/Users/aroopganguly/libs/test-plugins-aroop-all.jar" /> >>>>> <queryParser name="sampleparser" >>>>> class="com.aroop.plugins.SamplePluggin"/> >>>>> >>>>> Now when I create a collection with this solrconfig, I keep getting this >>>>> exception stack: >>>>> I have tried debugging the live solr instance and for the life of me, I >>>>> cannot understand why am I getting this cast exception >>>>> 2019-02-11 03:57:10.410 ERROR (qtp1594873248-62) [c:cvp2 s:shard1 >>>>> r:core_node2 x:testCollection_shard1_replica_n1] >>>>> o.a.s.h.RequestHandlerBase org.apache.solr.common.SolrException: Error >>>>> CREATEing SolrCore 'testCollection_shard1_replica_n1': Unable to create >>>>> core [testCollection_shard1_replica_n1] Caused by: class >>>>> com.aroop.plugins.SamplePluggin >>>>> at org.apache.solr.core.CoreContainer.create(CoreContainer.java:1087) >>>>> at >>>>> org.apache.solr.handler.admin.CoreAdminOperation.lambda$static$247(CoreAdminOperation.java:92) >>>>> at >>>>> org.apache.solr.handler.admin.CoreAdminOperation.execute(CoreAdminOperation.java:360) >>>>> at >>>>> org.apache.solr.handler.admin.CoreAdminHandler$CallInfo.call(CoreAdminHandler.java:395) >>>>> at >>>>> org.apache.solr.handler.admin.CoreAdminHandler.handleRequestBody(CoreAdminHandler.java:180) >>>>> at >>>>> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:199) >>>>> at >>>>> org.apache.solr.servlet.HttpSolrCall.handleAdmin(HttpSolrCall.java:734) >>>>> at >>>>> org.apache.solr.servlet.HttpSolrCall.handleAdminRequest(HttpSolrCall.java:715) >>>>> at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:496) >>>>> at >>>>> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:377) >>>>> at >>>>> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:323) >>>>> at >>>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634) >>>>> at >>>>> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533) >>>>> at >>>>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) >>>>> at >>>>> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) >>>>> at >>>>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) >>>>> at >>>>> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) >>>>> at >>>>> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) >>>>> at >>>>> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) >>>>> at >>>>> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1317) >>>>> at >>>>> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) >>>>> at >>>>> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) >>>>> at >>>>> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564) >>>>> at >>>>> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) >>>>> at >>>>> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219) >>>>> at >>>>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) >>>>> at >>>>> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219) >>>>> at >>>>> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126) >>>>> at >>>>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) >>>>> at >>>>> org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335) >>>>> at >>>>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) >>>>> at org.eclipse.jetty.server.Server.handle(Server.java:531) >>>>> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352) >>>>> at >>>>> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) >>>>> at >>>>> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281) >>>>> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) >>>>> at >>>>> org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) >>>>> at >>>>> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) >>>>> at >>>>> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) >>>>> at >>>>> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) >>>>> at >>>>> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) >>>>> at >>>>> org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) >>>>> at >>>>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762) >>>>> at >>>>> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680) >>>>> at java.lang.Thread.run(Thread.java:745) >>>>> Caused by: org.apache.solr.common.SolrException: Unable to create core >>>>> [testCollection_shard1_replica_n1] >>>>> at >>>>> org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1159) >>>>> at org.apache.solr.core.CoreContainer.create(CoreContainer.java:1048) >>>>> ... 44 more >>>>> Caused by: org.apache.solr.common.SolrException: Error Instantiating >>>>> queryParser, com.aroop.plugins.SamplePluggin failed to instantiate >>>>> org.apache.solr.search.QParserPlugin >>>>> at org.apache.solr.core.SolrCore.<init>(SolrCore.java:1014) >>>>> at org.apache.solr.core.SolrCore.<init>(SolrCore.java:869) >>>>> at >>>>> org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1138) >>>>> ... 45 more >>>>> Caused by: org.apache.solr.common.SolrException: Error Instantiating >>>>> queryParser, com.aroop.plugins.SamplePluggin failed to instantiate >>>>> org.apache.solr.search.QParserPlugin >>>>> at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:813) >>>>> at org.apache.solr.core.PluginBag.createPlugin(PluginBag.java:141) >>>>> at org.apache.solr.core.PluginBag.init(PluginBag.java:277) >>>>> at org.apache.solr.core.PluginBag.init(PluginBag.java:266) >>>>> at org.apache.solr.core.SolrCore.<init>(SolrCore.java:963) >>>>> ... 47 more >>>>> Caused by: java.lang.ClassCastException: class >>>>> com.aroop.plugins.SamplePluggin >>>>> at java.lang.Class.asSubclass(Class.java:3404) >>>>> at >>>>> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:541) >>>>> at >>>>> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:488) >>>>> at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:792) >>>>> ... 51 more >>>>> >>>>> Aroop Ganguly >>>>> Siri Data | Metrics Platform >>>>> >>>