代码在测试用例中工作正常,但在通过HTTP

时间:2017-11-02 16:35:12

标签: java arrays elasticsearch-5

我有一些代码在从测试用例调用时工作正常,但是当我通过HTTP调用它时(使用get请求)我得到一个奇怪的错误:

ArrayStoreException occured : org.apache.http.impl.cookie.RFC2965VersionAttributeHandler

有没有人对导致这种情况的原因有任何想法?

违规代码(已删除日志记录)如下所示:

public static void deleteIndex(String companyKey, String regionKey) throws IOException {
    RestClient client = Elasticsearch.getClient();
    HttpEntity query = createQueryForDelete(companyKey, regionKey);
    Response response = client.performRequest(
        "POST", "/products/_delete_by_query", new HashMap<String, String>(), query);
}

违规行为:

        Response response = client.performRequest(
        "POST", "/products/_delete_by_query", new HashMap<String, String>(), query);

我已经构建了一个显式调用控制器的测试用例,并且工作正常。所以我不认为它与代码有关,而是与HTTP的工作方式有关。但由于功能代码全部在模型中而不是在控制器中,我无法想象它的区别是什么。

控制器看起来像这样:

public static void deleteIndex(String companyKey, String regionKey) throws IOException {
    ElasticIndex.deleteIndex(companyKey,regionKey);
}

ElasticIndex.deleteIndex是上面最初定义的方法。

关于如何引起ArrayStoreException的任何线索,将不胜感激。

完整的堆栈跟踪是:

  

执行异常(在/app/models/ElasticSearch/ElasticIndex.java中   第98行附近)发生ArrayStoreException:   org.apache.http.impl.cookie.RFC2965VersionAttributeHandler

     

play.exceptions.JavaExecutionException:   org.apache.http.impl.cookie.RFC2965VersionAttributeHandler at   play.mvc.ActionInvoker.invoke(ActionInvoker.java:231)at   Invocation.HTTP请求(播放!)引起:   java.lang.ArrayStoreException:   org.apache.http.impl.cookie.RFC2965VersionAttributeHandler at   org.apache.http.impl.cookie.DefaultCookieSpecProvider.create(DefaultCookieSpecProvider.java:92)     在   org.apache.http.client.protocol.RequestAddCookies.process(RequestAddCookies.java:152)     在   org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:133)     在   org.apache.http.impl.nio.client.MainClientExec.prepareRequest(MainClientExec.java:520)     在   org.apache.http.impl.nio.client.MainClientExec.prepare(MainClientExec.java:146)     在   org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.start(DefaultClientExchangeHandlerImpl.java:124)     在   org.apache.http.impl.nio.client.InternalHttpAsyncClient.execute(InternalHttpAsyncClient.java:141)     在   org.elasticsearch.client.RestClient.performRequestAsync(RestClient.java:343)     在   org.elasticsearch.client.RestClient.performRequestAsync(RestClient.java:325)     在   org.elasticsearch.client.RestClient.performRequest(RestClient.java:218)     在   org.elasticsearch.client.RestClient.performRequest(RestClient.java:191)     在   models.ElasticSearch.ElasticIndex.deleteIndex(ElasticIndex.java:98)     在   models.ElasticSearch.ElasticIndex.deleteIndex(ElasticIndex.java:78)     在controllers.Application.deleteIndex(Application.java:304)at   play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:544)     在play.mvc.ActionInvoker.invoke(ActionInvoker.java:494)at   play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:489)     在   play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:458)     at play.mvc.ActionInvoker.invoke(ActionInvoker.java:162)... 1更多

0 个答案:

没有答案
相关问题