title: logic:iterate throws javax.servlet.jsp.JspException: Cannot create iterator for this collection
body: <p>When i execute my application, i have an error.</p>
  
  <p>The problem could not come from a wrong version of taglib ?</p>
  
  <p><strong><em>Error:</em></strong></p>
  
  <blockquote>
    <p>Caused by: javax.servlet.ServletException:
    javax.servlet.jsp.JspException: ServletException in 'menu.jsp':
    javax.servlet.jsp.JspException: Cannot create iterator for this
    collection</p>
  </blockquote>
  
  <p><strong><em>my menu is populate in my java application:</em></strong></p>
  
  <p><a href="https://i.stack.imgur.com/FNiM3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FNiM3.png" alt="enter image description here"></a></p>
  
  <p><strong><em>My JSP:</em></strong></p>
  
  <pre><code>&lt;%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%&gt;
  &lt;%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html"%&gt;
  &lt;%@ taglib uri="http://struts.apache.org/tags-bean-el" prefix="bean"%&gt;
  &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt;
  &lt;%@ taglib uri="http://struts.apache.org/tags-logic-el" prefix="logic"%&gt;
  &lt;%@ taglib tagdir="/WEB-INF/tags/" prefix="customTag"%&gt;
  
  &lt;customTag:OverlayEntry id="overlaymenu" function="overlaymenu" /&gt;
  
  &lt;script type="text/javascript"
      src="&lt;html:rewrite page="/javascript/jquery.easing.js"/&gt;"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"
      src="&lt;html:rewrite page="/javascript/jquery.accordion.js"/&gt;"&gt;&lt;/script&gt;
  &lt;link href="&lt;html:rewrite page="/css/menu.css"/&gt;" rel="stylesheet"
      type="text/css" /&gt;
  
  &lt;logic:present name="UserSession" property="menu"&gt;
          &lt;ul id="navigation"&gt;
              &lt;logic:iterate id="t" collection="${UserSession.menu.menuEntries}"
                  indexId="idx"&gt;
                  &lt;customTag:MenuEntry
                      entry="&lt;%=(com.sodifrance.apex.presentation.generic.session.MenuEntry) t%&gt;" /&gt;
              &lt;/logic:iterate&gt;
          &lt;/ul&gt;
  &lt;/logic:present&gt;
  &lt;script type="text/javascript"&gt;
      jQuery('.current').parent().parent().prev('A').addClass('selected');
      jQuery('#navigation&gt;li&gt;A[href]').addClass('head2');
  
      jQuery('#navigation').Accordion({
          header : '.head',
          navigation : false,
          event : 'click',
          autoheight : false,
          animated : false,
          active : '.selected',
          selectedClass : 'selected',
          alwaysOpen : true
      });
  
      jQuery('#navigation&gt;li&gt;A.current').addClass('currentHead').removeClass(
              'current');
  &lt;/script&gt;
  </code></pre>
  
  <p><strong><em>my web.xml</em></strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://xmlns.jcp.org/xml/ns/javaee"
      xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
      version="3.1"&gt;
  
      &lt;display-name&gt;APP&lt;/display-name&gt;
      &lt;description&gt;Application&lt;/description&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;applicationFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;com.presentation.generic.security.ApplicationFilter&lt;/filter-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;exclusions&lt;/param-name&gt;
              &lt;param-value&gt;/generic/authentification/Login.do,
                  /generic/authentification/login_action.do,
                  /generic/authentification/Disconnect.do,
                  *.js,
                  *.css,
                  *.jpg,
                  *.gif,
                  *.png,
                  *.ico
              &lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;loginUrl&lt;/param-name&gt;
              &lt;param-value&gt;/generic/authentification/Login.do&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/filter&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;EncodingFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;com.presentation.generic.security.EncodingFilter&lt;/filter-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;encoding&lt;/param-name&gt;
              &lt;param-value&gt;ISO-8859-15&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;forceEncoding&lt;/param-name&gt;
              &lt;param-value&gt;true&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;applicationFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;EncodingFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
      &lt;session-config&gt;
          &lt;session-timeout&gt;30&lt;/session-timeout&gt;
      &lt;/session-config&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;com.presentation.generic.back.BirtEngineListener&lt;/listener-class&gt;
      &lt;/listener&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;action&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.apache.struts.action.ActionServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;config&lt;/param-name&gt;
              &lt;param-value&gt;/WEB-INF/struts-config.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;debug&lt;/param-name&gt;
              &lt;param-value&gt;2&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;detail&lt;/param-name&gt;
              &lt;param-value&gt;2&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;initDB&lt;/servlet-name&gt;
          &lt;servlet-class&gt;com.metier.init.DbInitializerServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;debug&lt;/param-name&gt;
              &lt;param-value&gt;true&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/servlet&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;birtEngineServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;com.report.generic.BirtServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;action&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;!--    &lt;servlet-mapping&gt; --&gt;
  &lt;!--        &lt;servlet-name&gt;jsp&lt;/servlet-name&gt; --&gt;
  &lt;!--        &lt;url-pattern&gt;/javascript/generic/messages.js&lt;/url-pattern&gt; --&gt;
  &lt;!--    &lt;/servlet-mapping&gt; --&gt;
  &lt;!--    &lt;servlet-mapping&gt; --&gt;
  &lt;!--        &lt;servlet-name&gt;jsp&lt;/servlet-name&gt; --&gt;
  &lt;!--        &lt;url-pattern&gt;*.css&lt;/url-pattern&gt; --&gt;
  &lt;!--    &lt;/servlet-mapping&gt; --&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;initDB&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/initDB&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p><strong><em>Action Class:</em></strong></p>
  
  <p>public ActionForward logInApplication_loginAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
      ActionForward actionForward = null;
      if (form != null) {
          LoginAction returnCode;
          LoginForm currentForm = (LoginForm) form;
          // execute code on exit of current page
          currentForm.onExit();</p>
  
  <pre><code>    UserSession session = null;
      AccueilForm accueilForm = new AccueilForm();
  
      if (validateLogin(currentForm, request)) {
          session = new UserSession();
          SessionHelper.getDefault().registerSession(session);
  
          initializeUserSession(currentForm, session);
  
          returnCode = LoginAction.LOGIN_SUCCESS;
      } else {
          ActionErrors e = new ActionErrors();
          e.add("property", new ActionMessage("authentification.Login.action.login.failed", Math.floor(Math.random() * 4)));
          addErrors(request, e);
          returnCode = LoginAction.LOGIN_FAIL;
      }
  
      switch (returnCode) {
          case LOGIN_FAIL:
              request.setAttribute(LoginForm.BEAN_NAME,currentForm);
              // execute code on entry of next page
              currentForm.onEntry();
              actionForward = mapping.findForward("LOGINACTION_LOGIN_FAIL");
              break;
  
          case LOGIN_SUCCESS:
              session.setLogin(currentForm.getLogin());
              request.getSession().setAttribute("UserSession", session);
              accueilForm.onEntry();
              request.setAttribute(AccueilForm.BEAN_NAME, accueilForm);
              actionForward = mapping.findForward("LOGINACTION_LOGIN_SUCCESS");
              break;
  
          default:
              break;
      }
  }
  return actionForward;
  </code></pre>
  
  <p>}</p>
  
  <p><strong><em>my configuration:</em></strong></p>
  
  <ul>
  <li>Tomcat 8</li>
  <li>Struts 1.3.10</li>
  <li>Jdk 1.8</li>
  </ul>