Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j - ear file - jboss6

 
Yaron Rel
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
It seams that whatever i do I keep getting the following error in the server.log:
Is there any normal working tutorial or example for integrating ear file with log4j in jboss?

2010-01-12 15:29:43,097 INFO [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (HDScanner) deploy, ctxPath=/myapp
2010-01-12 15:29:43,472 ERROR [STDERR] (HDScanner) log4j:ERROR A "org.apache.log4j.xml.DOMConfigurator" object is not assignable to a "org.apache.log4j.spi.Configurator" variable.
2010-01-12 15:29:43,472 ERROR [STDERR] (HDScanner) log4j:ERROR The class "org.apache.log4j.spi.Configurator" was loaded by
2010-01-12 15:29:43,472 ERROR [STDERR] (HDScanner) log4j:ERROR [BaseClassLoader@1f66c87{vfszip:/C:/work/tools/jboss-6.0.0.M1/server/default/deploy/my-ear.ear/}] whereas object of type
2010-01-12 15:29:43,472 ERROR [STDERR] (HDScanner) log4j:ERROR "org.apache.log4j.xml.DOMConfigurator" was loaded by [BaseClassLoader@28bf34{vfszip:/C:/work/tools/jboss-6.0.0.M1/server/default/deploy/....
2010-01-12 15:29:43,472 ERROR [STDERR] (HDScanner) log4j:ERROR Could not instantiate configurator [org.apache.log4j.xml.DOMConfigurator].
2010-01-12 15:29:53,168 ERROR [STDERR] (HDScanner) log4j:WARN No appenders could be found for logger (javax.servlet.ServletContextListener).
2010-01-12 15:29:53,168 ERROR [STDERR] (HDScanner) log4j:WARN Please initialize the log4j system properly.

It happens when I call from junit a remote stateless bean that has the following logger:

decleration:
private static Logger logger = Logger.getLogger(MyDao.class);
usage in class:
logger.info("in my dao");

here is my pom dependency of pom.xml:
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>

here is my log4j.properties:
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=debug, stdout
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yaron, welcome to Java Ranch!

Looks like you are packaging the log4j.jar file into your app, which results in classloader issues like the one you are seeing. Change your pom.xml to indicate that the log4j.jar is not needed to be packaged with your app (add a <scope> entry):



P.S. Please use the code tags when posting source code - makes it much easier to read.
 
Yaron Rel
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very mutch :-)
Its working.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic