Re: How to configure to use tomcat and struts to use log4j?
Looks like Struts has a dependency on Commons Logging which is using Log4j under the hood. The commons logging jar is being loaded from a higher level classloader (common/lib or server/lib) and can't access classes only provided by a lower classloader (your webapp). Maybe try having the commons logging jar in your WEB-INF/lib. Where is the struts jar you're using? WEB-INF/lib or higher? Jon Zsolt Koppany wrote: Hi Shapira, that is what I get when log4.jar is in my .../WEB-INF/lib. struts.jar is also in my .../WEB-INF/lib. Can that cause the problem? How can I fix that? Zsolt javax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServlet at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:912) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3420) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3608) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) - Root Cause - java.lang.NoClassDefFoundError: org/apache/log4j/Layout at org.apache.commons.logging.impl.Log4jFactory.getInstance(Log4jFactory.java:140) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:257) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:390) at org.apache.struts.action.ActionServlet.clinit(ActionServlet.java:375) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:903) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3420) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3608) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) On Wed, 2003-08-06 at 22:01, Shapira, Yoav wrote: Howdy, I have tried so many things to use log4j from tomcat and struts and finaly I found the solution that I have to copy log4.jar into common/lib server/lib and application/WEB-INF/lib (to be able to get jsp files compiled). I find it a bit complicated that I have to copy the same jar file into three different directories. Is there a better way? Simply put log4j.jar in WEB-INF/lib, and your log4j configuration file in WEB-INF/classes. That's it. Don't have copies of log4j in commons/lib or server/lib, nor a log4j configuration file there. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
RE: How to configure to use tomcat and struts to use log4j?
Hi Shapira, that is what I get when log4.jar is in my .../WEB-INF/lib. struts.jar is also in my .../WEB-INF/lib. Can that cause the problem? How can I fix that? Zsolt javax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServlet at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:912) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3420) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3608) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) - Root Cause - java.lang.NoClassDefFoundError: org/apache/log4j/Layout at org.apache.commons.logging.impl.Log4jFactory.getInstance(Log4jFactory.java:140) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:257) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:390) at org.apache.struts.action.ActionServlet.clinit(ActionServlet.java:375) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:903) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3420) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3608) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) On Wed, 2003-08-06 at 22:01, Shapira, Yoav wrote: Howdy, I have tried so many things to use log4j from tomcat and struts and finaly I found the solution that I have to copy log4.jar into common/lib server/lib and application/WEB-INF/lib (to be able to get jsp files compiled). I find it a bit complicated that I have to copy the same jar file into three different directories. Is there a better way? Simply put log4j.jar in WEB-INF/lib, and your log4j configuration file in WEB-INF/classes. That's it. Don't have copies of log4j in commons/lib or server/lib, nor a log4j configuration file there. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to configure to use tomcat and struts to use log4j?
Howdy, I have tried so many things to use log4j from tomcat and struts and finaly I found the solution that I have to copy log4.jar into common/lib server/lib and application/WEB-INF/lib (to be able to get jsp files compiled). I find it a bit complicated that I have to copy the same jar file into three different directories. Is there a better way? Simply put log4j.jar in WEB-INF/lib, and your log4j configuration file in WEB-INF/classes. That's it. Don't have copies of log4j in commons/lib or server/lib, nor a log4j configuration file there. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to configure to use tomcat and struts to use log4j?
Jon, I have found commons-logging.jar in two directories: application/WEB-INF/lib/commons-logging.jar server/lib/commons-logging.jar struts.jar is also in application/WEB-INF/lib Any ideas? Zsolt On Thu, 2003-08-07 at 12:49, Jon Wingfield wrote: Looks like Struts has a dependency on Commons Logging which is using Log4j under the hood. The commons logging jar is being loaded from a higher level classloader (common/lib or server/lib) and can't access classes only provided by a lower classloader (your webapp). Maybe try having the commons logging jar in your WEB-INF/lib. Where is the struts jar you're using? WEB-INF/lib or higher? Jon Zsolt Koppany wrote: Hi Shapira, that is what I get when log4.jar is in my .../WEB-INF/lib. struts.jar is also in my .../WEB-INF/lib. Can that cause the problem? How can I fix that? Zsolt javax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServlet at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:912) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3420) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3608) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) - Root Cause - java.lang.NoClassDefFoundError: org/apache/log4j/Layout at org.apache.commons.logging.impl.Log4jFactory.getInstance(Log4jFactory.java:140) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:257) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:390) at org.apache.struts.action.ActionServlet.clinit(ActionServlet.java:375) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:903) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3420) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3608) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) On Wed, 2003-08-06 at 22:01, Shapira, Yoav wrote: Howdy, I have tried so many things to use log4j from tomcat and struts and finaly I found the solution that I have to copy log4.jar into common/lib server/lib and application/WEB-INF/lib (to be able to get jsp files compiled). I find it a bit complicated that I have to copy the same jar file into three different directories. Is there a better way? Simply put log4j.jar in WEB-INF/lib, and your log4j configuration file in WEB-INF/classes. That's it. Don't have copies of log4j in commons/lib or server/lib, nor a log4j configuration file there. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is
RE: How to configure to use tomcat and struts to use log4j?
Howdy, Looks like Struts has a dependency on Commons Logging which is using Log4j under the hood. The commons logging jar is being loaded from a higher level classloader (common/lib or server/lib) and can't access classes only provided by a lower classloader (your webapp). Maybe try having the commons logging jar in your WEB-INF/lib. Not a bad suggestion. Remember, you should always be able to have your webapp work if you all your jars are in WEB-INF/lib and no jars are elsewhere. - Root Cause - java.lang.NoClassDefFoundError: org/apache/log4j/Layout Note the difference between NoClassDefFoundError and ClassNotFoundException. The classloader found a log4j jar, but it does not contain the Layout class. List the contents of your WEB-INF/lib. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]