Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot be ca tony kerz 7 de marzo de 2011 19:36
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b Thiago Leão Moreira 9 de marzo de 2011 14:28
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b Arsh g 30 de abril de 2011 3:09
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b Hitoshi Ozawa 30 de abril de 2011 5:08
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b Thiago Leão Moreira 30 de abril de 2011 5:37
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b Hitoshi Ozawa 30 de abril de 2011 6:52
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b JoseManuel Garcia 27 de mayo de 2011 0:32
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b Bartlomiej Knabel 7 de junio de 2011 3:11
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b Gaurang Sheladia 15 de junio de 2011 5:15
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b Thiago Leão Moreira 15 de junio de 2011 10:14
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b Gaurang Sheladia 3 de agosto de 2011 2:41
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b Vince P 11 de septiembre de 2011 18:33
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b Hector Leon Garay 16 de noviembre de 2011 11:36
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b Gwowen Fu 26 de diciembre de 2012 10:33
tony kerz
java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot be ca
7 de marzo de 2011 19:36
Respuesta

tony kerz

Ranking: New Member

Mensajes: 5

Fecha de incorporación: 6 de marzo de 2011

Mensajes recientes

anyone ever see this:


 1
 203:27:31,125 INFO  [HookHotDeployListener:394] Registering hook for liferay-custom-hook
 3log4j:ERROR Could not create an Appender. Reported error follows.
 4java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot be cast to org.apache.log4j.Appender
 5    at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:238)
 6    at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:171)
 7    at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:184)
 8    at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:502)
 9    at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:471)
10    at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:921)
11    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:790)
12    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:696)
13    at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:821)
14    at com.liferay.util.log4j.Log4JUtil.configureLog4J(Log4JUtil.java:48)
15    at com.liferay.portal.deploy.hot.HookHotDeployListener.initLogger(HookHotDeployListener.java:1105)
16    at com.liferay.portal.deploy.hot.HookHotDeployListener.doInvokeDeploy(HookHotDeployListener.java:401)
17    at com.liferay.portal.deploy.hot.HookHotDeployListener.invokeDeploy(HookHotDeployListener.java:218)
18    at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:109)
19    at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:182)
20    at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:38)
21    at com.liferay.portal.kernel.servlet.HookContextListener.contextInitialized(HookContextListener.java:36)
22    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
23    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
24    at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1244)
25    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1342)
26    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
27    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
28    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
29    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
30    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
31    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
32    at java.lang.Thread.run(Thread.java:619)
33log4j:ERROR Could not parse url [jar:file:/F:/product/liferay/liferay-portal-6.0.6/tomcat-6.0.29/webapps/liferay-custom-hook/WEB-INF/lib/portal-impl.jar!/META-INF/portal-log4j.xml].
34java.lang.NullPointerException
35    at java.util.Hashtable.put(Hashtable.java:394)
36    at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:172)
37    at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:184)
38    at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:502)
39    at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:471)
40    at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:921)
41    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:790)
42    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:696)
43    at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:821)
44    at com.liferay.util.log4j.Log4JUtil.configureLog4J(Log4JUtil.java:48)
45    at com.liferay.portal.deploy.hot.HookHotDeployListener.initLogger(HookHotDeployListener.java:1105)
46    at com.liferay.portal.deploy.hot.HookHotDeployListener.doInvokeDeploy(HookHotDeployListener.java:401)
47    at com.liferay.portal.deploy.hot.HookHotDeployListener.invokeDeploy(HookHotDeployListener.java:218)
48    at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:109)
49    at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:182)
50    at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:38)
51    at com.liferay.portal.kernel.servlet.HookContextListener.contextInitialized(HookContextListener.java:36)
52    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
53    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
54    at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1244)
55    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1342)
56    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
57    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
58    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
59    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
60    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
61    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
62    at java.lang.Thread.run(Thread.java:619)



i got it with 6.0.5 and currently with 6.0.6.

i didn't do anything fancy with a "hook" project i'm working on (e.g. add a log4j jar or anything). i have a liferay-plugin-package.properties that looks like:

 1
 2name=Liferay Custom
 3module-group-id=liferay
 4module-incremental-version=1
 5tags=
 6short-description=
 7change-log=
 8page-url=http://www.liferay.com
 9author=Liferay, Inc.
10licenses=LGPL
11portal-dependency-jars=\
12    portal-impl.jar,\
13    easyconf.jar,\
14    commons-lang.jar,\
15    commons-digester.jar,\
16    commons-configuration.jar,\
17    xstream.jar,\
18    commons-collections.jar,\
19    commons-beanutils.jar
Thiago Leão Moreira
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
9 de marzo de 2011 14:28
Respuesta

