0

I have a problem with hibernate. Issue: Error creating bean with name 'emf' defined in ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.cfg.Environment.verifyProperties(Ljava/util/Map;)V

It's xml file (servlet-context):http://pastebin.com/BRYvbVTg

And, I have only one dependency from hibernate:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>5.2.4.Final</version>
</dependency>

In classpath, tried add all packages, have the same effect

Full stack trace:http://pastebin.com/wJy7QfPW

mrchebik
  • 109
  • 1
  • 11

1 Answers1

1
  1. As @v.ladynev mentioned, provide full stack trace.
  2. To delete a local lib, locate and navigate to your .m2 folder, /repository/org and delete the hibernate folder
  3. Consider defining your entityManagerFactory as

<property name="dataSource" ref="dataSource" />       
<property name="jpaVendorAdapter">
    <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
</property>
<property name="jpaProperties">
    <props>
        <prop key="hibernate.hbm2ddl.auto">update</prop>
        <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>         
        <prop key="hibernate.connection.charSet">UTF-8</prop>
        <prop key="hibernate.show_sql">true</prop>
    </props>
</property>
<property name="packagesToScan" value="ru.mrchebik.model"/>

I hope this helps!