I'm trying to setup hibernate 3.5.3 with JPA on glassfish 3.0.1;
I'm using a netbeans 6.9.1 enterprise project; I added all the required hibernate files and everything is fine except logging...
I added to the project classpath like the docs say the following (only the log related jars listed):
-slf4j-api-1.5.8.jar
-slf4j-log4j12-1.5.8.jar
-log4j-1.2.16.jar
-log4j.properties which looks like:
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=info, stdout
log4j.logger.org.hibernate.test=info
log4j.logger.org.hibernate.tool.hbm2ddl=debug
I also activated debug using -Dlog4j.debug
JVM property.
As soon as I deploy I get this in the server log:
SEVERE: log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
SEVERE: log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
SEVERE: log4j:ERROR [EarLibClassLoader :
urlSet = [URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/antlr-2.7.6.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/commons-collections-3.1.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/dom4j-1.6.1.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/gwt-servlet.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/hibernate-jpa-2.0-api-1.0.0.Final.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/hibernate3.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/javassist-3.9.0.GA.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/jta-1.1.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/log4j-1.2.16.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/slf4j-api-1.5.8.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/slf4j-log4j12-1.5.8.jar]
doneCalled = false
Parent -> org.glassfish.internal.api.DelegatingClassLoader@10ab6fa
] whereas object of type
SEVERE: log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [EarLibClassLoader :
urlSet = [URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/antlr-2.7.6.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/commons-collections-3.1.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/dom4j-1.6.1.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/gwt-servlet.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/hibernate-jpa-2.0-api-1.0.0.Final.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/hibernate3.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/javassist-3.9.0.GA.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/jta-1.1.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/log4j-1.2.16.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/slf4j-api-1.5.8.jar, URLEntry : file:/C:/Users/Bogdan/Documents/NetBeansProjects/GwtCms/dist/gfdeploy/GwtCms/lib/slf4j-log4j12-1.5.8.jar]
doneCalled = false
Parent -> org.glassfish.internal.api.DelegatingClassLoader@91cd46
].
SEVERE: log4j:ERROR Could not instantiate appender named "stdout".
SEVERE: log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
SEVERE: log4j:WARN Please initialize the log4j system properly.
SEVERE: log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Any ideas on how do I fix this? Thank you!
EDIT
I tried to remove log4j from my project as Tushar Tarkas suggested:
SEVERE: org/apache/log4j/Level
java.lang.NoClassDefFoundError: org/apache/log4j/Level
at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:223)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:120)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:269)
EDIT2: SOLUTION
I don't know why, but if I copy log4j-1.2.16.jar file in /domains/domain1/lib it's working.
EDIT3:
Pascal, here's what GF deploys.
EnterpriseApplication1-ejb_jar >
.netbeans_automatic_build
.netbeans_update_resources
ejbs // classes for EJB
entities // classes for entities
log4j.properties
META-INF
EnterpriseApplication1-war_war >
index.jsp
META-INF
WEB-INF
META-INF
lib >
antlr-2.7.6.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
hibernate3.jar
javassist-3.9.0.GA.jar
jta-1.1.jar
log4j-1.2.16.jar
slf4j-api-1.5.8.jar
slf4j-log4j12-1.5.8.jar