Thiago Leão Moreira

LIFERAY STAFF

Ranking: Liferay Legend

Mensajes: 1433

Fecha de incorporación: 10 de octubre de 2007

Mensajes recientes

Hey Tony,

I noticed that you added portal-impl.jar to your classpath THIS IS FORBIDDEN! Adding this jar to you plugin will make Liferay behavior not properly like the problem that you are facing.
Arsh g
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
30 de abril de 2011 3:09
Respuesta

Arsh g

Ranking: New Member

Mensajes: 11

Fecha de incorporación: 18 de febrero de 2011

Mensajes recientes

Now i am not included portal-impl.jar then also it throws

java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot be cast to org.apache.log4j.Appender
Hitoshi Ozawa
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
30 de abril de 2011 5:08
Respuesta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensajes: 7949

Fecha de incorporación: 23 de marzo de 2010

Mensajes recientes

Have you tried Googling this exception?
Check if you have any log4j settings in the WEB-INF\classes folder.
Thiago Leão Moreira
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
30 de abril de 2011 5:37
Respuesta

Thiago Leão Moreira

LIFERAY STAFF

Ranking: Liferay Legend

Mensajes: 1433

Fecha de incorporación: 10 de octubre de 2007

Mensajes recientes

Hey Tony,

This seems that you have two instances of log4j available in different classpaths. Probably one in the Global classpath and another in the Application classpath.
Hitoshi Ozawa
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
30 de abril de 2011 6:52
Respuesta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensajes: 7949

Fecha de incorporación: 23 de marzo de 2010

Mensajes recientes

When doing a Liferay .war install, I think some application server may already have log4j in it's path. The one in the portlet's WEB-INF is usually the org.apache.log4j.ConsoleAppender
JoseManuel Garcia
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
27 de mayo de 2011 0:32
Respuesta

JoseManuel Garcia

Ranking: New Member

Mensajes: 8

Fecha de incorporación: 9 de mayo de 2011

Mensajes recientes

Hi Tony Kerz,

I have the same problem that you. For one hand I have this error: 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.

And the other hand I have this problem: log4j:ERROR Could not parse url [jar:file:/C:/Liferay/liferay-portal-6.0.6/tomcat-6.0.29/webapps/UsuariosConectados-portlet/WEB-INF/lib/portal-impl.jar!/META-INF/portal-log4j.xml].
java.lang.NullPointerException.

Have you find solution for this problem?
Bartlomiej Knabel
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
7 de junio de 2011 3:11
Respuesta

Bartlomiej Knabel

Ranking: Junior Member

Mensajes: 59

Fecha de incorporación: 30 de enero de 2011

Mensajes recientes

I have simmilar problem as JoseManuel - did You solve it?
Gaurang Sheladia
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
15 de junio de 2011 5:15
Respuesta

Gaurang Sheladia

Ranking: Regular Member

Mensajes: 160

Fecha de incorporación: 15 de febrero de 2009

Mensajes recientes

Hi All,

I am using Liferay 6.0.5 and i have migrated Struts Plugin portlet from Liferay 5.2.3 to 6.0.5 but still i am getting same error


log4j:ERROR Could not parse url [jar:file:/C:/Liferay/liferay-portal-6.0.6/tomcat-6.0.29/webapps/UsuariosConectados-portlet/WEB-INF/lib/portal-impl.jar!/META-INF/portal-log4j.xml].
java.lang.NullPointerException.


Does any one find any alternative solution?

Thanks in advance.

-- Gaurang
Thiago Leão Moreira
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
15 de junio de 2011 10:14
Respuesta

Thiago Leão Moreira

LIFERAY STAFF

Ranking: Liferay Legend

Mensajes: 1433

Fecha de incorporación: 10 de octubre de 2007

Mensajes recientes

Hey Gaurang,

The problem is that you have the portal-impl.jar on your portlet classpath. portal-impl.jar contains the core classes of Liferay and never should be referenced directly by portlet. It is explicit forbidden add this jar to your portlet's classpath. Unknown problems can be raised like the one that you are facing.
Gaurang Sheladia
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
3 de agosto de 2011 2:41
Respuesta

Gaurang Sheladia

Ranking: Regular Member

Mensajes: 160

Fecha de incorporación: 15 de febrero de 2009

Mensajes recientes

Yes Thiago, you are right. I have resolved that issue.

Thanks again for your response.
Vince P
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
11 de septiembre de 2011 18:33
Respuesta

Vince P

Ranking: New Member

Mensajes: 17

