title: Can't configure hibernate when using rest services
body: <p>I have a project that work on a classic server-client using spring, but it isn't working with rest services.</p>
  <p>In my Repo module i have the Utils class that initialize the session factory</p>
  <pre><code>package app.repos.db;
  
  import org.hibernate.SessionFactory;
  import org.hibernate.boot.MetadataSources;
  import org.hibernate.boot.registry.StandardServiceRegistry;
  import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
  
  public class Utils {
  
      protected static SessionFactory sessionFactory;
      protected static void initialize() {
          // A SessionFactory is set up once for an application!
          final StandardServiceRegistry registry = new StandardServiceRegistryBuilder()
                  .configure() // configures settings from hibernate.cfg.xml
                  .build();
          try {
              System.out.println(&quot;BEGIN TRY !!&quot;);
              sessionFactory = new MetadataSources( registry ).buildMetadata().buildSessionFactory();
              System.out.println(&quot;END TRY !!&quot;);
          }
          catch (Exception e) {
              System.err.println(&quot;Exception &quot;+e);
              e.printStackTrace();
              StandardServiceRegistryBuilder.destroy( registry );
          }
      }
  
      public static void close() {
          if (sessionFactory != null) {
              sessionFactory.close();
          }
      }
  
  }
  </code></pre>
  <p>and my hibernate.cfg.xml is:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC
          &quot;-//Hibernate/Hibernate Configuration DTD 3.0//EN&quot;
          &quot;http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd&quot;&gt;
  
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name=&quot;dialect&quot;&gt;org.hibernate.dialect.SQLiteDialect&lt;/property&gt;
          &lt;property name=&quot;connection.driver_class&quot;&gt;org.sqlite.JDBC&lt;/property&gt;
          &lt;property name=&quot;connection.url&quot;&gt;jdbc:sqlite:db.sqlite&lt;/property&gt;
  
          &lt;property name=&quot;hibernate.hbm2ddl.auto&quot;&gt;update&lt;/property&gt;
  
          &lt;!--         Echo all executed SQL to stdout --&gt;
          &lt;property name=&quot;show_sql&quot;&gt;true&lt;/property&gt;
          &lt;property name=&quot;format_sql&quot;&gt;true&lt;/property&gt;
  
          &lt;mapping resource=&quot;domain/jurat.hbm.xml&quot;/&gt;
          &lt;mapping resource=&quot;domain/participant.hbm.xml&quot;/&gt;
          &lt;mapping resource=&quot;domain/rezultat.hbm.xml&quot;/&gt;
  
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  <p>The gradle from repos module:</p>
  <pre><code>plugins {
      id 'java'
  }
  
  group 'org.example'
  version '1.0-SNAPSHOT'
  
  sourceCompatibility = 1.8
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      compile project (':Domain')
      testCompile group: 'junit', name: 'junit', version: '4.12'
  
      compile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.20.1'
  
      compile 'javax.xml.bind:jaxb-api:2.3.0'
      compile 'javax.activation:activation:1.1'
      compile 'org.glassfish.jaxb:jaxb-runtime:2.3.0'
  
      implementation group: 'com.github.gwenn', name: 'sqlite-dialect', version: '0.1.0'
  
  }
  </code></pre>
  <p>My rest controller is:</p>
  <pre><code>@RestController
  @RequestMapping(&quot;/app/rezultate&quot;)
  public class AppController {
  
      @Autowired
      private RezultateRepoDB rezultate;
      @Autowired
      private JuratiRepoDB jurati;
      @Autowired
      private ParticipantiRepoDB participanti;
  
      @RequestMapping( method=RequestMethod.GET)
      public Participant[] getAll(){
          return participanti.findAll().toArray(new Participant[0]);
      }
  }
  </code></pre>
  <p>When i call the getAll method i get an error in Utils at initialize method and i don't know what is wrong
  Here are the console log</p>
  <pre><code>BEGIN TRY !!
  2021-06-20 17:54:54.648  INFO 5944 --- [nio-8080-exec-1] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
  2021-06-20 17:54:54.696 ERROR 5944 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.util.ServiceConfigurationError: org.hibernate.boot.spi.MetadataBuilderInitializer: Provider org.hibernate.dialect.SQLiteMetadataBuilderInitializer could not be instantiated] with root cause
  
  java.lang.NoSuchMethodError: org.hibernate.dialect.identity.IdentityColumnSupportImpl: method 'void &lt;init&gt;()' not found
      at org.hibernate.dialect.identity.SQLiteDialectIdentityColumnSupport.&lt;init&gt;(SQLiteDialectIdentityColumnSupport.java:3) ~[sqlite-dialect-0.1.0.jar:5.0.12.Final]
      at org.hibernate.dialect.SQLiteDialect.&lt;clinit&gt;(SQLiteDialect.java:114) ~[sqlite-dialect-0.1.0.jar:5.0.12.Final]
      at org.hibernate.dialect.SQLiteMetadataBuilderInitializer.&lt;clinit&gt;(SQLiteMetadataBuilderInitializer.java:28) ~[sqlite-dialect-0.1.0.jar:5.0.12.Final]
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
      at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) ~[na:na]
      at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481) ~[na:na]
      at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:782) ~[na:na]
      at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:724) ~[na:na]
      at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1396) ~[na:na]
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:324) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
      at org.hibernate.boot.internal.MetadataBuilderImpl.&lt;init&gt;(MetadataBuilderImpl.java:141) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
      at org.hibernate.boot.internal.MetadataBuilderImpl.&lt;init&gt;(MetadataBuilderImpl.java:94) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
      at org.hibernate.boot.MetadataSources.getMetadataBuilder(MetadataSources.java:125) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
      at org.hibernate.boot.MetadataSources.buildMetadata(MetadataSources.java:179) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
      at app.repos.db.Utils.initialize(Utils.java:19) ~[Repos-1.0-SNAPSHOT.jar:na]
      at app.repos.db.JuratiRepoDB.findOne(JuratiRepoDB.java:29) ~[Repos-1.0-SNAPSHOT.jar:na]
      at app.rest.AppController.getAll(AppController.java:37) ~[main/:na]
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
      at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
      at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.14.jar:8.5.14]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[na:na]
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[na:na]
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-8.5.14.jar:8.5.14]
      at java.base/java.lang.Thread.run(Thread.java:832) ~[na:na]
  </code></pre>