commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Lundberg <denn...@apache.org>
Subject Re: cargo maven2 plugin causing exceptions during build because of commons-logging
Date Sat, 30 Aug 2008 09:45:48 GMT
Fhomasp wrote:
> Hey,
> 
> Thanks for your replies.
> 
> The thing with the older commons-logging implementations is because of
> dependencies, configured through maven2, on older programming logic. 
> Because of these dependencies there's at least two versions of commons
> logging in my classpath.  

There must be another reason for this. Maven 2 will only put one version
of an artifact on the classpath, provided they have the same
groupId/artifactId. For a view of your projects dependency tree use this
command:

mvn dependency:tree

> 
> On the brightside though.  I added the library jcl104-overslf4j 1.1.0, which
> allows my project to build.  There's still an error going but it's native to
> the internal architecture here.
> 
> So thanks :)
> 
> 
> 
> Simon Kitching wrote:
>> Yes, hopefully Dennis' suggestion will work.
>>
>> It does look like whatever environment this code is running in, it is
>> using a rather old version of commons-logging. The reported exception
>> only occurs in commons-logging 1.0.x. Version 1.1 of commons-logging was
>> released in May 2006 and 1.1.1 was released in Nov 2007, and neither of
>> these should ever throw an exception (though you might not get any
>> logging in this case, as there is clearly something weird going on with
>> classloader hierarchies).
>>
>> Regards, Simon
>>
>> On Thu, 2008-08-28 at 22:49 +0200, Dennis Lundberg wrote:
>>> The simplest thing to do is to put a commons-logging.properties into the
>>> classpath. The file should contain just one property to set the logging
>>> implementation to something other than log4j, like this:
>>>
>>> org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
>>>
>>>
>>> Fhomasp wrote:
>>>> Hey,
>>>>
>>>> I've been attempting to load a test environment in a Jetty container
>>> for
>>>> JSFUnit through the cargo-maven2-plugin.  
>>>> Sadly every time the deployment to Jetty is attempted there is a huge
>>> list
>>>> of exceptions caused by Commons-logging.
>>>> When using no logger at all stderr is used for output, causing the
>>> following
>>>> exceptionstack, which is roughly the same if I use Log4j:
>>>>
>>>> [INFO] Building war:
>>>>
>>> C:\projects\trunk\vlafo\olympus\JSFUnitTest\target\JSFUnitTestWar-1.4.2.war
>>>> [INFO] [cargo:start {execution: start-container}]
>>>> [INFO] No container defined, using a default [jetty6x, embedded]
>>> container
>>>> [INFO] [beddedLocalContainer] Jetty 6.x Embedded starting...
>>>> 2008-08-26 15:49:14.375::INFO:  Logging to STDERR via
>>>> org.mortbay.log.StdErrLog
>>>> 2008-08-26 15:49:14.421::INFO:  jetty-6.1.1rc1
>>>> 2008-08-26 15:49:14.609::INFO:  Extract
>>>> jar:file:/C:/projects/trunk/vlafo/olympus/JSFUnitTest/target
>>>> /JSFUnitTestWar-1.4.2.war!/ to C:\DOCUME~1\DEVELO~
>>>>
>>> 1\LOCALS~1\Temp\Jetty_0_0_0_0_8080_JSFUnitTestWar-1.4.2.war__JSFUnitTestWar-1_4_2__aar4a7\webapp
>>>> 2008-08-26 15:49:19.046::WARN:  failed
>>>> org.mortbay.jetty.webapp.WebAppContext@58dfa6{/JSFUnitTestWar
>>>> -1.4.2,jar:file:/C:/projects/trunk/vlafo/olympus/J
>>>> SFUnitTest/target/JSFUnitTestWar-1.4.2.war!/}
>>>> java.lang.ExceptionInInitializerError
>>>>         at
>>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>> Method)
>>>>         at
>>>>
>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
>>>> 39)
>>>>         at
>>>>
>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorIm
>>>> pl.java:27)
>>>>         at
>>> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>>>>         at java.lang.Class.newInstance0(Class.java:350)
>>>>         at java.lang.Class.newInstance(Class.java:303)
>>>>         at
>>>>
>>> org.mortbay.jetty.webapp.TagLibConfiguration.configureWebApp(TagLibConfiguration.java:239
>>>> )
>>>>         at
>>>>
>>> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1188)
>>>>         at
>>>>
>>> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:481)
>>>>         at
>>>> org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:434)
>>>>         at
>>>>
>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>>>>         at
>>>>
>>> org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
>>>>         at
>>>>
>>> org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:
>>>> 120)
>>>>         at
>>>>
>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>>>>         at
>>>>
>>> org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
>>>>         at
>>>>
>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>>>>         at
>>>>
>>> org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
>>>>         at org.mortbay.jetty.Server.doStart(Server.java:210)
>>>>         at
>>>>
>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>         at
>>>>
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>         at
>>>>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>         at java.lang.reflect.Method.invoke(Method.java:585)
>>>>         at
>>>>
>>> org.codehaus.cargo.container.jetty.internal.JettyExecutorThread.run(JettyExecutorThread.j
>>>> ava:68)
>>>> Caused by: org.apache.commons.logging.LogConfigurationException:
>>>> org.apache.commons.logging.LogConfi
>>>> gurationException: No suitable Log constructor [Lj
>>>> ava.lang.Class;@12305e8 for org.apache.commons.logging.impl.Log4JLogger
>>>> (Caused by java.lang.NoClass
>>>> DefFoundError: org/apache/log4j/Category) (Caused
>>>> by org.apache.commons.logging.LogConfigurationException: No suitable
>>> Log
>>>> constructor [Ljava.lang.Cla
>>>> ss;@12305e8 for org.apache.commons.logging.impl.Lo
>>>> g4JLogger (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.myfaces.webapp.StartupServletContextListener.<clinit>(StartupServletContextListener.java:44)
>>>>         ... 24 more
>>>> Caused by: org.apache.commons.logging.LogConfigurationException: No
>>> suitable
>>>> Log constructor [Ljava.
>>>> lang.Class;@12305e8 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)
>>>>         ... 28 more
>>>> Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
>>>>         at java.lang.Class.getDeclaredConstructors0(Native Method)
>>>>         at
>>> java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
>>>>         at java.lang.Class.getConstructor0(Class.java:2671)
>>>>         at java.lang.Class.getConstructor(Class.java:1629)
>>>>         at
>>>>
>>> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
>>>>
>>>> After some web searching I found an alternative for log4j or stderr,
>>> namely
>>>> slf4j.  However using this one still causes a similar exception stack:
>>>>
>>>> [INFO] Generating war
>>>>
>>> C:\projects\trunk\vlafo\olympus\JSFUnitTest\target\JSFUnitTestWar-1.4.2.war
>>>> [INFO] Building war:
>>>>
>>> C:\projects\trunk\vlafo\olympus\JSFUnitTest\target\JSFUnitTestWar-1.4.2.war
>>>> [INFO] [cargo:start {execution: start-container}]
>>>> [INFO] No container defined, using a default [jetty6x, embedded]
>>> container
>>>> [INFO] [beddedLocalContainer] Jetty 6.x Embedded starting...
>>>> 2008-08-25 10:06:07.140::INFO:  Logging to STDERR via
>>>> org.mortbay.log.StdErrLog
>>>> 2008-08-25 10:06:07.171::INFO:  jetty-6.1.1rc1
>>>> 2008-08-25 10:06:08.484::INFO:  Extract
>>>> jar:file:/C:/projects/trunk/vlafo/olympus/JSFUnitTest/target
>>>> /JSFUnitTestWar-1.4.2.war!/ to C:\DOCUME~1\DEVELO~
>>>>
>>> 1\LOCALS~1\Temp\Jetty_0_0_0_0_8080_JSFUnitTestWar-1.4.2.war__JSFUnitTestWar-1_4_2__aar4a7\webapp
>>>> 2008-08-25 10:06:12.781::WARN:  failed
>>>> org.mortbay.jetty.webapp.WebAppContext@10bcb28{/JSFUnitTestWa
>>>> r-1.4.2,jar:file:/C:/projects/trunk/vlafo/olympus/
>>>> JSFUnitTest/target/JSFUnitTestWar-1.4.2.war!/}
>>>> java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
>>>>         at
>>>>
>>> org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
>>>>         at
>>>>
>>> org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
>>>>         at
>>> org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
>>>>         at
>>>>
>>> org.apache.myfaces.webapp.StartupServletContextListener.<clinit>(StartupServletContextListener.java:44)
>>>>         at
>>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>> Method)
>>>>         at
>>>>
>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
>>>> 39)
>>>>         at
>>>>
>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorIm
>>>> pl.java:27)
>>>>         at
>>> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>>>>         at java.lang.Class.newInstance0(Class.java:350)
>>>>         at java.lang.Class.newInstance(Class.java:303)
>>>>         at
>>>>
>>> org.mortbay.jetty.webapp.TagLibConfiguration.configureWebApp(TagLibConfiguration.java:239
>>>> )	
>>>>
>>>> I'm at a loss on how to get this issue fixed.  If anyone knows what to
>>> do,
>>>> by all means let me know ;-)
>>>
>>
>>
> 


-- 
Dennis Lundberg

Mime
View raw message