ho creato un progetto Maven e ha aggiunto Spring4, Hibernate4 librerie attraverso pom.xml io sto cercando di collegare il mio web app con il mio database creato in PostgreSql , ma quando pubblico il mio progetto in tomcat apache 7 la seguente eccezione si verifica:java.lang.IllegalArgumentException: No PersistenceProvider specificata nella configurazione EntityManagerFactory
org.springframework.beans.factory.BeanCreationException: Errore la creazione di fagioli con nome 'fem' definito nella risorsa ServletContext [/WEB-INF/applicationContext.xml]: invocazione del metodo init fallita; eccezione annidata è java.lang.IllegalArgumentException: No PersistenceProvider specificato nella configurazione EntityManagerFactory, e scelto PersistenceUnitInfo non specifica un nome di classe fornitore sia a org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java : 1553) a org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:539) a org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:475) a org.springframework.be ans.factory.support.AbstractBeanFactory $ 1.getObject (AbstractBeanFactory.java:304) a org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:228) a org.springframework.beans.factory .support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:300) a org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:195) a org.springframework.context.support.AbstractApplicationContext.getBean (AbstractApplicationContext.java:973) a org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:750).515.053.691,36321 milioni a org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:482) a org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext (ContextLoader.java:403) a org.springframework.web .context.ContextLoader.initWebApplicationContext (ContextLoader.java:306) a org.springframework.web.context.ContextLoaderListener.contextInitialized (ContextLoaderListener.java:106) a org.apache.catalina.core.StandardContext.listenerStart (StandardContext .java: 4994) allo org.apache.catalina.core.StandardContext.startInternal (StandardContext.java:5492) a org.apache.catalina.util.LifecycleBase.start (LifecycleBase.java:150) a org.apache.catalina.core.ContainerBase $ StartChild.call (ContainerBase.java:1575) a org.apache .catalina.core.ContainerBase $ StartChild.call (ContainerBase.java:1565) a java.util.concurrent.FutureTask.run (sorgente sconosciuta) a java.util.concurrent.ThreadPoolExecutor.runWorker (sorgente sconosciuta) a java .util.concurrent.ThreadPoolExecutor $ Worker.run (Fonte sconosciuta) a java.lang.Thread.run (sorgente sconosciuta) Causato da: java.lang.IllegalArgumentException: No PersistenceProvider specificato in configurazione EntityManagerFactory, e scelto PersistenceUnitInfo non specifica un nome di classe fornitore sia a org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory (LocalContainerEntityManagerFactoryBean.java:318) a org.springframework.orm .jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet (AbstractEntityManagerFactoryBean.java:318) a org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods (AbstractAutowireCapableBeanFactory.java:1612) a org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory .initializeBean (AbstractAutowire CapableBeanFactory.java:1549) ... more 21
ecco la mia applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
<context:component-scan base-package="com.medsoft.stadto">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://localhost:1993/Posts" />
<property name="username" value="postgres" />
<property name="password" value="123" />
</bean>
<bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="emf">
<property name="packagesToScan" value="com.medsoft.stadto.entity" />
<property name="dataSource" ref="dataSource" />
<property name="jpaProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2dll.auto">create</prop>
</props>
</property>
</bean>
<tx:annotation-driven transaction-manager="txManager" />
<bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
</beans>
C'è un modo per fare senza usare perssistence.xml? Puoi spiegare cosa fa il suo adattatore del fornitore? – Jess