Fecha de incorporación: 13 de octubre de 2010

Mensajes recientes

Thiago Leão Moreira:
Hey Gaurang,

The problem is that you have the portal-impl.jar on your portlet classpath. portal-impl.jar contains the core classes of Liferay and never should be referenced directly by portlet. It is explicit forbidden add this jar to your portlet's classpath. Unknown problems can be raised like the one that you are facing.



Hi Thiago,

I have the same problem, I wanted to copy the functionality of LogoutAction class in my customized hook plugin project, so I've used a part of Liferay's LogoutAction code in one of my classes, but whenever I tried deploying the hook plugin it gives me an error:

1java.lang.NoClassDefFoundError: com/liferay/portal/util/PropsValues


Since the class exists inside the portal-impl.jar I included the jar to my references, but once I redeployed my hook plugin I encountered the error discussed in this thread..

1ERROR Could not create an Appender. Reported error follows.
2java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot be cast to org.apache.log4j.Appender
3.
4.
5.
6ERROR Could not parse url [jar:file:/C:/Liferay/liferay-portal-6.0.5/tomcat-6.0.26/webapps/my-test-hook/WEB-INF/lib/portal-impl.jar!/META-INF/portal-log4j.xml].
7java.lang.NullPointerException


Would you have any advice on what I should do?

Cheers,
Vincent
Hector Leon Garay
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
16 de noviembre de 2011 11:36
Respuesta

Hector Leon Garay

Ranking: New Member

Mensajes: 15

Fecha de incorporación: 14 de julio de 2011

Mensajes recientes

Hi Vincet,

Did you find the solution for your problem? I have the same issue as you have with a hook.

If you have any solution, can you please share it?

Regards.

HLG
Gaurang Sheladia
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
12 de enero de 2012 3:27
Respuesta

Gaurang Sheladia

Ranking: Regular Member

Mensajes: 160

Fecha de incorporación: 15 de febrero de 2009

Mensajes recientes

Hi Dianne,

The problem is that you have the portal-impl.jar on your portlet classpath. portal-impl.jar contains the core classes of Liferay and never should be referenced directly by portlet. It is explicit forbidden add this jar to your portlet's classpath. Unknown problems can be raised like the one that you are facing.
Joaquín Fernández
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
8 de febrero de 2012 6:43
Respuesta

Joaquín Fernández

Ranking: Junior Member

Mensajes: 93

Fecha de incorporación: 2 de enero de 2012

Mensajes recientes

Hi all

I have the same error:

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)



Where can i configure the portlet classpath? I don't have any jar added in the portal-dependency-jars in the liferay-plugin-package.properties

thanks
Gwowen Fu
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
26 de diciembre de 2012 10:33
Respuesta

Gwowen Fu

Ranking: Expert

Mensajes: 315

Fecha de incorporación: 27 de diciembre de 2010

Mensajes recientes

Thiago Leão Moreira:
Hey Gaurang,

portal-impl.jar contains the core classes of Liferay and never should be referenced directly by portlet.


I need to import "com.liferay.portal.xml.QNameImpl" class that's in portal-impl.jar, if we cannot reference it directly, what's the alternative way?

Thanks!
Gwowen
Pedro Bezunartea López
RE: java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot b
4 de abril de 2014 8:00
Respuesta

Pedro Bezunartea López

Ranking: Junior Member

Mensajes: 38

Fecha de incorporación: 10 de julio de 2005

Mensajes recientes

Gaurang Sheladia:
Yes Thiago, you are right. I have resolved that issue.

Thanks again for your response.

Gaurang Sheladia:
Hi Dianne,

The problem is that you have the portal-impl.jar on your portlet classpath. portal-impl.jar contains the core classes of Liferay and never should be referenced directly by portlet. It is explicit forbidden add this jar to your portlet's classpath. Unknown problems can be raised like the one that you are facing.


From your messages it looks like you managed to solve the problem, could you please give clear instructions on how to solve the issue?

The problem several users seem to have is:
  1. Create a hook to replace the action of a default portlet included in portal-impl.jar
  2. Deploy the hook. The deployment throws a NoClassDefFoundError exception for the class being replaced.
  3. The developer adds portal-impl.jar in "portal-dependency-jars" config parameter in the hook's configuration file "liferay-plugin-package.properties". Redeployment
  4. A Log4j error is thrown on deployment:
    1log4j:ERROR Could not create an Appender. Reported error follows. java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot be cast to org.apache.log4j.Appender

From your message the conclusion is that portal-impl.jar should NOT be included. That's clear but, how did you solve the original problem then?

TIA,

Pedro.