I'm using Hibernate 2.1.4. I got the quickstart to work successfully under Tomcat 5. I'm now attempting to use Hibernate in an existing web application I have (that runs under Jetty instead of Tomcat). I'm getting the following error when it tries to start the HibernateUtil class (a servlet that loads at startup similar to the quickstart example):
Code:
java.lang.ExceptionInInitializerError
at com.li.wedge.soap.HibernateUtil.<clinit>(HibernateUtil.java:30)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:176)
at org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:215)
at org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHandler.java:445)
at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:150)
at org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationContext.java:449)
at org.mortbay.http.HttpServer.start(HttpServer.java:663)
at com.li.wedge.modules.AxisModule.run(AxisModule.java:71)
at java.lang.Thread.run(Thread.java:534)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Log4JLogger does not implement Log
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:532)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:272)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:246)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
at net.sf.hibernate.cfg.Configuration.<clinit>(Configuration.java:91)
... 15 more
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Log4JLogger does not implement Log
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:416)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:525)
... 19 more
Caused by: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Log4JLogger does not implement Log
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:412)
... 20 more
I suspect there is some classloader issue related to Log4J? Has anyone seen this issue. I searched the forums with no luck. Here is a copy of my hibernate.cfg.xml file:
Code:
<hibernate-configuration>
<session-factory>
<property name="hibernate.dbcp.driverClassName">com.mysql.jdbc.Driver</property>
<property name="hibernate.dbcp.username">myuser</property>
<property name="hibernate.dbcp.password">mypass</property>
<property name="hibernate.dbcp.url">jdbc:mysql://localhost/wedge</property>
<property name="show_sql">false</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- Mapping files -->
<mapping resource="users.hbm.xml"/>
<mapping resource="items.hbm.xml"/>
<mapping resource="actions.hbm.xml"/>
</session-factory>
</hibernate-configuration>