Spring3.1 & Hibernate4 Konfiguration. Unable to load class [org.hibernate.service.jdbc.- verbindungen.intern.C3P0ConnectionProvider]
Ich versuche zur Entwicklung eines web-Projektes mit Hibernate 4 und spring 3.1. Ich erklärte sessionFactory bean in der applicationContenxt.xml.
<bean id="sessionFactory" scope="singleton" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
</bean>
Will ich mit Oracle-Datenbank, so dass meine hibernate.cfg.xml Datei :
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>
<property name="connection.username">****</property>
<property name="connection.password">****</property>
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<!--
Enable c3p0 connection pooling, because hibernate pooling is not
prod-ready. Apparently connection.provider_class is needed in
hibernate 3+
-->
<property name="connection.provider_class">
org.hibernate.connection.C3P0ConnectionProvider</property>
<!-- <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> -->
<property name="c3p0.max_size">100</property>
<property name="c3p0.min_size">1</property>
<property name="c3p0.idle_test_period">30</property>
<!-- Echo all executed SQL to stdout for debugging -->
<property name="show_sql">true</property>
<!-- All the entity classes for hibernate to check for annotations here
-->
<mapping class="data.Event" />
Wenn ich die Anwendung ausführen. Ich bekomme die Ausnahmen :
1543 [Thread-2] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.service.jdbc.connections.spi.ConnectionProvider]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:377)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:278)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Konnte ich das problem nicht lösen, wie ich bin absoluter Anfänger auf Spring und Hibernate.
Gibt es irgendjemanden, der eine Idee zu dem problem.
Sind Sie sicher, dass Sie alle Abhängigkeiten für hibernate und c3po?
InformationsquelleAutor erencan | 2012-02-28
Du musst angemeldet sein, um einen Kommentar abzugeben.
Ändern (die Sie verweisen, hibernate 3, das ist die richtige Klasse für hibernate v4) :
Müssen Sie möglicherweise diese (wenn mit maven)
sicherlich sieht aus wie es
aber ich habe die org.springframework.orm-3.1.0.M2.jar
das ist nicht der hibernate4-Glas, dessen eine völlig andere jar-Datei
ich konnte keine finden hibernate4.jar. Es gibt keine jar-Datei in den hibernate4.0 zip-Datei. Allerdings habe ich heruntergeladen Frühjahr 3.1.1. VERÖFFENTLICHUNG und ersetzen alle Spring-jars. Das problem ist gelöst. Vielen Dank. 🙂
InformationsquelleAutor NimChimpsky