OpenNMS Web User Interface Has Experienced an Error: java.lang.IndexOutOfBoundsException: getThreshold: Index value '0' not in range [0..-1]

Description

Started collection WMI data from Windows host and trying to setup threshold alerts the way it's already down with SNMP data. When I click "Save", it fails.

Settings used (no UEI for now) was:

Type: low
Datasource: wmiLDPctFreeSpace
Type: Windows Logical Disk
Label: _Total
Value: 70.0
Re-arm: 80.0
Trigger: 1

Exception Trace

java.lang.IndexOutOfBoundsException: getThreshold: Index value '0' not in range [0..-1]
at org.opennms.netmgt.config.threshd.Group.getThreshold(Group.java:290)
at org.opennms.web.controller.admin.thresholds.ThresholdController.finishThresholdEdit(ThresholdController.java:596)
at org.opennms.web.controller.admin.thresholds.ThresholdController.handleRequestInternal(ThresholdController.java:146)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at org.extremecomponents.table.filter.AbstractExportFilter.doFilter(AbstractExportFilter.java:49)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.opennms.web.StoreRequestPropertiesFilter.doFilter(StoreRequestPropertiesFilter.java:80)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
at org.opennms.web.springframework.security.AuthFilterEnabler.doFilterHttp(AuthFilterEnabler.java:111)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:278)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

Request Details
Locale en_US
Method POST
Path Info null
Path Info (translated) null
Protocol HTTP/1.1
URI /opennms/errors/unknownexception.jsp
URL http://flow-eqx-ops1:8980/opennms/errors/unknownexception.jsp
Scheme http
Server Name [REMOVED]
Server Port 8980
System Details
OpenNMS Version: 1.8.5
Java Version: 1.6.0_22 Sun Microsystems Inc.
Java Virtual Machine: 17.1-b03 Sun Microsystems Inc.
Operating System: Windows Server 2008 R2 6.1 (x86)
Servlet Container: jetty/6.1.24 (Servlet Spec 2.5)
User Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.11) Gecko/20101012 Firefox/3.6.11

Environment

Win2K8R2

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Alejandro Galue August 5, 2011 at 4:39 PM

I tried to reproduce the problem without success. I create an empty threshold group and add a WMI threshold and it works. Then added a second WMI threshold definition and it also works as expected.

Could you please provide me the exact procedure you've followed in order to reproduce the problem ? Have you experienced the same problem on earlier versions?

This is really strange because when the ThresholdController is going to save a threshold (i.e., the method finishThresholdEdit is executed), it supposes that the threshold exists. Of course there are many validations involved and probably something wrong in the procedure followed to create the threshold could trigger the exception.

Let me illustrate you how it works.

Suppose that I have the following content on thresholds.xml:

If I add a new threshold, this is the current configuration of the Web Form (checking out the source code):

As you can see, the groupName is valid, the method that will be executed is finishThresholdEdit, and most important, the threshold index is also valid, because we are talking about a new threshold. This is why:

When you click on "Create New Threshold", the controller executes the method gotoNewThreshold. This method will add a new entry at the end of the selected threshold group.

BUT, because of the internal checkings that are being performed (and that's why I need to know how exactly you performed the operation), maybe a human mistake could trigger the exception, but I need to know exactly where did you click, on which order, etc.

If I click on "edit" over the first threshold definition, this is the content of the Web Form:

As you can see, isNew is now false, and thresholdIndex is 0 because we are talking about the "first" threshold definition.

I'll really appreciate your help in order to track down which is triggering the exception.

Regards,
Alejandro.

Seth Leger February 15, 2011 at 4:53 PM

This is caused because the controller is trying to edit a threshold that it looks up by index and the index cannot be found because the threshold list for the Group is empty. I'm trying to understand exactly how this controller works but it is fairly complicated. We really need to add a unit test to verify that all of the controller operations work properly.

Details

Assignee

Reporter

Components

Affects versions

Priority

PagerDuty

Created November 18, 2010 at 1:01 PM
Updated July 26, 2023 at 2:19 PM