title: ERROR 7405 --- [ main] o.s.boot.SpringApplication : Application startup failed
body: <p><p>I am using Gradle 2.9 and springBootVersion = '1.3.1.RELEASE'
   Build is successful but jar deployment is not successful. These are my    logs:</p></p>
  
  <pre><code>2016-02-05 20:44:13.905  WARN 7405 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl$Work
  2016-02-05 20:44:13.916  INFO 7405 --- [           main] o.apache.catalina.core.StandardService   : Stopping service Tomcat
  2016-02-05 20:44:13.942 ERROR 7405 --- [           main] o.s.boot.SpringApplication               : Application startup failed
  
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl$Work
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054) ~[spring-context-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:829) ~[spring-context-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.1.RELEASE.jar!/:1.3.1.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764) [spring-boot-1.3.1.RELEASE.jar!/:1.3.1.RELEASE]
      at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) [spring-boot-1.3.1.RELEASE.jar!/:1.3.1.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) [spring-boot-1.3.1.RELEASE.jar!/:1.3.1.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1124) [spring-boot-1.3.1.RELEASE.jar!/:1.3.1.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1113) [spring-boot-1.3.1.RELEASE.jar!/:1.3.1.RELEASE]
      at com.opensecret.OpenSecretApplication.main(OpenSecretApplication.java:10) [open-secret-0.0.1-SNAPSHOT.jar!/:na]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_65]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_65]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_65]
      at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_65]
      at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53) [open-secret-0.0.1-SNAPSHOT.jar!/:na]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_65]
  Caused by: java.lang.NoClassDefFoundError: org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl$Work
      at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:54) ~[spring-orm-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343) ~[spring-orm-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318) ~[spring-orm-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
      ... 22 common frames omitted
  Caused by: java.lang.ClassNotFoundException: org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$Work
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_65]
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_65]
      at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:178) ~[open-secret-0.0.1-SNAPSHOT.jar!/:na]
      at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142) ~[open-secret-0.0.1-SNAPSHOT.jar!/:na]
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_65]
      ... 27 common frames omitted
  
  2016-02-05 20:44:13.958  WARN 7405 --- [           main] o.s.boot.SpringApplication               : Error handling failed (Error creating bean with name 'delegatingApplicationListener' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' is defined)
  java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl$Work
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:829)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764)
      at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1124)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1113)
      at com.opensecret.OpenSecretApplication.main(OpenSecretApplication.java:10)
      ... 6 more
  Caused by: java.lang.NoClassDefFoundError: org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl$Work
      at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:54)
      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
      ... 22 more
  Caused by: java.lang.ClassNotFoundException: org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$Work
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:178)
      at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 27 more
  </code></pre>
  
  <p>This my gradle file:</p>
  
  <pre><code>buildscript {
      ext {
          springBootVersion = '1.3.1.RELEASE'
          hibernateVersion = '5.0.7.Final'
          mysqlVersion = '5.1.6'
          junitVersion = '4.12'
      }
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
      }
  }
  
  apply plugin: 'spring-boot' 
  
  jar {
      baseName = 'open-secret'
      version = '0.0.1-SNAPSHOT'
  }
  
  dependencies {
      compile("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}")
      compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
      compile("org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}")
      compile("org.springframework.boot:spring-boot-starter-security:${springBootVersion}")
      compile("org.hibernate:hibernate-core:${hibernateVersion}")
      compile("mysql:mysql-connector-java:${mysqlVersion}")
      testCompile("org.springframework.boot:spring-boot-starter-test:${springBootVersion}")
      testCompile("junit:junit:${junitVersion}")
      testCompile("org.mockito:mockito-core:1.10.19")
  }
  
  
  eclipse {
      classpath {
           containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
           containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
      }
  }
  </code></pre>
  
  <p>This is my Controller:</p>
  
  <pre><code>    package com.opensecret.controller;
  
      import org.springframework.beans.factory.annotation.Autowired;
      import org.springframework.web.bind.annotation.*;
      import com.opensecret.model.User;
      import com.opensecret.repository.UserRepository;
  
      import java.util.List;
  
      @RestController
      @RequestMapping(value="/api/user")
      public class UserController {
  
          @Autowired
          private UserRepository userRepository;
  
          @RequestMapping(method = RequestMethod.GET)
          public List&lt;User&gt; findAll() {
              return userRepository.findAll();
          }
  
          @RequestMapping(method = RequestMethod.POST)
          public User add(@RequestBody User user) {
              User model = new User();
              model.setEmail(user.getEmail());
              model.setName(user.getEmail());
              return userRepository.saveAndFlush(model);
          }
  
          @RequestMapping(value = "/{id}", method = RequestMethod.GET)
          public User findOne(@PathVariable int id) {
              return userRepository.findOne(id);
          }
  
          @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
          public User update(@PathVariable int id, @RequestBody User user) {
              User model = userRepository.findOne(id);
              if (model != null) {
                  model.setName(user.getName());
                  model.setEmail(user.getEmail());
                  return userRepository.saveAndFlush(model);
              }
              return null;
          }
  
          @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
          public void delete(@PathVariable int id) {
              userRepository.delete(id);
          }
      }
  
  This is my model:
  package com.opensecret.model;
  
  import javax.persistence.*;
  import javax.validation.constraints.NotNull;
  import javax.validation.constraints.Size;
  
  @Entity
  @Table(name="users")
  public class User {
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      @Column(name = "id")
      private int id;
  
      @NotNull
      @Size(min = 3, max = 80)
      @Column(name = "email")
      private String email;
  
      @NotNull
      @Size(min = 2, max = 80)
      @Column(name = "name")
      private String name;
  
      public int getId() {
          return id;
      }
  
      public String getEmail() {
          return email;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
  }
  </code></pre>
  
  <p>This is my Security Config:</p>
  
  <pre><code>package com.opensecret.config;
  
  import org.springframework.context.annotation.Configuration;
  import org.springframework.http.HttpMethod;
  import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
  import org.springframework.security.config.http.SessionCreationPolicy;
  
  @Configuration
  public class SecurityConfig extends WebSecurityConfigurerAdapter {
      @Override
      protected void configure(HttpSecurity http) throws Exception {
          http
                  .csrf().disable()
                  .authorizeRequests()
                  .antMatchers(HttpMethod.POST, "/api/**").authenticated()
                  .antMatchers(HttpMethod.PUT, "/api/**").authenticated()
                  .antMatchers(HttpMethod.DELETE, "/api/**").authenticated()
                  .anyRequest().permitAll()
                  .and()
                  .httpBasic().and()
                  .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
      }
  }
  </code></pre>
  
  <p>This is my Repository:</p>
  
  <pre><code>import com.opensecret.model.User;
  import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.stereotype.Repository;
  
  @Repository
  public interface UserRepository extends JpaRepository&lt;User,Integer&gt;{
  }
  </code></pre>
  
  <p>This is application.properties:</p>
  
  <pre><code>server.port: 9000
  management.port: 9001
  management.address: 127.0.0.1
  
  spring.datasource.url= jdbc:mysql://localhost:3306/opensecret
  spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  spring.datasource.username=root
  spring.datasource.password=password
  
  spring.jpa.hibernate.ddl-auto=create-drop
  </code></pre>
  
  <p>And this is main:</p>
  
  <pre><code>package com.opensecret;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class OpenSecretApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(OpenSecretApplication.class, args);
      }
  }
  </code></pre>
  
  <p>Please someone help me I am not able to understand why it's happening...</p>