Request processing failed; nested exception is java.util.NoSuchElementException

1
0
-1

When I run a process from studio, and submit the form of application, I am getting following error:
Request processing failed; nested exception is java.util.NoSuchElementException

Following is the log trace. Anybody has any idea whats wrong here?

2016-03-03 13:42:11.146 +0530 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/designer].[dispatcher] org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/designer] threw exception [Request processing failed; nested exception is java.util.NoSuchElementException] with root cause
java.util.NoSuchElementException
at com.google.common.collect.AbstractIterator.next(AbstractIterator.java:154)
at com.google.common.collect.Iterators.find(Iterators.java:717)
at com.google.common.collect.Iterables.find(Iterables.java:646)
at org.bonitasoft.web.designer.repository.AssetRepository.findAssetPath(AssetRepository.java:138)
at org.bonitasoft.web.designer.controller.PreviewController.servePageAsset(PreviewController.java:102)
at sun.reflect.GeneratedMethodAccessor240.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

2016-03-03 15:21:42.144 +0530 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/designer] org.apache.catalina.core.ApplicationContext log
INFO: Spring WebApplicationInitializers detected on classpath: [org.bonitasoft.web.designer.SpringWebApplicationInitializer@1e094a66]
2016-03-03 15:21:42.197 +0530 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/designer] org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
2016-03-03 15:21:45.498 +0530 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/designer] org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher'

================================================

Comments

Submitted by walemark on Wed, 08/26/2020 - 06:57

The NoSuchElementException in Java is thrown when one tries to access an iterable beyond its maximum limit. This means that, this exception is thrown by various accessor methods to indicate that the element being requested does not exist . The next() method in Java returns the next element in the iteration or NoSuchElementException if the iteration has no more elements.

The solution to this exception is to check whether the next position of an iterable is filled or empty . The following methods are used to check the next position:

  • hasNext()
  • hasMoreElements()
1 answer

1
0
-1

You don't say where this is happening just that it is happening. So I will assume it's in a connector of your own writing...

Somewhere in the code you are not testing for end of Set.

When executing, say a loop on a set of elements, sometimes you need to check the size first.

See here for how to check you process code specific to this issue.

https://examples.javacodegeeks.com/java-basics/exceptions/java-util-nosuchelementexception-how-to-solve-nosuchelementexception/

regards
Seán

PS: If this reply answers your question, please mark a resolved.

Comments

Submitted by logicallimit on Fri, 03/04/2016 - 13:39

Thanks for replying. The issue was happening when I tried to run a new process defined in bonita community 7.2 by clicking on the "Run" button in studio.

The application did not open the pool contract page and showed this error.
However, this problem went away when I cleared temporary files (searched "bdm*" in c drive) created by bonita. Then I closed down bonita and restarted my pc and it started working.

Thanks for sharing that link, It has some very useful information which might be useful in troubleshooting.

Notifications