Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Manoj Satyagi
Log 4j Issue in Liferay 6.1.0-ce-ga1
17 de abril de 2012 22:33
Respuesta

Manoj Satyagi

Ranking: Junior Member

Mensajes: 26

Fecha de incorporación: 6 de abril de 2012

Mensajes recientes

Hi,

In my project we are using log4j for logging. In Liferay 6.0 CE & EE this project was working fine. By now when we are migrating to Liferay 6.1.0-ce-ga1 the same project WAR is causing problem during deployment. Have anyone faced similar kind of issue if so please help me in fixing the same.

Error Log:

log4j:ERROR Could not create an Appender. Reported error follows.
java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot be cast to org.apache.log4j.Appender
at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:248)
at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)
at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:191)
at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:523)
at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:492)
at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:1001)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:867)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:815)
at com.liferay.util.log4j.Log4JUtil.configureLog4J(Log4JUtil.java:79)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.initLogger(PortletHotDeployListener.java:516)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:284)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:115)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:111)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:188)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:40)
at com.liferay.portal.kernel.servlet.PortletContextListener.doPortalInit(PortletContextListener.java:101)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:52)
at com.liferay.portal.kernel.servlet.PortletContextListener.contextInitialized(PortletContextListener.java:55)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1095)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1617)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
log4j:ERROR Could not create the Layout. Reported error follows.
java.lang.ClassCastException: org.apache.log4j.PatternLayout cannot be cast to org.apache.log4j.Layout
at org.apache.log4j.xml.DOMConfigurator.parseLayout(DOMConfigurator.java:556)
at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:269)
at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)
at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:191)
at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:523)
at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:492)
at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:1001)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:867)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:815)
at com.liferay.util.log4j.Log4JUtil.configureLog4J(Log4JUtil.java:79)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.initLogger(PortletHotDeployListener.java:516)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:284)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:115)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:111)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:188)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:40)
at com.liferay.portal.kernel.servlet.PortletContextListener.doPortalInit(PortletContextListener.java:101)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:52)
at com.liferay.portal.kernel.servlet.PortletContextListener.contextInitialized(PortletContextListener.java:55)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1095)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1617)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)


Regards,
Manoj-GT
David H Nebinger
RE: Log 4j Issue in Liferay 6.1.0-ce-ga1
18 de abril de 2012 6:30
Respuesta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensajes: 9271

Fecha de incorporación: 1 de septiembre de 2006

Mensajes recientes

This is usually a class loader issue. The logger is defined for one class loader but you instantiate an instance using another class loader...
Manoj Satyagi
RE: Log 4j Issue in Liferay 6.1.0-ce-ga1
23 de abril de 2012 0:04
Respuesta

Manoj Satyagi

Ranking: Junior Member

Mensajes: 26

Fecha de incorporación: 6 de abril de 2012

Mensajes recientes

Thanks David.. We have checked and we don't have any duplicated jars in our project related to log4j.

We removed log4j jar from our project and then also while deploying same issue is coming.

Regards,
Manoj-GT
David H Nebinger
RE: Log 4j Issue in Liferay 6.1.0-ce-ga1
23 de abril de 2012 6:05
Respuesta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensajes: 9271

Fecha de incorporación: 1 de septiembre de 2006

Mensajes recientes

I'm not saying it's a jar issue, it's a class loader issue...

Logging at the point that you're trying to use it has been configured by the portal, not by the portlet. You're trying to use logging at the portlet level, and at that point log4j just has the stuff for the portal in the log4j context.

You can either reconfig log4j at the portlet level, or you can plug into the portal's logging by replacing log4j references w/ the portal's logging context as follows:

1private static final Log logger = LogFactoryUtil.getLog(MyClass.class);
Manoj Satyagi
RE: Log 4j Issue in Liferay 6.1.0-ce-ga1
25 de abril de 2012 23:01
Respuesta

Manoj Satyagi

Ranking: Junior Member

Mensajes: 26

Fecha de incorporación: 6 de abril de 2012

Mensajes recientes

Hi David the issue has been resolved after changing all the tld and dtd reference of 6.0.0 to 6.1.0 in our XML and tld files.

Really appreciate your help for your time spend for me in helping to solving the issue.

Regards,
Manoj-GT