Solr 7.7.1 Junit failure with ArrayIndexOutOfBoundsException on CoreContainer.createAndLoad call

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Solr 7.7.1 Junit failure with ArrayIndexOutOfBoundsException on CoreContainer.createAndLoad call

Irfan Nagoo
Hi,

We are getting ArrayIndexOutOfBoundsException from the Solr core library on calling CoreContainer.createAndLoad API while executing a Junit test case through gradle. We can see from the logs that solr.xml is getting initialized. Here is the code that we have in the Junit which is causing this issue:

CoreContainer container = CoreContainer.createAndLoad(Paths.get(SOLR_HOME.getAbsolutePath()), Paths.get(solrConfig.getURI()));
EmbeddedSolrServer  solrServer = new EmbeddedSolrServer(container, CORE_NAME);


Here is the exception stacktrack we get when the test case is executed:

java.lang.ArrayIndexOutOfBoundsException: 1
                at org.apache.solr.api.ApiSupport.registerV2(ApiSupport.java:42)
                at org.apache.solr.core.PluginBag.put(PluginBag.java:215)
                at org.apache.solr.core.PluginBag.put(PluginBag.java:194)
                at org.apache.solr.core.CoreContainer.<init>(CoreContainer.java:314)
                at org.apache.solr.core.CoreContainer.<init>(CoreContainer.java:308)
                at org.apache.solr.core.CoreContainer.<init>(CoreContainer.java:300)
                at org.apache.solr.core.CoreContainer.<init>(CoreContainer.java:296)
                at org.apache.solr.core.CoreContainer.createAndLoad(CoreContainer.java:480)
                at org.company.alpha.solr.TestSolrCoreContainer.test(TestSolrCoreContainer.java:48)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
                at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

After going through the source code of ApiSupport.registerV2, there is no array used anywhere. After doing some google, I found out that it could be due any old version of ASM jar in classpath. I tried replacing the ASM jar with 5.1 version but that didn’t work. Please let me know if anybody has any idea on this issue?


Thanks, Irfan

IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Ventiv Technology Inc., may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.
Reply | Threaded
Open this post in threaded view
|

RE: Solr 7.7.1 Junit failure with ArrayIndexOutOfBoundsException on CoreContainer.createAndLoad call

Irfan Nagoo
Hi,



I got this issue fixed. The problem was the existing bug in Jacoco plugin that we were using along with gradle to execute the test cases. It looks like the version of Jacoco that we were using didn’t go well with the “default methods in an interface” feature of Java. Here are the bug details: https://github.com/jacoco/jacoco/issues/226



We were using Jacoco 0.7.0.201403182114 version and after moving to version 0.7.1.201405082137 (which has the fix), the issue got resolved.





Thanks, Irfan



________________________________
From: Irfan Nagoo <[hidden email]>
Sent: Saturday, May 11, 2019 5:28:27 PM
To: [hidden email]
Subject: Solr 7.7.1 Junit failure with ArrayIndexOutOfBoundsException on CoreContainer.createAndLoad call

CAUTION: This email originated from outside of the VentivTech organization.


Hi,

We are getting ArrayIndexOutOfBoundsException from the Solr core library on calling CoreContainer.createAndLoad API while executing a Junit test case through gradle. We can see from the logs that solr.xml is getting initialized. Here is the code that we have in the Junit which is causing this issue:

CoreContainer container = CoreContainer.createAndLoad(Paths.get(SOLR_HOME.getAbsolutePath()), Paths.get(solrConfig.getURI()));
EmbeddedSolrServer  solrServer = new EmbeddedSolrServer(container, CORE_NAME);


Here is the exception stacktrack we get when the test case is executed:

java.lang.ArrayIndexOutOfBoundsException: 1
                at org.apache.solr.api.ApiSupport.registerV2(ApiSupport.java:42)
                at org.apache.solr.core.PluginBag.put(PluginBag.java:215)
                at org.apache.solr.core.PluginBag.put(PluginBag.java:194)
                at org.apache.solr.core.CoreContainer.<init>(CoreContainer.java:314)
                at org.apache.solr.core.CoreContainer.<init>(CoreContainer.java:308)
                at org.apache.solr.core.CoreContainer.<init>(CoreContainer.java:300)
                at org.apache.solr.core.CoreContainer.<init>(CoreContainer.java:296)
                at org.apache.solr.core.CoreContainer.createAndLoad(CoreContainer.java:480)
                at org.company.alpha.solr.TestSolrCoreContainer.test(TestSolrCoreContainer.java:48)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
                at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

After going through the source code of ApiSupport.registerV2, there is no array used anywhere. After doing some google, I found out that it could be due any old version of ASM jar in classpath. I tried replacing the ASM jar with 5.1 version but that didn’t work. Please let me know if anybody has any idea on this issue?


Thanks, Irfan

IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Ventiv Technology Inc., may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.
IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Ventiv Technology Inc., may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.