Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-50960

MailEngine.send throws java.lang.ClassNotFoundException: org.apache.commons.lang.time.StopWatch when is invoked from a portlet

    Details

      Description

      After adding LPS-45492 fix, If a portlet invokes MailEngine.send, a java.lang.ClassNotFoundException is thrown:

      09:43:31,192 ERROR [http-bio-8080-exec-9][render_portlet_jsp:132] null
      java.lang.ClassNotFoundException: org.apache.commons.lang.time.StopWatch
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
      	at com.liferay.util.mail.MailEngine.send(MailEngine.java:180)
      	at com.liferay.util.mail.MailEngine.send(MailEngine.java:423)
      	at ................ContactLocalPortlet.doView(ContactLocalPortlet.java:37)
      	at com.liferay.portal.kernel.portlet.LiferayPortlet.doDispatch(LiferayPortlet.java:213)
      	at com.liferay.util.bridges.mvc.MVCPortlet.doDispatch(MVCPortlet.java:323)
      	at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
      	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)
      	at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:55)
      	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
      	at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
      	at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:112)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      

      The root cause is that LPS-45492 add a "new StopWatch" that was missing:

       
      -		StopWatch stopWatch = null;
      +		StopWatch stopWatch = new StopWatch();
      

      This change create a new dependence between "util-java.jar" and "commons-lang.jar" (StopWatch is included at that jar) so all portlets that use MailEngine.send stop working

        Attachments

        1. reproduced.png
          reproduced.png
          4 kB
        2. lps50960.war
          366 kB
        3. lps50960_eclipse_project.zip
          373 kB
        4. fixed.png
          fixed.png
          1 kB

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 7 weeks, 3 days ago

                  Packages

                  Version Package
                  6.2.2 CE GA3
                  6.2.X EE
                  7.0.0 M3