Tapestry
  1. Tapestry
  2. TAPESTRY-1014

java.util.ConcurrentModificationException in portlet when trying to show ArrayList

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.0.2
    • Fix Version/s: 4.1.2
    • Component/s: Framework, Portlet
    • Labels:
      None
    • Environment:
      apache jestpeed-2.1-dev

      Description

      I've writed portlet application with tapestry 4.0.2 (using
      TapestryApplicationPortlet). I have deployed it to jetspeed-2 portal
      server. Sometimes exception is rised when some users navigates to my
      portlet (exception is described bellow).

      Sorry for my bad English.

          • EXCEPTION ***

      org.apache.hivemind.ApplicationRuntimeException
      component $View_0@65b778[View]
      context:/WEB-INF/View.page, line 7, column 63

      2
      location 3 <!DOCTYPE page-specification PUBLIC
      4 "-//Apache Software Foundation//Tapestry Specification 4.0
      //EN"
      5 "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
      6
      7 <page-specification
      class="net.mycompany.portal.news.NewsListData">
      8
      9 <component id="newslinelist" type="For">
      10 <binding name="source" value="newslist"/>
      11 <binding name="value" value="news"/>
      12 <binding name="element" value="literal:tr"/>

      java.util.ConcurrentModificationException
      java.util.AbstractList$Itr.checkForComodification(Unknown Source)
      java.util.AbstractList$Itr.next(Unknown Source)
      org.apache.tapestry.components.ForBean.renderComponent(ForBean.java:125)
      org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
      org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:92)
      org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
      org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:275)
      org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:366)
      org.apache.tapestry.portlet.PortletRendererImpl.renderPage(PortletRendererImpl.java:76)
      $PortletRenderer_10c7c3c1767.renderPage($PortletRenderer_10c7c3c1767.java)
      org.apache.tapestry.portlet.PortletHomeService.service(PortletHomeService.java:80)
      $IEngineService_10c7c3c1751.service($IEngineService_10c7c3c1751.java)
      org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:66)
      org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:248)
      org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:60)
      $WebRequestServicer_10c7c3c171f.service($WebRequestServicer_10c7c3c171f.java)
      $WebRequestServicer_10c7c3c171d.service($WebRequestServicer_10c7c3c171d.java)
      org.apache.tapestry.portlet.RenderRequestServicerToWebRequestServicerBridge.service(RenderRequestServicerToWebRequestServicerBridge.java:49)
      $RenderRequestServicer_10c7c3c1717.service($RenderRequestServicer_10c7c3c1717.java)
      $RenderRequestServicer_10c7c3c1711.service($RenderRequestServicer_10c7c3c1711.java)
      org.apache.tapestry.portlet.ApplicationPortlet.render(ApplicationPortlet.java:161)
      org.apache.jetspeed.factory.JetspeedPortletInstance.render(JetspeedPortletInstance.java:102)
      org.apache.jetspeed.container.JetspeedContainerServlet.doGet(JetspeedContainerServlet.java:230)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
      org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
      org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
      org.apache.jetspeed.container.invoker.ServletPortletInvoker.invoke(ServletPortletInvoker.java:215)
      org.apache.jetspeed.container.invoker.ServletPortletInvoker.render(ServletPortletInvoker.java:126)
      org.apache.pluto.PortletContainerImpl.renderPortlet(PortletContainerImpl.java:119)
      org.apache.jetspeed.container.JetspeedPortletContainerWrapper.renderPortlet(JetspeedPortletContainerWrapper.java:120)
      org.apache.jetspeed.aggregator.impl.RenderingJobImpl.execute(RenderingJobImpl.java:121)
      org.apache.jetspeed.aggregator.impl.PortletRendererImpl.renderNow(PortletRendererImpl.java:120)
      org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(PageAggregatorImpl.java:199)
      org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(PageAggregatorImpl.java:182)
      org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.build(PageAggregatorImpl.java:106)
      org.apache.jetspeed.aggregator.AggregatorValve.invoke(AggregatorValve.java:48)
      org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
      org.apache.jetspeed.decoration.DecorationValve.invoke(DecorationValve.java:110)
      org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
      org.apache.jetspeed.pipeline.valve.impl.ActionValveImpl.invoke(ActionValveImpl.java:147)
      org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
      org.apache.jetspeed.container.ContainerValve.invoke(ContainerValve.java:76)
      org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
      org.apache.jetspeed.profiler.impl.ProfilerValveImpl.invoke(ProfilerValveImpl.java:255)
      org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
      org.apache.jetspeed.security.impl.LoginValidationValveImpl.invoke(LoginValidationValveImpl.java:159)
      org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
      org.apache.jetspeed.security.impl.PasswordCredentialValveImpl.invoke(PasswordCredentialValveImpl.java:149)
      org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
      org.apache.jetspeed.localization.impl.LocalizationValveImpl.invoke(LocalizationValveImpl.java:169)
      org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
      org.apache.jetspeed.security.impl.AbstractSecurityValve$1.run(AbstractSecurityValve.java:117)
      java.security.AccessController.doPrivileged(Native Method)
      javax.security.auth.Subject.doAsPrivileged(Unknown Source)
      org.apache.jetspeed.security.impl.AbstractSecurityValve.invoke(AbstractSecurityValve.java:111)
      org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
      org.apache.jetspeed.container.url.impl.PortalURLValveImpl.invoke(PortalURLValveImpl.java:67)
      org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
      org.apache.jetspeed.capabilities.impl.CapabilityValveImpl.invoke(CapabilityValveImpl.java:128)
      org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
      org.apache.jetspeed.pipeline.JetspeedPipeline.invoke(JetspeedPipeline.java:145)
      org.apache.jetspeed.engine.JetspeedEngine.service(JetspeedEngine.java:214)
      org.apache.jetspeed.engine.JetspeedServlet.doGet(JetspeedServlet.java:238)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      java.lang.Thread.run(Unknown Source)

              • View.html *****

      <table cellspacing="2">
      <tr jwcid="newslinelist">
      <td><span jwcid="date">date</span></td>
      <td><a href="" jwcid="newsLink"><span
      jwcid="title">title</span></a></td>
      </tr>
      </table>

              • View.page *****

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE page-specification PUBLIC
      "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
      "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">

      <page-specification class="net.mycompany.portal.news.NewsListData">

      <component id="newslinelist" type="For">
      <binding name="source" value="newslist"/>
      <binding name="value" value="news"/>
      <binding name="element" value="literal:tr"/>
      </component>

      <component id="date" type="Insert">
      <binding name="value" value="news.date"/>
      </component>

      <component id="title" type="Insert">
      <binding name="value" value="news.title"/>
      </component>

      <component id="newsLink" type="GenericLink">
      <binding name="href" value="news.newsURL"/>
      </component>

      </page-specification>

              • View.java *****

      package net.mycompany.portal.news.newslist;

      import java.sql.Connection;
      import java.sql.PreparedStatement;
      import java.sql.ResultSet;
      import java.sql.SQLException;
      import java.text.SimpleDateFormat;
      import java.util.ArrayList;
      import java.util.Date;
      import java.util.List;

      import net.mycompany.portal.utils.DBUtils;

      import org.apache.tapestry.annotations.InjectObject;
      import org.apache.tapestry.html.BasePage;
      import org.apache.tapestry.web.WebRequest;

      public abstract class NewsListData extends BasePage {

      @InjectObject("infrastructure:request")
      public abstract WebRequest getWebRequest();

      public String getCurrentDate() {
      String curDateStr = getWebRequest().getParameterValue("date");
      if (curDateStr != null)

      { curDateStr = curDateStr.trim(); }

      else
      curDateStr = "";
      return curDateStr;
      }

      public List getNewslist() {
      List<News> newslist = new ArrayList<News>();
      ResultSet rs = null;
      PreparedStatement ps = null;
      Connection connection = null;

      try

      { connection = DBUtils.getDB2Connection(); }

      catch (Exception e)

      { e.printStackTrace(); }


      if (connection != null) {
      try {
      ps = connection.prepareStatement("select viewfrom,title,identifier from MYCOMPANY.tb_documents where date(viewFrom) = ? order by VIEWFROM");
      ps.setDate(1, DBUtils.StringToSQLDate(getCurrentDate(), "yyyyMMdd"));
      rs = ps.executeQuery();
      while (rs.next())

      { newslist.add(new News((rs.getTime(1)).toString(), rs.getString(2), rs.getString(3))); }


      } catch (Exception e)

      { e.printStackTrace(); }

      finally {
      try

      { ps.close(); rs.close(); connection.close(); }

      catch (SQLException e)

      { e.printStackTrace(); }


      }
      }
      return newslist;
      }

      public abstract News getNews();
      }

              • web.xml *****

      <!DOCTYPE web-app
      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd">
      <web-app>
      <display-name>app</display-name>
      <servlet>
      <servlet-name>ApplicationServlet</servlet-name>
      <servlet-class>
      org.apache.tapestry.ApplicationServlet
      </servlet-class>
      </servlet>
      <servlet>
      <servlet-name>HibernateServlet</servlet-name>
      <servlet-class>
      net.mycompany.portal.news.HibernateServlet
      </servlet-class>
      </servlet>
      <servlet-mapping>
      <servlet-name>HibernateServlet</servlet-name>
      <url-pattern>/servlet/HibernateServlet</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>ApplicationServlet</servlet-name>
      <url-pattern>/app</url-pattern>
      </servlet-mapping>
      <resource-ref>
      <description>DB Connection Pool</description>
      <res-ref-name>jdbc/MYCOMPANYOnline</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

              • portlet.xml *****

      <portlet-app version="1.0"
      xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
      http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
      <portlet>
      <description xml:lang="EN"></description>
      <portlet-name>NewsContent</portlet-name>
      <display-name xml:lang="EN">NewsContent</display-name>
      <portlet-class>
      org.apache.tapestry.portlet.ApplicationPortlet
      </portlet-class>
      <expiration-cache>0</expiration-cache>
      <supports>
      <mime-type>text/html</mime-type>
      <portlet-mode>view</portlet-mode>
      <portlet-mode>help</portlet-mode>
      </supports>
      <supported-locale>en</supported-locale>
      <portlet-info>
      <title>NewsContent</title>
      <short-title>NewsContent</short-title>
      <keywords></keywords>
      </portlet-info>
      </portlet>
      <portlet>
      <description xml:lang="EN"></description>
      <portlet-name>NewsLine</portlet-name>
      <display-name xml:lang="EN">NewsLine</display-name>
      <portlet-class>
      org.apache.tapestry.portlet.ApplicationPortlet
      </portlet-class>
      <expiration-cache>0</expiration-cache>
      <supports>
      <mime-type>text/html</mime-type>
      <portlet-mode>view</portlet-mode>
      <portlet-mode>help</portlet-mode>
      </supports>
      <supported-locale>en</supported-locale>
      <portlet-info>
      <title>NewsLine</title>
      <short-title>NewsLine</short-title>
      <keywords></keywords>
      </portlet-info>
      </portlet>
      </portlet-app>
      </web-app>

        Activity

        Vitaly Baranovsky created issue -
        Jesse Kuhnert made changes -
        Field Original Value New Value
        Priority Critical [ 2 ] Major [ 3 ]
        Jesse Kuhnert made changes -
        Fix Version/s 4.1.2 [ 12312202 ]
        Jesse Kuhnert made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Cannot Reproduce [ 5 ]
        Assignee Jesse Kuhnert [ jkuhnert ]
        Mark Thomas made changes -
        Workflow jira [ 12376378 ] Default workflow, editable Closed status [ 12567814 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12567814 ] jira [ 12590943 ]

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Vitaly Baranovsky
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development