问题:Failed to read candidate component class:nested exception is java.lang.ArrayIndexOutOfBoundsException
解决过程:
-
可能的起因
在代码中有编写
for(Book book:bookList){
// 请求格式
IndexRequest indexRequest=new IndexRequest(“books3”).id(book.getId());
// 请求里的文档内容
String doc2=JSON.toJSONString(book);
indexRequest.source(doc2,XContentType.JSON);
bulkRequest.add(indexRequest);
}
但是,在出现这个问题之前是运行正常的,后来,只是添加了一个Bookmapper、bookService(impl),接下来运行就出现了 can’t read candidate componentclass:位于target目录下的Book.class; -
猜想:不是我后来添加的内容导致报错
-
操作: 查阅时说jdk1.8应该使用spring4,所以添加了<spring.version>4.3.16.RELEASE</spring.version>;然后执行run,并Reload了maven,还是报相同的错误;之后就build moudle ,仍然报相同的错误;接下来,rebuild moudle,终于可以了。
-
结束语:所以,是一直使用了缓存里的booklist,导致数组溢出?但是后来不是build了该moudle吗?