You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by David Legg <da...@searchevent.co.uk> on 2008/07/16 16:30:37 UTC
C2.2 - Mixing SLF4J with Cocoon
I'm trying to add a new block to a Cocoon web app and every time I try
to do a 'mvn jetty:run' command I get a 'java.lang.AbstractMethodError'
and the web app just seems to stop serving web pages (error list shown
at end of this message).
The block in question makes calls to the Sesame [1] RDF triplestore.
The important thing is that, like a lot of modern Java apps, Sesame
makes use of SLF4J [2] to do its logging. I'm not familiar with the
various logging frameworks but I think I've accidently walked into a
minefield here! Cocoon seems to use Log4j, Jetty might be using
something else and my block might need slf4j. Add to this that I've
seen a report about slf4j not playing well with the Reloading Class
Loader (RCL) and I think I'm well and truly stuffed!
Please, if anyone knows how to get a library that uses slf4j to play
nicely in a Cocoon environment I'd be very grateful ;-)
Regards,
David Legg
Errors...
...
[INFO] [jetty:run]
[INFO] Configuring Jetty for project: meerkat-browser
...
2008-07-15 16:57:35.032::INFO: Logging to STDERR via
org.mortbay.log.StdErrLog
[INFO] Starting jetty 6.1.7 ...
2008-07-15 16:57:35.112::INFO: jetty-6.1.7
...
2008-07-15 16:57:36.964::WARN: failed
org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@7db754{/,D:\projects\meerkat\meerkat-browser\target\rcl\webapp}
java.lang.AbstractMethodError:
org.slf4j.impl.SimpleLogger.trace(Ljava/lang/String;)V
at
org.apache.commons.logging.impl.SLF4JLog.trace(SLF4JLog.java:82)
at
org.springframework.core.CollectionFactory.createConcurrentMapIfPossible(CollectionFactory.java:195)
...
[1] http://www.openrdf.org/
[2] http://www.slf4j.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: C2.2 - Mixing SLF4J with Cocoon
Posted by Ralph Goers <Ra...@dslextreme.com>.
David Legg wrote:
> Thanks for responding Ralph.
>
>> Cocoon 2.2 is using commons-logging, so in the environment shown by
>> your stack trace it would also be going to SLF4J and the SimpleLogger
>> via the jcl adapter.
>>
>> I guess it would help to know what version of SLF4J is in use and
>> where its jars are in the various places they could be.
>
> Maybe part of the problem is that the slf4j-log4j12 pom file on the
> Maven repo has a bad checksum: -
>
> Downloading:
> http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.0.1/slf4j-log4j12-1.0.1.pom
>
>
> 406b downloaded
>
> [WARNING] *** CHECKSUM FAILED - Checksum failed on download: local =
> '37304fd56d9cdda797718e6710637d232986c442'; remote =
> '15558150f0136e9802bb95a347e0045fb4ffe697' - RETRYING
>
> Downloading:
> http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.0.1/slf4j-log4j12-1.0.1.pom
>
>
> 406b downloaded
>
> [WARNING] *** CHECKSUM FAILED - Checksum failed on download: local =
> '37304fd56d9cdda797718e6710637d232986c442'; remote =
> '15558150f0136e9802bb95a347e0045fb4ffe697' - IGNORING
That is a fairly old version of SLF4J. At
http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/ you can see the
latest version is 1.5.2.
>
>
>>> Cocoon does not directly use Log4j. It uses an abstraction layer
>>> that defaults to log4j. slf4j is also an abstraction layer. In the
>>> stack trace you have shown below it is using its SimpleLogger
>>> implementation. This can be replaced with Logback, Log4j or
>>> java.util.logging. You might simply try replacing slf4j-simple.jar
>>> with slf4j-log4j12.jar.
>
> I'll give it a go but I'm not sure how to do that where Maven is
> involved. I guess I change a dependency in a pom.xml file? If I
> don't edit a file won't Maven simply put the old jar file in the
> classpath again?
You can add the dependency to the dependencyManagement section in your
parent pom and that will force all subprojects to use the version
specified there, unless it is a project you are building and your
subproject's pom specifies the version.
>
> I've heard that Commons Logging is now considered evil by some. Would
> it make sense to try to get everything in my app to use SLF4J?
Cocoon and Spring are using it so I don't see how you would rid yourself
of it more than you have. You don't seem to be using anything from
commons-logging at runtime.
Ralph
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: C2.2 - Mixing SLF4J with Cocoon
Posted by David Legg <da...@searchevent.co.uk>.
Thanks for responding Ralph.
> Cocoon 2.2 is using commons-logging, so in the environment shown by
> your stack trace it would also be going to SLF4J and the SimpleLogger
> via the jcl adapter.
>
> I guess it would help to know what version of SLF4J is in use and
> where its jars are in the various places they could be.
Maybe part of the problem is that the slf4j-log4j12 pom file on the
Maven repo has a bad checksum: -
Downloading: http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.0.1/slf4j-log4j12-1.0.1.pom
406b downloaded
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '37304fd56d9cdda797718e6710637d232986c442'; remote = '15558150f0136e9802bb95a347e0045fb4ffe697' - RETRYING
Downloading: http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.0.1/slf4j-log4j12-1.0.1.pom
406b downloaded
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '37304fd56d9cdda797718e6710637d232986c442'; remote = '15558150f0136e9802bb95a347e0045fb4ffe697' - IGNORING
>> Cocoon does not directly use Log4j. It uses an abstraction layer that
>> defaults to log4j. slf4j is also an abstraction layer. In the stack
>> trace you have shown below it is using its SimpleLogger
>> implementation. This can be replaced with Logback, Log4j or
>> java.util.logging. You might simply try replacing slf4j-simple.jar
>> with slf4j-log4j12.jar.
I'll give it a go but I'm not sure how to do that where Maven is
involved. I guess I change a dependency in a pom.xml file? If I don't
edit a file won't Maven simply put the old jar file in the classpath again?
I've heard that Commons Logging is now considered evil by some. Would
it make sense to try to get everything in my app to use SLF4J?
Regards,
David Legg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: C2.2 - Mixing SLF4J with Cocoon
Posted by Ralph Goers <Ra...@dslextreme.com>.
Cocoon 2.2 is using commons-logging, so in the environment shown by your
stack trace it would also be going to SLF4J and the SimpleLogger via the
jcl adapter.
I guess it would help to know what version of SLF4J is in use and where
its jars are in the various places they could be.
Ralph Goers wrote:
> Cocoon does not directly use Log4j. It uses an abstraction layer that
> defaults to log4j. slf4j is also an abstraction layer. In the stack
> trace you have shown below it is using its SimpleLogger
> implementation. This can be replaced with Logback, Log4j or
> java.util.logging. You might simply try replacing slf4j-simple.jar
> with slf4j-log4j12.jar.
>
> Another alternative is that Spring actually wants to use
> commons-logging. Somehow that has been replaced with SLF4J's
> comons-logging compatible implementation. If you just remove
> jcl-over-slf4j.jar and replace it with commons-logging.jar this should
> also remove slf4j.
>
> Ralph//
>
> David Legg wrote:
>> I'm trying to add a new block to a Cocoon web app and every time I
>> try to do a 'mvn jetty:run' command I get a
>> 'java.lang.AbstractMethodError' and the web app just seems to stop
>> serving web pages (error list shown at end of this message).
>>
>> The block in question makes calls to the Sesame [1] RDF triplestore.
>> The important thing is that, like a lot of modern Java apps, Sesame
>> makes use of SLF4J [2] to do its logging. I'm not familiar with the
>> various logging frameworks but I think I've accidently walked into a
>> minefield here! Cocoon seems to use Log4j, Jetty might be using
>> something else and my block might need slf4j. Add to this that I've
>> seen a report about slf4j not playing well with the Reloading Class
>> Loader (RCL) and I think I'm well and truly stuffed!
>>
>> Please, if anyone knows how to get a library that uses slf4j to play
>> nicely in a Cocoon environment I'd be very grateful ;-)
>>
>> Regards,
>> David Legg
>>
>>
>> Errors...
>> ...
>> [INFO] [jetty:run]
>> [INFO] Configuring Jetty for project: meerkat-browser
>> ...
>> 2008-07-15 16:57:35.032::INFO: Logging to STDERR via
>> org.mortbay.log.StdErrLog
>> [INFO] Starting jetty 6.1.7 ...
>> 2008-07-15 16:57:35.112::INFO: jetty-6.1.7
>> ...
>> 2008-07-15 16:57:36.964::WARN: failed
>> org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@7db754{/,D:\projects\meerkat\meerkat-browser\target\rcl\webapp}
>>
>> java.lang.AbstractMethodError:
>> org.slf4j.impl.SimpleLogger.trace(Ljava/lang/String;)V
>> at
>> org.apache.commons.logging.impl.SLF4JLog.trace(SLF4JLog.java:82)
>> at
>> org.springframework.core.CollectionFactory.createConcurrentMapIfPossible(CollectionFactory.java:195)
>>
>> ...
>>
>>
>> [1] http://www.openrdf.org/
>> [2] http://www.slf4j.org/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: C2.2 - Mixing SLF4J with Cocoon
Posted by Ralph Goers <Ra...@dslextreme.com>.
Cocoon does not directly use Log4j. It uses an abstraction layer that
defaults to log4j. slf4j is also an abstraction layer. In the stack
trace you have shown below it is using its SimpleLogger implementation.
This can be replaced with Logback, Log4j or java.util.logging. You might
simply try replacing slf4j-simple.jar with slf4j-log4j12.jar.
Another alternative is that Spring actually wants to use
commons-logging. Somehow that has been replaced with SLF4J's
comons-logging compatible implementation. If you just remove
jcl-over-slf4j.jar and replace it with commons-logging.jar this should
also remove slf4j.
Ralph//
David Legg wrote:
> I'm trying to add a new block to a Cocoon web app and every time I try
> to do a 'mvn jetty:run' command I get a
> 'java.lang.AbstractMethodError' and the web app just seems to stop
> serving web pages (error list shown at end of this message).
>
> The block in question makes calls to the Sesame [1] RDF triplestore.
> The important thing is that, like a lot of modern Java apps, Sesame
> makes use of SLF4J [2] to do its logging. I'm not familiar with the
> various logging frameworks but I think I've accidently walked into a
> minefield here! Cocoon seems to use Log4j, Jetty might be using
> something else and my block might need slf4j. Add to this that I've
> seen a report about slf4j not playing well with the Reloading Class
> Loader (RCL) and I think I'm well and truly stuffed!
>
> Please, if anyone knows how to get a library that uses slf4j to play
> nicely in a Cocoon environment I'd be very grateful ;-)
>
> Regards,
> David Legg
>
>
> Errors...
> ...
> [INFO] [jetty:run]
> [INFO] Configuring Jetty for project: meerkat-browser
> ...
> 2008-07-15 16:57:35.032::INFO: Logging to STDERR via
> org.mortbay.log.StdErrLog
> [INFO] Starting jetty 6.1.7 ...
> 2008-07-15 16:57:35.112::INFO: jetty-6.1.7
> ...
> 2008-07-15 16:57:36.964::WARN: failed
> org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@7db754{/,D:\projects\meerkat\meerkat-browser\target\rcl\webapp}
>
> java.lang.AbstractMethodError:
> org.slf4j.impl.SimpleLogger.trace(Ljava/lang/String;)V
> at
> org.apache.commons.logging.impl.SLF4JLog.trace(SLF4JLog.java:82)
> at
> org.springframework.core.CollectionFactory.createConcurrentMapIfPossible(CollectionFactory.java:195)
>
> ...
>
>
> [1] http://www.openrdf.org/
> [2] http://www.slf4j.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org