-
1. Re: ClassNotFoundException: org.apache.commons.logging.LogSource
jamezp Mar 1, 2013 1:55 PM (in response to flp05)1 of 1 people found this helpfulAre you including a log4j configuration file in your deployment? If you're excluding the servers log4j you need to provide log4j in your deployment as well as a configuration file so log4j can be configured.
--
James R. Perkins
-
2. Re: ClassNotFoundException: org.apache.commons.logging.LogSource
flp05 Mar 1, 2013 2:29 PM (in response to jamezp)Thanks James.
I know that, but I have multiple deploys wich share the same logging configuration and are distributed between multiple environments.
Concluding, I need to let the logging configuration on the server. Either on standalone.xml or in the server configuration folder. Is this possible?
Thanks again
-
3. Re: ClassNotFoundException: org.apache.commons.logging.LogSource
jamezp Mar 1, 2013 2:32 PM (in response to flp05)Yes that's not a problem at all. Using standalone.xml will work if you don't exclude any of the logging dependencies. In JBoss AS 7.1.1.Final and greater log4j and commons.logging are added to each deployment by default. FWIW jboss-logging and slf4j are added as well.
--
James R. Perkins
-
4. Re: ClassNotFoundException: org.apache.commons.logging.LogSource
flp05 Mar 1, 2013 2:44 PM (in response to jamezp)That's exactly the problem. When I do that, my code doesn't work as expected.
When I create new logging configurations on runtime (with multiple logging files), it doesn't do what it should, and write all to the same file.
(This is tested code, which use a framework and used to work perfectly in Jboss 4, so it's not a code problem).
Also, I'm getting this error:
java.lang.ClassNotFoundException: org.apache.commons.logging.LogSource
Thanks again for the help.
-
5. Re: ClassNotFoundException: org.apache.commons.logging.LogSource
jamezp Mar 1, 2013 4:50 PM (in response to flp05)Ah. It's because we hand off commons-logging to org.sfl4j.jcl-over-slf4j. That class doesn't exist in jcl-over-slf4j. I think it's been deprecated in commons-logging since 2004.
You could try excluding org.apache.commons.logging from your deployment and providing commons-logging in your deployment. I think that should work.
--
James R. Perkins
-
6. Re: ClassNotFoundException: org.apache.commons.logging.LogSource
flp05 Mar 2, 2013 12:50 AM (in response to jamezp)Ok, that corrects the ClassNotFoundException.
However, I'm still unable to create new loggers at runtime for writing the logs in diferent files.
Maybe because common-loggings are in my deployment, and common-loggings is the responsible (I think) of creating new loggers, it's causing a conflict.
Can't I change the module of Jboss to use common-loggings? It's a very big and old application, so change the source code will be almost impossible.
Thanks again,
Luís
-
7. Re: ClassNotFoundException: org.apache.commons.logging.LogSource
jamezp Mar 4, 2013 12:03 PM (in response to flp05)I think you could change the module. You would just need to put a commons-logging JAR in modules/org/apache/commons/logging/main and edit the module.xml.
--
James R. Perkins
-
8. Re: ClassNotFoundException: org.apache.commons.logging.LogSource
flp05 Mar 7, 2013 10:04 AM (in response to jamezp)Thanks James.
I wasn't able to add commons-logging as resource or as a dependency.
I thing that, maybe this is because /org/apache/commons/logging/ is a <module-alias> and not a <module>.
Any ideas?
Best regards,
Luís
-
9. Re: ClassNotFoundException: org.apache.commons.logging.LogSource
jamezp Mar 7, 2013 1:29 PM (in response to flp05)Yes. You would have to change it to a module instead of a module-alias.
Something like:
<?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.1" name="org.apache.commons.logging"> <resources> <resource-root path="commons-logging.jar"/> </resources> </module>
Just replace the commons-logging.jar with the name of the JAR you have in modules/org/apache/commons/logging/main.
--
James R. Perkins