Corso Live Part-time Su Fondamenti Di Java › Forum › Java › Spring Cannot find class [org.hibernate.ejb.HibernatePersistence]
- Il topic è vuoto.
-
AutorePost
-
7 Agosto 2020 alle 15:55 #2121GianniZucOspite::
Sto lavorando su un progetto Spring fatto con maven e Hibernate.
Quando deployo l’applicazione ottengo questa eccezione:
org.springframework.context.support.ClassPathXmlApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Cannot find class [org.hibernate.ejb.HibernatePersistence]
Le dipendenze di hibernate le ho aggiunte:
pon.xml<spring.version>4.3.22.RELEASE</spring.version> <hibernate.version>4.1.9.Final</hibernate.version> <jdbc.version>8.0.20</jdbc.version> </properties> <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>8.0.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>${hibernate.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>${hibernate.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.2.2</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${jdbc.version}</version> </dependency> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.6.2</version> </dependency>
persistence.xml
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="testPU" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>model.Anagrafica</class> <class>model.AreaAziendale</class> <class>model.Azienda</class> <class>model.Community</class> <class>model.DatiCommerciali</class> <class>model.EsperienzeProfessionali</class> <class>model.FiguraProfessionale</class> <class>model.FormazioneProfessionale</class> <class>model.Login</class> <class>model.Mansione</class> <class>model.Skill</class> <class>model.SkillEsperienzeProfessionali</class> <class>model.TitoloDiStudio</class> <class>model.Valutazione</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" /> <property name="hibernate.enable_lazy_load_no_trans" value="true"/> </properties> </persistence-unit> </persistence>
9 Agosto 2020 alle 09:39 #2124 -
AutorePost
- Devi essere connesso per rispondere a questo topic.