You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mahesh Joshi <jo...@comcast.net> on 2003/09/22 11:29:19 UTC
Log4J and Struts
Hi,
I am moving my current web application to struts and I am facing a problem.
We use Log4J for our logging (Log4J version 1.2.8)
If I have the log4j-1.2.8.jar in my WEB-INF/lib directory, the Action
servlet does not initialize
Tomcat log file says:
javax.servlet.ServletException: Error instantiating servlet class
org.apache.struts.action.ActionServlet
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:91
2)
...
----- Root Cause -----
java.lang.ExceptionInInitializerError
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: No suitable Log
constructor [Ljava.lang.Class;@3a5794 for
org.apache.commons.logging.impl.Log4JLogger
at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:532)
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable
Log constructor [Ljava.lang.Class;@3a5794 for
org.apache.commons.logging.impl.Log4JLogger
at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:432)
at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:525)
... 28 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:1590)
at java.lang.Class.getConstructor0(Class.java:1762)
at java.lang.Class.getConstructor(Class.java:1002)
at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:429)
... 29 more
If I remove the log4J.jar from WEB-INF/lib, the ActionServlet
initializes(but then my app. cant log).
I searched the archive and implemented the solution provided by Sgarlata
Matt
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg79448.html
Howeve, putting the commons-logging.properties in the WEB-INF/classes/
folder didnt help either.
(note that our log4J config file has been kept in the WEB-INF folder. Even
if I keep the commons-logging.properties in the WEB-INF folder, it doesnt
work).
Please help!
Mahesh
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Log4J and Struts
Posted by Mahesh Joshi <jo...@comcast.net>.
Hi,
Unfortunately this does not work for Tomcat 4.1.24
When I put log4j-1.2.8 in the jak*/common/lib or jak*/shared/lib I dont get
the results desired.
In the former, tomcat doesnt startup and in the latter struts does not
initialize.
Looks like I am missing something in the relationship between
commons-logging and Log4J.
Thanks!
Mahesh
----- Original Message -----
From: "Abhijeet Mahalkar" <Ab...@indussoft.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, September 22, 2003 2:39 AM
Subject: Re: Log4J and Struts
hi Mahesh,
No u have to keep ur log4j-1.2.8.jar into websphere\appserver\lib dir not
web-inf.
here it will not give any error.
I was working on the same kind of error an hr before but copy paste into
websphere\appserver\lib solved my problem...
regards
abhijeet
----- Original Message -----
From: "Mahesh Joshi" <jo...@comcast.net>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, September 22, 2003 2:59 PM
Subject: Log4J and Struts
Hi,
I am moving my current web application to struts and I am facing a problem.
We use Log4J for our logging (Log4J version 1.2.8)
If I have the log4j-1.2.8.jar in my WEB-INF/lib directory, the Action
servlet does not initialize
Tomcat log file says:
javax.servlet.ServletException: Error instantiating servlet class
org.apache.struts.action.ActionServlet
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:91
2)
...
----- Root Cause -----
java.lang.ExceptionInInitializerError
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: No suitable Log
constructor [Ljava.lang.Class;@3a5794 for
org.apache.commons.logging.impl.Log4JLogger
at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:532)
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable
Log constructor [Ljava.lang.Class;@3a5794 for
org.apache.commons.logging.impl.Log4JLogger
at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:432)
at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:525)
... 28 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:1590)
at java.lang.Class.getConstructor0(Class.java:1762)
at java.lang.Class.getConstructor(Class.java:1002)
at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:429)
... 29 more
If I remove the log4J.jar from WEB-INF/lib, the ActionServlet
initializes(but then my app. cant log).
I searched the archive and implemented the solution provided by Sgarlata
Matt
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg79448.html
Howeve, putting the commons-logging.properties in the WEB-INF/classes/
folder didnt help either.
(note that our log4J config file has been kept in the WEB-INF folder. Even
if I keep the commons-logging.properties in the WEB-INF folder, it doesnt
work).
Please help!
Mahesh
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Log4J and Struts
Posted by Abhijeet Mahalkar <Ab...@indussoft.com>.
hi Mahesh,
No u have to keep ur log4j-1.2.8.jar into websphere\appserver\lib dir not web-inf.
here it will not give any error.
I was working on the same kind of error an hr before but copy paste into websphere\appserver\lib solved my problem...
regards
abhijeet
----- Original Message -----
From: "Mahesh Joshi" <jo...@comcast.net>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, September 22, 2003 2:59 PM
Subject: Log4J and Struts
Hi,
I am moving my current web application to struts and I am facing a problem.
We use Log4J for our logging (Log4J version 1.2.8)
If I have the log4j-1.2.8.jar in my WEB-INF/lib directory, the Action
servlet does not initialize
Tomcat log file says:
javax.servlet.ServletException: Error instantiating servlet class
org.apache.struts.action.ActionServlet
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:91
2)
...
----- Root Cause -----
java.lang.ExceptionInInitializerError
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: No suitable Log
constructor [Ljava.lang.Class;@3a5794 for
org.apache.commons.logging.impl.Log4JLogger
at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:532)
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable
Log constructor [Ljava.lang.Class;@3a5794 for
org.apache.commons.logging.impl.Log4JLogger
at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:432)
at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:525)
... 28 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:1590)
at java.lang.Class.getConstructor0(Class.java:1762)
at java.lang.Class.getConstructor(Class.java:1002)
at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:429)
... 29 more
If I remove the log4J.jar from WEB-INF/lib, the ActionServlet
initializes(but then my app. cant log).
I searched the archive and implemented the solution provided by Sgarlata
Matt
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg79448.html
Howeve, putting the commons-logging.properties in the WEB-INF/classes/
folder didnt help either.
(note that our log4J config file has been kept in the WEB-INF folder. Even
if I keep the commons-logging.properties in the WEB-INF folder, it doesnt
work).
Please help!
Mahesh
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org