title: Spring Boot: Adding @Transactional produces java.lang.ClassNotFoundException: org.aspectj.util.PartialOrder$PartialComparable
body: <p>Spring Boot 1.4.2 with Kotlin and Gradle 3.0. When we try to add @Transactional to the controller method, the resulting jar is failing to start with error:</p>
  
  <pre><code>2016-12-14 15:22:57.055 ERROR 4666 --- [           main] o.s.boot.SpringApplication               : Application startup failed
  
  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'personService': Unsatisfied dependency expressed through field 'registrator': Error creating bean with name 'personRegistrator' defined in file [/home/voksiv/projects/svc-bereg/build/classes/main/com/beget/bereg/services/internal/person/commands/PersonRegistrator.class]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/util/PartialOrder$PartialComparable; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRegistrator' defined in file [/home/voksiv/projects/svc-bereg/build/classes/main/com/beget/bereg/services/internal/person/commands/PersonRegistrator.class]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/util/PartialOrder$PartialComparable
  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:569) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:349) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
  at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
  at com.beget.bereg.ApplicationKt.main(Application.kt:15) [main/:na]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111]
  at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111]
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRegistrator' defined in file [/home/voksiv/projects/svc-bereg/build/classes/main/com/beget/bereg/services/internal/person/commands/PersonRegistrator.class]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/util/PartialOrder$PartialComparable
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1214) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1054) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1019) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:566) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  ... 24 common frames omitted
  Caused by: java.lang.NoClassDefFoundError: org/aspectj/util/PartialOrder$PartialComparable
  at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_111]
  at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_111]
  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_111]
  at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[na:1.8.0_111]
  at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_111]
  at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_111]
  at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_111]
  at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_111]
  at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[na:1.8.0_111]
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_111]
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_111]
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_111]
  at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.sortAdvisors(AspectJAwareAdvisorAutoProxyCreator.java:73) ~[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:91) ~[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:69) ~[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:347) ~[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:299) ~[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:422) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
  ... 34 common frames omitted
  Caused by: java.lang.ClassNotFoundException: org.aspectj.util.PartialOrder$PartialComparable
  at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_111]
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
  </code></pre>
  
  <p>build gradle is:</p>
  
  <pre><code>group 'templateProject'
  
  buildscript {
      ext {
          kotlinVersion = '1.0.5-2'
          springBootVersion = '1.4.2.RELEASE'
      }
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
          classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
      }
  }
  
  apply plugin: 'kotlin'
  apply plugin: 'idea'
  apply plugin: 'org.springframework.boot'
  
  dependencies {
      // Kotlin
      compile  group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: "$kotlinVersion"
  
      // Spring
      compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: "$springBootVersion"
      compile group: 'org.springframework.data', name: 'spring-data-jpa', version: '1.10.5.RELEASE'
  
      // https://mvnrepository.com/artifact/mysql/mysql-connector-java
      compile group: 'mysql', name: 'mysql-connector-java', version: '6.0.5'
  
      // https://mvnrepository.com/artifact/com.zaxxer/HikariCP
      compile group: 'com.zaxxer', name: 'HikariCP', version: '2.5.1'
  
      // JPA &amp; Hibernate
      compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.0.Final'
  
      // https://mvnrepository.com/artifact/org.hibernate/hibernate
      compile group: 'org.hibernate', name: 'hibernate', version: '3.5.4-Final'
  
      // https://mvnrepository.com/artifact/org.hibernate/hibernate-core
      compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.5.Final'
  
      // Db Flyway migrations
      compile group: 'org.flywaydb', name: 'flyway-core', version: '4.0.3'
      compile group: 'com.h2database', name: 'h2', version: '1.3.170'
  
  
      testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: "$kotlinVersion"
      testCompile group: 'junit', name: 'junit', version: '4.12'
      testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test'
  }
  
  springBoot {
      mainClass = "com.example.ApplicationKt"
  }
  
  repositories {
      mavenCentral()
  }
  
  sourceSets {
      main {
          java {
              srcDir 'src/main/kotlin'
          }
      }
  }
  </code></pre>
  
  <p>Honestly - We have no idea what to do next. gradle dependencies show that aspectjweaver exists and it has a correct version.</p>
  
  <p>After spending two days with it and making no progress, we are open to any ideas.</p>
  
  <p><a href="https://github.com/voksiv/kotlin-spring-boot-template" rel="nofollow noreferrer">Repo</a> if anyone interested in code.</p>