You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Nathan Friend <nf...@wcb.pe.ca> on 2018/09/18 15:06:45 UTC

ArrayList cannot be cast to a java.lang.String

Hello,

I'm setting up a new Solr server and am running into an issues I haven't experienced in previous Solr installations.  When I navigate to a core's "Dataimport" tab (without even triggering an import request), several of the HTTP requests made by the admin UI fail.  Checking the Solr logs, I see this stacktrace:

java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.lang.String at org.apache.solr.handler.dataimport.RequestInfo.<init>(RequestInfo.java:52) at org.apache.solr.handler.dataimport.DataImportHandler.handleRequestBody(DataImportHandler.java:131) at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:195) at org.apache.solr.core.SolrCore.execute(SolrCore.java:2503) at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:711) at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:517) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:384) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:330) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1629) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) 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:190) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) 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:166) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) 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:530) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626) at java.lang.Thread.run(Thread.java:748)

This same error occurs when I begin a data import, or really any HTTP request made to the /solr/<core>/dataimport* endpoint.

It dug through the source and found the line where this is happening: https://github.com/apache/lucene-solr/blob/1d85cd783863f75cea133fb9c452302214165a4d/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/RequestInfo.java#L52

if (requestParams.containsKey("command")) { 
    command = (String) requestParams.get("command");
}
My best guess is that the "command" parameter is somehow being included twice in request and is coming through as an ArrayList instead of a String.  In my solrconfig.xml, I define my "dataimportfull" handler like so:

<requestHandler name="/dataimportfull" class="solr.DataImportHandler">
    <lst name="defaults">
	    <str name="config">./DIHconfig.xml</str>
	    <str name="echoParams">explicit</str>
	    <str name="wt">json</str>
	    <str name="indent">true</str>
	    <str name="importType">full</str>
	    <str name="command">full-import</str>
	    <str name="commit">true</str>
	    <str name="clean">true</str>
	    <str name="update.chain">add-unknown-fields-to-the-schema</str>
    </lst>
</requestHandler>

I tried removing the "command" line, but the error still occurred.

The main difference between this Solr instance and other Solr servers I've set up is that this instance is running inside of a Windows Server 2016 Docker container, using an image based on openjdk:8-jdk-windowsservercore-ltsc2016
( https://hub.docker.com/_/openjdk/) .  Inside this container, I'm running Solr 7.3.1.

Any ideas as to what might be causing this error?

Thanks,

Nathan

-------------------------
Statement of Confidentiality
This message (including attachments) may contain confidential or privileged information intended for a specific individual or organization. If you have received this communication in error, please notify the sender immediately. If you are not the intended recipient, you are not authorized to use, disclose, distribute, copy, print or rely on this email, and should promptly delete this email from your entire computer system.