-
Type:
Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: 6.2.X EE, 7.0.X, Master
-
Fix Version/s: 7.0.0 DXP FP39, 7.0.0 DXP SP7, 7.0.5 CE GA6, 7.0.X, 7.1.0 M1, 7.1.X, Master
-
Component/s: Core Infrastructure
-
Branch Version/s:7.0.x
-
Backported to Branch:Committed
-
Story Points:1
-
Fix Priority:4
-
Git Pull Request:
Log4j PropertyConfigurator#configure(InputStream) error message on deploying custom portlet.
Steps to Reproduce (7.x, master):
1. Start up a vanilla DXP SP 6 bundle.
2. Deploy attached cnp.test.log4j.jar.
3. Place a cnp-test-log4j portlet on the welcome page.
Result: Portlet crashes on UI and and the log complains:
java.lang.NoSuchMethodError: org.apache.log4j.PropertyConfigurator.configure(Ljava/io/InputStream;)V at cnp.test.log4j.portlet.CnpTestLog4jPortlet.render(CnpTestLog4jPortlet.java:43) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103) ...
Steps to Reproduce (6.2.x)
- Create a dummy portlet with Liferay IDE/Plugins SDK. I'm using use one of the standard plugins of Liferay as a boilerplate code, e.g. https://github.com/liferay/liferay-plugins/tree/6.2.x/portlets/calendar-portlet
- Add the following code to the #render method of the Portlet class, for example
com.liferay.calendar.portlet.CalendarPortlet.render(RenderRequest, RenderResponse)
try { InputStream is = this.getClass().getClassLoader().getResourceAsStream("log_arcade.properties"); PropertyConfigurator.configure(is); } catch (Throwable e) { // TODO Auto-generated catch block e.printStackTrace(); throw new PortletException(e); }
- Add missing Import: import org.apache.log4j.PropertyConfigurator;
- Start 6.2.x
- Build the plugin
- Add Calendar Porlet to a page
Result:
15:37:24,522 ERROR [http-bio-6211-exec-1][render_portlet_jsp:132] null java.lang.NoSuchMethodError: org.apache.log4j.PropertyConfigurator.configure(Ljava/io/InputStream;)V at com.liferay.calendar.portlet.CalendarPortlet.render(CalendarPortlet.java:258) 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:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:119) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:117) 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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:604) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:543) at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:588) at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:662) at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:369) at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1240)
PROPOSED:
Ship Portal with the appropriate version of log4j-extras.
QA/Solution Notes
In 6.2, all deployed portlets have to be re-deployed so the deployer can pick-up and include the new log4j-extras.jar in the unpacked webapps in their lib folder.
- is caused by
-
LPS-33129 Update log4J to version 1.2.17 (from 1.2.16) and change the PatternLayout to EnhancedPatternLayout
-
- Closed
-