Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-366

ArrayIndexOutOfBoundsException when loading drools spring on tomcat eclipse

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • 5.5.1.Final, 6.0.0.CR1
    • 5.5.0.Final
    • None
    • None

      Have a decision table rule which works fine with test cases under Drools-spring 5.4.0.Final or 5.5 as well.
      However while deploying the code on a Tomcat Eclipse its fails to initialize the kbase bean
      with the following stack trace.

      java.lang.ArrayIndexOutOfBoundsException: -1
      	at org.eclipse.jdt.internal.compiler.parser.Parser.consumeTypeParameters(Parser.java:7823)
      	at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:6431)
      	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9339)
      	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9571)
      	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9528)
      	at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:8126)
      	at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:712)
      	at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:377)
      	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:422)
      	at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:389)
      	at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:49)
      	at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:410)
      	at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:46)
      	at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:103)
      	at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:1194)
      	at org.drools.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:947)
      	at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:936)
      	at org.drools.compiler.PackageBuilder.addPackageFromDecisionTable(PackageBuilder.java:449)
      	at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:713)
      	at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
      	at org.drools.container.spring.beans.KnowledgeBaseBeanFactory.afterPropertiesSet(KnowledgeBaseBeanFactory.java:113)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:546)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
      	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
      	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
      	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
      	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
      	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      	at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
      	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
      	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
      	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
      	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
      Dec 5, 2013 7:34:46 PM org.apache.catalina.core.StandardContext listenerStart
      SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kbase': Invocation of init method failed; nested exception is java.lang.
      ArrayIndexOutOfBoundsException: -1
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:546)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
      	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
      	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
      	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
      	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
      	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      	at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
      	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
      	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
      	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
      	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
      Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
      	at org.eclipse.jdt.internal.compiler.parser.Parser.consumeTypeParameters(Parser.java:7823)
      	at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:6431)
      	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9339)
      	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9571)
      	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9528)
      	at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:8126)
      	at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:712)
      	at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:377)
      	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:422)
      	at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:389)
      	at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:49)
      	at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:410)
      	at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:46)
      	at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:103)
      	at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:1194)
      	at org.drools.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:947)
      	at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:936)
      	at org.drools.compiler.PackageBuilder.addPackageFromDecisionTable(PackageBuilder.java:449)
      	at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:713)
      	at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
      	at org.drools.container.spring.beans.KnowledgeBaseBeanFactory.afterPropertiesSet(KnowledgeBaseBeanFactory.java:113)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
      	... 27 more
      

      Bean config xml -

      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xmlns:drools-spring="http://drools.org/schema/drools-spring"
      	xsi:schemaLocation="http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring.xsd
      		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
      
      	<drools-spring:kbase id="kbase">
      		<drools-spring:resources>
      			<drools-spring:resource type="DTABLE" source="classpath:DummyRules.xls" >
      				<drools-spring:decisiontable-conf input-type="XLS" worksheet-name="Tables"/>
      			</drools-spring:resource>
      		</drools-spring:resources>
      	</drools-spring:kbase>
      
      	<drools-spring:ksession id="ksession" type="stateless" kbase="kbase" />
      		<bean id="connectPrivacyRule" class="foo.RulesEngine">
      		<property name="ksession" ref="ksession" />
      		<property name="kbase" ref="kbase" />
      	</bean>
      </beans>
      
      

              mfusco@redhat.com Mario Fusco
              buddharay prabuddha roy (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: