Fórumok

Nyitólap » Liferay Portal » English » 3. Development

Kombinált nézet Egyszerű nézet Fa-nézet
Szálak [ Előző | Következő ]
toggle
Raymond Gardner
log4j class loader error
2011. augusztus 9. 14:03
Válasz

Raymond Gardner

Rangsorolás: Junior Member

Hozzászólások: 89

Csatlakozás dátuma: 2011. július 14.

Legújabb hozzászólások

I'm getting the following error upon deploying a portlet I downloaded from the community, add-user-portlet:

log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [WebappClassLoader
context: /add-user-portlet
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1995d80
] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [WebappClassLoader
context:
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1995d80
].
log4j:ERROR Could not instantiate appender named "CONSOLE".

It is clashing with a log4j loaded from the Liferay application, "context: ''". (The context is empty or root or /, which is the default Liferay context)

So, what do I do? I noticed the SDK, and/or IDE, adds log4j.jar to every portlet plugin project. It also adds a log4j.properties.
The thing is, I'm not getting this issue with my other deployed portlets.
Raymond Gardner
RE: log4j class loader error
2011. szeptember 1. 8:18
Válasz

Raymond Gardner

Rangsorolás: Junior Member

Hozzászólások: 89

Csatlakozás dátuma: 2011. július 14.

Legújabb hozzászólások

I wonder if this is an issue with the Liferay IDE/Studio. The Liferay IDE/Studio automatically includes the log4j.jar file in the project plugin.
This is the /add-user-portlet context indicated above. However, the Liferay application also deploys the log4j.jar file in its ROOT context of ''.

This is an issue with log4j because the VM class loader should not have an issue with this, right? Or maybe it does.

It is trying to assign an object loaded by one classloader, the ROOT context, to a variable of a type loaded by another classloader.

Could this be an issue with how I have Log4j configured?

I've put a META-INF folder with log4j.dtd and portal-log4j-ext.xml under the ROOT/WEB-INF/classes folder.
Plus, I see a log4j.properties file under ROOT/WEB-INF/classes. This I did not do. Liferay does it.
Thiago Leão Moreira
RE: log4j class loader error
2011. szeptember 1. 10:00
Válasz

Thiago Leão Moreira

LIFERAY STAFF

Rangsorolás: Liferay Legend

Hozzászólások: 1195

Csatlakozás dátuma: 2007. október 10.

Legújabb hozzászólások

I never tried this before but I think you should be able to not add that log4 jar in the final war file setting the following property in build.${username}.properties of your Plugin SDK.

1required.portal.jars=commons-logging.jar,util-bridges.jar,util-java.jar,util-taglib.jar


Give a try and let me know.
Bharanidharan Viswanathan
RE: log4j class loader error
2011. szeptember 13. 6:53
Válasz

Bharanidharan Viswanathan

Rangsorolás: New Member

Hozzászólások: 5

Csatlakozás dátuma: 2009. október 8.

Legújabb hozzászólások

try setting JAVA_OPTS with this property "-Dlog4j.ignoreTCL=true".