commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Lundberg <denn...@apache.org>
Subject Re: [logging] Problem with Eclipse infocenter WAR file - org.apache.commons.logging.LogConfigurationException: No suitable Log constructor
Date Tue, 08 Feb 2011 21:52:22 GMT
On 2011-02-08 22:40, Peter Desjardins wrote:
> Hi, thanks for your help with this. I found that the application will
> work if I add the latest log4j and commons-logging JAR files to the
> JBOSS_CLASSPATH. However, I can't use this workaround in production.

OK

> I thought I might get around the issue by not using log4j and I tried
> to configure the application to use native Java logging. I'm still
> seeing the same error though. I added
> WAR/WEB-INF/classes/commons-logging.properties with this content:
> 
>   org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger
> 
> Is using native Java logging a reasonable way to avoid the
> "java.lang.ClassNotFoundException: org.apache.log4j.Category" problem
> I'm seeing? Am I using commons-logging.properties correctly in order
> to do this? I don't know why the application is still looking for
> log4j classes.

Yes and no...

Yes, your file looks correct and it is placed in the right place in your
webapp.

No, it won't work because the properties file is not in the class path
of the version of commons-logging that is giving you the error message.
For this to work you would have to put your properties file somewhere
inside your JBoss installation - similar to what you tries with the
JARs. But I guess that is also out of the question for production use,
since that would change the logging for *all* webapps...

Because JBoss decided to create their own version of commons-logging and
sticking into the main JBoss class path, you are out of luck if you are
not allowed to alter the JBoss class path, either by adding/changing
JARs or adding a properties file. There is no way to override the
commons-logging JAR inside JBoss' class path, by doing something with
your webapp.

> Here's the full error from the JBoss server log:
> 
> 2011-02-08 16:30:44,156 ERROR [org.apache.catalina.core.ContainerBase]
> Servlet.service() for servlet equinoxbridgeservlet threw exception
> org.apache.commons.logging.LogConfigurationException:
> org.apache.commons.logging.LogConfigurationException: No suitable Log
> constructor [Ljava.lang.Class;@cfd22a for
> org.apache.commons.logging.impl.Log4JLogger (Caused by
> java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by
> org.apache.commons.logging.LogConfigurationException: No suitable Log
> constructor [Ljava.lang.Class;@cfd22a for
> org.apache.commons.logging.impl.Log4JLogger (Caused by
> java.lang.NoClassDefFoundError: org/apache/log4j/Category))
> 	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
> 	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
> 	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
> 	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
> 	at org.apache.jasper.servlet.JspServlet.<init>(JspServlet.java:58)
> 	at org.eclipse.equinox.jsp.jasper.JspServlet.<init>(JspServlet.java:65)
> 	at org.eclipse.equinox.jsp.jasper.registry.JSPFactory.create(JSPFactory.java:56)
> 	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:262)
> 	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
> 	at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.initializeDelegate(ServletManager.java:194)
> 	at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:179)
> 	at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
> 	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:126)
> 	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:76)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> 	at org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:120)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
> 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
> 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
> 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
> 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
> 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
> 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
> 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> 	at java.lang.Thread.run(Thread.java:619)
> Caused by: org.apache.commons.logging.LogConfigurationException: No
> suitable Log constructor [Ljava.lang.Class;@cfd22a for
> org.apache.commons.logging.impl.Log4JLogger (Caused by
> java.lang.NoClassDefFoundError: org/apache/log4j/Category)
> 	at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
> 	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
> 	... 34 more
> Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
> 	at java.lang.Class.getDeclaredConstructors0(Native Method)
> 	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
> 	at java.lang.Class.getConstructor0(Class.java:2699)
> 	at java.lang.Class.getConstructor(Class.java:1657)
> 	at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
> 	... 35 more
> Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Category
> 	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
> 	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
> 	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
> 	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> 	... 40 more
> 
> On Thu, Feb 3, 2011 at 5:10 PM, Dennis Lundberg <dennisl@apache.org> wrote:
>> On 2011-02-03 22:55, Peter Desjardins wrote:
>>> Hi. I am trying to run the Eclipse infocenter as a WAR file and I'm
>>> seeing problems when using JBoss 4.2.0 EAP CP05. The WAR application
>>> runs fine using Tomcat 6.0 and JBoss 4.0.1. The Eclipse infocenter is
>>> the user assistance component of the Eclipse IDE. I packaged it as a
>>> WAR file as described here (http://bit.ly/gw85YN).
>>
>> First thing to check is if JBoss 4.2.0 has its own copy of
>> commons-logging somewhere. That JAR would then be in a different class
>> loader than the JAR that you put inside your WAR. If that is the case
>> then you either need to put a copy of log4j inside JBoss class path, or
>> you try to replace the JBoss commons-logging JAR with the official
>> Apache Commons Logging version 1.1.1. That version has much better error
>> reporting on issues like these.
>>
>>>
>>> The Eclipse infocenter WAR file includes this JAR file:
>>> org.apache.commons.logging_1.0.4.v201005080501.jar. I'm using Windows
>>> XP and jdk1.6.0_18.
>>>
>>> The error I see is pasted below. It occurs when I try to open the
>>> application in a browser for the first time.
>>>
>>> 15:41:32,468 ERROR [ContainerBase] Servlet.service() for servlet
>>> equinoxbridgeservlet threw exception
>>> org.apache.commons.logging.LogConfigurationException:
>>> org.apache.commons.logging.LogConfigurationException: No suitable Log
>>> constructor [Ljava.lang.Class;@1e4d960 for
>>> org.apache.commons.logging.impl.Log4JLogger (Caused by
>>> java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by
>>> org.apache.commons.logging.LogConfigurationException: No suitable Log
>>> constructor [Ljava.lang.Class;@1e4d960 for
>>> org.apache.commons.logging.impl.Log4JLogger (Caused by
>>> java.lang.NoClassDefFoundError: org/apache/log4j/Category))
>>>
>>> I've tried adding log4j.jar and a log4j.xml file in my WAR file as
>>> described here:
>>> http://osdir.com/ml/jakarta.log4j.user/2003-08/msg00210.html. That did
>>> not help. I'm not sure my log4j.xml file was configured correctly but
>>> using it didn't change the error message at all.
>>>
>>> Can anyone suggest a possible cause for this problem? If this isn't a
>>> commons-logging issue, can you tell me where I might look?
>>>
>>> Thanks for your help.
>>>
>>> Peter Desjardins
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: user-help@commons.apache.org
>>>
>>>
>>
>>
>> --
>> Dennis Lundberg
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
> 


-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message