java.lang.ArrayIndexOutOfBoundsException: 2

Spring JIRA | Stephen Baishya | 1 decade ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Trying to access a Velocity view results in the following log: ---------------------------------------------------------------------- 12:02:30,207 ERROR [Engine] StandardWrapperValve[spring]: Servlet.service() forservlet spring threw exception java.lang.ArrayIndexOutOfBoundsException: 2 at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:196) at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:474) at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:108) at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:112) at org.springframework.beans.factory.BeanFactoryUtils.beanOfTypeIncludingAncestors(BeanFactoryUtils.java:141) at org.springframework.web.servlet.view.velocity.VelocityView.initApplicationContext(VelocityView.java:182) at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:79) at org.springframework.web.servlet.view.AbstractCachingViewResolver.loadAndConfigureView(AbstractCachingViewResolver.java:123) at org.springframework.web.servlet.view.AbstractCachingViewResolver.resolveViewName(AbstractCachingViewResolver.java:78) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:663) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:562) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:321) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at uk.co.britannia.releasemanagement.logging.LogFilter.doFilter(LogFilter.java:25) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:44) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:169) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:534) ---------------------------------------------------------------------- Line 196 of DefaultListableBeanFactory.java reads logger.debug("Ignoring match to abstract bean definition '" + beanNames[i] + "'"); However, since the block of code containing this is actually iterating through the array 'factoryNames', I suspect that line 196 should read logger.debug("Ignoring match to abstract bean definition '" + factoryNames[i] + "'");

    Spring JIRA | 1 decade ago | Stephen Baishya
    java.lang.ArrayIndexOutOfBoundsException: 2
  2. 0

    Trying to access a Velocity view results in the following log: ---------------------------------------------------------------------- 12:02:30,207 ERROR [Engine] StandardWrapperValve[spring]: Servlet.service() forservlet spring threw exception java.lang.ArrayIndexOutOfBoundsException: 2 at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:196) at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:474) at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:108) at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:112) at org.springframework.beans.factory.BeanFactoryUtils.beanOfTypeIncludingAncestors(BeanFactoryUtils.java:141) at org.springframework.web.servlet.view.velocity.VelocityView.initApplicationContext(VelocityView.java:182) at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:79) at org.springframework.web.servlet.view.AbstractCachingViewResolver.loadAndConfigureView(AbstractCachingViewResolver.java:123) at org.springframework.web.servlet.view.AbstractCachingViewResolver.resolveViewName(AbstractCachingViewResolver.java:78) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:663) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:562) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:321) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at uk.co.britannia.releasemanagement.logging.LogFilter.doFilter(LogFilter.java:25) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:44) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:169) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:534) ---------------------------------------------------------------------- Line 196 of DefaultListableBeanFactory.java reads logger.debug("Ignoring match to abstract bean definition '" + beanNames[i] + "'"); However, since the block of code containing this is actually iterating through the array 'factoryNames', I suspect that line 196 should read logger.debug("Ignoring match to abstract bean definition '" + factoryNames[i] + "'");

    Spring JIRA | 1 decade ago | Stephen Baishya
    java.lang.ArrayIndexOutOfBoundsException: 2

    Root Cause Analysis

    1. java.lang.ArrayIndexOutOfBoundsException

      2

      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType()
    2. Spring Beans
      DefaultListableBeanFactory.getBeansOfType
      1. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:196)
      1 frame
    3. Spring Context
      AbstractApplicationContext.getBeansOfType
      1. org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:474)
      1 frame
    4. Spring Beans
      BeanFactoryUtils.beanOfTypeIncludingAncestors
      1. org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:108)
      2. org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:112)
      3. org.springframework.beans.factory.BeanFactoryUtils.beanOfTypeIncludingAncestors(BeanFactoryUtils.java:141)
      3 frames
    5. Spring MVC
      VelocityView.initApplicationContext
      1. org.springframework.web.servlet.view.velocity.VelocityView.initApplicationContext(VelocityView.java:182)
      1 frame
    6. Spring Context
      ApplicationObjectSupport.setApplicationContext
      1. org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:79)
      1 frame
    7. Spring MVC
      FrameworkServlet.service
      1. org.springframework.web.servlet.view.AbstractCachingViewResolver.loadAndConfigureView(AbstractCachingViewResolver.java:123)
      2. org.springframework.web.servlet.view.AbstractCachingViewResolver.resolveViewName(AbstractCachingViewResolver.java:78)
      3. org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:663)
      4. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:562)
      5. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:321)
      5 frames
    8. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      1 frame
    9. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      2 frames
    10. uk.co.britannia
      LogFilter.doFilter
      1. uk.co.britannia.releasemanagement.logging.LogFilter.doFilter(LogFilter.java:25)
      1 frame
    11. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      2 frames
    12. JBoss Application Server Tomcat
      ReplyHeaderFilter.doFilter
      1. org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
      1 frame
    13. Glassfish Core
      StandardValveContext.invokeNext
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      4. org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      5. org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      6. org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
      7. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
      8. org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      8 frames
    14. JBoss Application Server Tomcat
      CustomPrincipalValve.invoke
      1. org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:44)
      1 frame
    15. Glassfish Core
      StandardValveContext.invokeNext
      1. org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      2. org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
      3. org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      3 frames
    16. JBoss Application Server Tomcat
      SecurityAssociationValve.invoke
      1. org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:169)
      1 frame
    17. Glassfish Core
      ContainerBase.invoke
      1. org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      2. org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      3. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
      4. org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      5. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
      6. org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      7. org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      8. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      9. org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      10. org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      11. org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
      11 frames
    18. org.apache.coyote
      CoyoteAdapter.service
      1. org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
      1 frame
    19. Grizzly HTTP
      TcpWorkerThread.runIt
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
      2. org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
      3. org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
      3 frames
    20. Tomcat Util
      ThreadPool$ControlRunnable.run
      1. org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
      1 frame
    21. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:534)
      1 frame