spring - Getting a java.lang.NoSuchMethodError when trying to connect to Oracle via Hibernate -


i building application using spring mvc , hibernate. have not integrated hibernate spring yet (new both), , wanted ensure session can opened through hibernate first.

i created simple function test , receiving following error:

exception in thread "main" java.lang.nosuchmethoderror: org.hibernate.integrator.internal.integratorserviceimpl.(ljava/util/linkedhashset;lorg/hibernate/boot/registry/classloading/spi/classloaderservice;)v

my logs tell me error occurs when try use standardserviceregistrybuilder().applysettings() function call.


i have placed sample function below tries create connection (please note void, , not within other try catch exceptions)

public static void main (string [] args) {         testhibernate();     } public static void testhibernate() {         try {             string hibernatefilepath = "src/main/java/hibernate.cfg.xml";             file hibernatefile = new file(hibernatefilepath);             configuration configuration = new configuration().configure(hibernatefile);             standardserviceregistrybuilder builder = new standardserviceregistrybuilder().applysettings(configuration.getproperties());             sessionfactory factory = configuration.buildsessionfactory(builder.build());          } catch (exception e) {             e.printstacktrace();         }     } 

here hibernate.cfg.xml file:

<?xml version='1.0' encoding='utf-8'?> <!doctype hibernate-configuration public         "-//hibernate/hibernate configuration dtd//en"         "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration>     <session-factory>         <property name="connection.url">jdbc:oracle://servername.website.com:12345/dbname678</property>         <property name="connection.driver_class">oracle.jdbc.driver.oracledriver</property>         <property name="connection.username">username</property>         <property name="connection.password">password</property>     </session-factory> </hibernate-configuration> 

file structure project:

file structure


thoughts on approach: understand error being thrown has issue related how functions called. typically java.lang.nosuchmethoderror occurs when function foo of library bar calling version 2.0 instead of 3.0. double checked dependencies , tried rebuild project yet still face same issue. tried intellij's boilerplate code hibernate test connections , still receive exact same error.

you have dependency conflict, example have version x of library while hibernate needs version y of same library.

you can use maven find dependency conflicts, using command like:

mvn dependency:tree -dverbose 

it print dependency tree , indicates libraries in conflict each other.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -