0

I am developing an application making use of the Hibernate framework (v4.3.4). When I run the tests, I get the following exception:

Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session;
    at com.cartif.dwhconnector.manager.DatabaseCommunicator.createDBSession(DatabaseCommunicator.java:89)
    at com.cartif.dwhconnector.manager.DWHManager.createDBSession(DWHManager.java:53)
    at unittest.DWHConnectorTester.main(DWHConnectorTester.java:16)

The Java code is the next one:

Configuration configuration = new Configuration();
configuration.configure("com/cartif/hibernatemappings/hibernate.cfg.xml");
SessionFactory sessionFactory = configuration.buildSessionFactory();
session = sessionFactory.openSession();

I have tried to use the Session class in the packages org.hibernate and org.hibernate.clasic, but the Exception is always the same. Could you help me, please?

Thank you in advance!

Jose Hdez
  • 2,297
  • 7
  • 38
  • 52
  • 2
    This may help you http://stackoverflow.com/questions/8799121/java-lang-nosuchmethoderror-org-hibernate-sessionfactory-opensessionlorg-hibe – mahesh May 05 '14 at 10:47

1 Answers1

0

You are probably using different version of Hibernate during tests and different during appliaction compilation.

Antoniossss
  • 31,590
  • 6
  • 57
  • 99