2

I have a Spring Boot application that successfully starts when run with mvn spring-boot:run but when I try to run it from IntelliJ it crashes in the middle of starting up with this error:

Caused by: java.lang.ClassNotFoundException: net.bytebuddy.matcher.ElementMatchers

The full error is:

"C:\Program Files\JetBrains\IntelliJ IDEA 2019.2\jbr\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2019.2\lib\idea_rt.jar=65274:C:\Program Files\JetBrains\IntelliJ IDEA 2019.2\bin" -Dfile.encoding=UTF-8 -p C:\Users\pupeno\Documents\Project\code\projectserver\target\classes;C:\Users\pupeno\Documents\Project\code\projectcommon\target\classes;C:\Users\pupeno\.m2\repository\org\springframework\spring-context\5.1.9.RELEASE\spring-context-5.1.9.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\spring-beans\5.1.9.RELEASE\spring-beans-5.1.9.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\spring-expression\5.1.9.RELEASE\spring-expression-5.1.9.RELEASE.jar;C:\Users\pupeno\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.9.3\jackson-databind-2.9.9.3.jar;C:\Users\pupeno\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.9\jackson-core-2.9.9.jar;C:\Users\pupeno\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.9\jackson-module-parameter-names-2.9.9.jar;C:\Users\pupeno\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.9\jackson-datatype-jdk8-2.9.9.jar;C:\Users\pupeno\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.9\jackson-datatype-jsr310-2.9.9.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.1.8.RELEASE\spring-boot-starter-web-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-starter\2.1.8.RELEASE\spring-boot-starter-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.1.8.RELEASE\spring-boot-starter-logging-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\pupeno\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\pupeno\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.11.2\log4j-to-slf4j-2.11.2.jar;C:\Users\pupeno\.m2\repository\org\apache\logging\log4j\log4j-api\2.11.2\log4j-api-2.11.2.jar;C:\Users\pupeno\.m2\repository\org\slf4j\jul-to-slf4j\1.7.28\jul-to-slf4j-1.7.28.jar;C:\Users\pupeno\.m2\repository\org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.1.8.RELEASE\spring-boot-starter-json-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.1.8.RELEASE\spring-boot-starter-tomcat-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\spring-web\5.1.9.RELEASE\spring-web-5.1.9.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\spring-webmvc\5.1.9.RELEASE\spring-webmvc-5.1.9.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.1.8.RELEASE\spring-boot-starter-jdbc-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\com\zaxxer\HikariCP\3.2.0\HikariCP-3.2.0.jar;C:\Users\pupeno\.m2\repository\org\slf4j\slf4j-api\1.7.28\slf4j-api-1.7.28.jar;C:\Users\pupeno\.m2\repository\org\springframework\spring-jdbc\5.1.9.RELEASE\spring-jdbc-5.1.9.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\spring-tx\5.1.9.RELEASE\spring-tx-5.1.9.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-starter-data-jpa\2.1.8.RELEASE\spring-boot-starter-data-jpa-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-starter-aop\2.1.8.RELEASE\spring-boot-starter-aop-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\aspectj\aspectjweaver\1.9.4\aspectjweaver-1.9.4.jar;C:\Users\pupeno\.m2\repository\org\hibernate\hibernate-core\5.3.11.Final\hibernate-core-5.3.11.Final.jar;C:\Users\pupeno\.m2\repository\javax\persistence\javax.persistence-api\2.2\javax.persistence-api-2.2.jar;C:\Users\pupeno\.m2\repository\org\javassist\javassist\3.23.2-GA\javassist-3.23.2-GA.jar;C:\Users\pupeno\.m2\repository\net\bytebuddy\byte-buddy\1.9.16\byte-buddy-1.9.16.jar;C:\Users\pupeno\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\pupeno\.m2\repository\org\jboss\jandex\2.0.5.Final\jandex-2.0.5.Final.jar;C:\Users\pupeno\.m2\repository\org\dom4j\dom4j\2.1.1\dom4j-2.1.1.jar;C:\Users\pupeno\.m2\repository\org\hibernate\common\hibernate-commons-annotations\5.0.4.Final\hibernate-commons-annotations-5.0.4.Final.jar;C:\Users\pupeno\.m2\repository\org\springframework\data\spring-data-jpa\2.1.10.RELEASE\spring-data-jpa-2.1.10.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\data\spring-data-commons\2.1.10.RELEASE\spring-data-commons-2.1.10.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\spring-orm\5.1.9.RELEASE\spring-orm-5.1.9.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\spring-aspects\5.1.9.RELEASE\spring-aspects-5.1.9.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-starter-security\2.1.8.RELEASE\spring-boot-starter-security-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\spring-aop\5.1.9.RELEASE\spring-aop-5.1.9.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\security\spring-security-config\5.1.6.RELEASE\spring-security-config-5.1.6.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\security\spring-security-web\5.1.6.RELEASE\spring-security-web-5.1.6.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-starter-actuator\2.1.8.RELEASE\spring-boot-starter-actuator-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-actuator-autoconfigure\2.1.8.RELEASE\spring-boot-actuator-autoconfigure-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-actuator\2.1.8.RELEASE\spring-boot-actuator-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\io\micrometer\micrometer-core\1.1.6\micrometer-core-1.1.6.jar;C:\Users\pupeno\.m2\repository\org\hdrhistogram\HdrHistogram\2.1.9\HdrHistogram-2.1.9.jar;C:\Users\pupeno\.m2\repository\org\latencyutils\LatencyUtils\2.0.3\LatencyUtils-2.0.3.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-devtools\2.1.8.RELEASE\spring-boot-devtools-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot\2.1.8.RELEASE\spring-boot-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.1.8.RELEASE\spring-boot-autoconfigure-2.1.8.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\postgresql\postgresql\42.2.8.jre7\postgresql-42.2.8.jre7.jar;C:\Users\pupeno\.m2\repository\org\bouncycastle\bcprov-jdk15on\1.63\bcprov-jdk15on-1.63.jar;C:\Users\pupeno\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\pupeno\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.17.Final\hibernate-validator-6.0.17.Final.jar;C:\Users\pupeno\.m2\repository\org\jboss\logging\jboss-logging\3.3.3.Final\jboss-logging-3.3.3.Final.jar;C:\Users\pupeno\.m2\repository\com\fasterxml\classmate\1.4.0\classmate-1.4.0.jar;C:\Users\pupeno\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar;C:\Users\pupeno\.m2\repository\org\flywaydb\flyway-core\5.2.4\flyway-core-5.2.4.jar;C:\Users\pupeno\.m2\repository\io\sentry\sentry-spring\1.7.27\sentry-spring-1.7.27.jar;C:\Users\pupeno\.m2\repository\io\sentry\sentry\1.7.27\sentry-1.7.27.jar;C:\Users\pupeno\.m2\repository\com\newrelic\agent\java\newrelic-agent\5.7.0\newrelic-agent-5.7.0.jar;C:\Users\pupeno\.m2\repository\org\apache\commons\commons-lang3\3.9\commons-lang3-3.9.jar;C:\Users\pupeno\.m2\repository\javax\xml\bind\jaxb-api\2.3.1\jaxb-api-2.3.1.jar;C:\Users\pupeno\.m2\repository\javax\activation\javax.activation-api\1.2.0\javax.activation-api-1.2.0.jar;C:\Users\pupeno\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.10\jackson-annotations-2.9.10.jar;C:\Users\pupeno\.m2\repository\javax\transaction\javax.transaction-api\1.3\javax.transaction-api-1.3.jar;C:\Users\pupeno\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.26\tomcat-embed-core-9.0.26.jar;C:\Users\pupeno\.m2\repository\org\apache\tomcat\tomcat-annotations-api\9.0.24\tomcat-annotations-api-9.0.24.jar;C:\Users\pupeno\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.26\tomcat-embed-el-9.0.26.jar;C:\Users\pupeno\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.26\tomcat-embed-websocket-9.0.26.jar;C:\Users\pupeno\.m2\repository\org\springframework\spring-core\5.1.9.RELEASE\spring-core-5.1.9.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\spring-jcl\5.1.9.RELEASE\spring-jcl-5.1.9.RELEASE.jar;C:\Users\pupeno\.m2\repository\org\springframework\security\spring-security-core\5.1.6.RELEASE\spring-security-core-5.1.6.RELEASE.jar -m com.example.projectserver/com.example.projectserver.ProjectServerApplication

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                        

2019-10-02 08:22:07.508  INFO 6188 --- [  restartedMain] t.f.d.ProjectServerApplication           : Starting ProjectServerApplication on Utopia-Planitia with PID 6188 (C:\Users\pupeno\Documents\Project\code\projectserver\target\classes started by pupeno in C:\Users\pupeno\Documents\Project\code\projectserver)
2019-10-02 08:22:07.508  INFO 6188 --- [  restartedMain] t.f.d.ProjectServerApplication           : No active profile set, falling back to default profiles: default
2019-10-02 08:22:07.523  INFO 6188 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2019-10-02 08:22:07.523  INFO 6188 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2019-10-02 08:22:08.715  INFO 6188 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-10-02 08:22:08.855  INFO 6188 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 140ms. Found 4 repository interfaces.
2019-10-02 08:22:09.199  INFO 6188 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$a23db6f6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-10-02 08:22:09.508  INFO 6188 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-10-02 08:22:09.539  INFO 6188 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-10-02 08:22:09.539  INFO 6188 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.26]
2019-10-02 08:22:09.586  INFO 6188 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-10-02 08:22:09.586  INFO 6188 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2063 ms
2019-10-02 08:22:09.898  INFO 6188 --- [  restartedMain] o.f.c.internal.license.VersionPrinter    : Flyway Community Edition 5.2.4 by Boxfuse
2019-10-02 08:22:09.898  INFO 6188 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2019-10-02 08:22:09.992  INFO 6188 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2019-10-02 08:22:09.992  INFO 6188 --- [  restartedMain] o.f.c.internal.database.DatabaseFactory  : Database: jdbc:postgresql://localhost/project_dev (PostgreSQL 11.4)
2019-10-02 08:22:09.992  WARN 6188 --- [  restartedMain] o.f.c.internal.database.base.Database    : Flyway upgrade recommended: PostgreSQL 11.4 is newer than this version of Flyway and support has not been tested.
2019-10-02 08:22:10.086  INFO 6188 --- [  restartedMain] o.f.core.internal.command.DbMigrate      : Current version of schema "public": 0015
2019-10-02 08:22:10.086  INFO 6188 --- [  restartedMain] o.f.core.internal.command.DbMigrate      : Schema "public" is up to date. No migration necessary.
2019-10-02 08:22:10.226  INFO 6188 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
2019-10-02 08:22:10.258  INFO 6188 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate Core {[WORKING]}
2019-10-02 08:22:10.258  INFO 6188 --- [  restartedMain] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2019-10-02 08:22:10.258  WARN 6188 --- [  restartedMain] ConfigServletWebServerApplicationContext : 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/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: net/bytebuddy/matcher/ElementMatchers
2019-10-02 08:22:10.258  INFO 6188 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2019-10-02 08:22:10.316  INFO 6188 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2019-10-02 08:22:10.318  INFO 6188 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2019-10-02 08:22:10.320  INFO 6188 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-10-02 08:22:10.335 ERROR 6188 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: net/bytebuddy/matcher/ElementMatchers
    at spring.beans@5.1.9.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778) ~[spring-beans-5.1.9.RELEASE.jar:na]
    at spring.beans@5.1.9.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.9.RELEASE.jar:na]
    at spring.beans@5.1.9.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.9.RELEASE.jar:na]
    at spring.beans@5.1.9.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.9.RELEASE.jar:na]
    at spring.beans@5.1.9.RELEASE/org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.9.RELEASE.jar:na]
    at spring.beans@5.1.9.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.9.RELEASE.jar:na]
    at spring.beans@5.1.9.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.9.RELEASE.jar:na]
    at spring.context@5.1.9.RELEASE/org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105) ~[spring-context-5.1.9.RELEASE.jar:na]
    at spring.context@5.1.9.RELEASE/org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.1.9.RELEASE.jar:na]
    at spring.context@5.1.9.RELEASE/org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.9.RELEASE.jar:na]
    at spring.boot@2.1.8.RELEASE/org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.8.RELEASE.jar:na]
    at spring.boot@2.1.8.RELEASE/org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.8.RELEASE.jar:na]
    at spring.boot@2.1.8.RELEASE/org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.8.RELEASE.jar:na]
    at spring.boot@2.1.8.RELEASE/org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.8.RELEASE.jar:na]
    at spring.boot@2.1.8.RELEASE/org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.1.8.RELEASE.jar:na]
    at spring.boot@2.1.8.RELEASE/org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) ~[spring-boot-2.1.8.RELEASE.jar:na]
    at com.example.projectserver/com.example.projectserver.ProjectServerApplication.main(ProjectServerApplication.java:13) ~[classes/: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:566) ~[na:na]
    at spring.boot.devtools@2.1.8.RELEASE/org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.1.8.RELEASE.jar:na]
Caused by: java.lang.NoClassDefFoundError: net/bytebuddy/matcher/ElementMatchers
    at org.hibernate.orm.core@5.3.11.Final/org.hibernate.bytecode.internal.bytebuddy.BytecodeProviderImpl.<clinit>(BytecodeProviderImpl.java:43) ~[hibernate-core-5.3.11.Final.jar:na]
    at org.hibernate.orm.core@5.3.11.Final/org.hibernate.cfg.Environment.buildBytecodeProvider(Environment.java:357) ~[hibernate-core-5.3.11.Final.jar:na]
    at org.hibernate.orm.core@5.3.11.Final/org.hibernate.cfg.Environment.buildBytecodeProvider(Environment.java:352) ~[hibernate-core-5.3.11.Final.jar:na]
    at org.hibernate.orm.core@5.3.11.Final/org.hibernate.cfg.Environment.<clinit>(Environment.java:246) ~[hibernate-core-5.3.11.Final.jar:na]
    at org.hibernate.orm.core@5.3.11.Final/org.hibernate.boot.registry.StandardServiceRegistryBuilder.<init>(StandardServiceRegistryBuilder.java:78) ~[hibernate-core-5.3.11.Final.jar:na]
    at org.hibernate.orm.core@5.3.11.Final/org.hibernate.boot.registry.StandardServiceRegistryBuilder.<init>(StandardServiceRegistryBuilder.java:67) ~[hibernate-core-5.3.11.Final.jar:na]
    at org.hibernate.orm.core@5.3.11.Final/org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:202) ~[hibernate-core-5.3.11.Final.jar:na]
    at org.hibernate.orm.core@5.3.11.Final/org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:167) ~[hibernate-core-5.3.11.Final.jar:na]
    at spring.orm@5.1.9.RELEASE/org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:51) ~[spring-orm-5.1.9.RELEASE.jar:na]
    at spring.orm@5.1.9.RELEASE/org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.1.9.RELEASE.jar:na]
    at spring.orm@5.1.9.RELEASE/org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390) ~[spring-orm-5.1.9.RELEASE.jar:na]
    at spring.orm@5.1.9.RELEASE/org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377) ~[spring-orm-5.1.9.RELEASE.jar:na]
    at spring.orm@5.1.9.RELEASE/org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.1.9.RELEASE.jar:na]
    at spring.beans@5.1.9.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837) ~[spring-beans-5.1.9.RELEASE.jar:na]
    at spring.beans@5.1.9.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774) ~[spring-beans-5.1.9.RELEASE.jar:na]
    ... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: net.bytebuddy.matcher.ElementMatchers
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
    ... 36 common frames omitted


Process finished with exit code 0

I'm using OpenJDK 11 in this case:

> java --version
openjdk 11.0.2 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

I also tried OpenJDK 13 with the same result:

openjdk 13 2019-09-17
OpenJDK Runtime Environment (build 13+33)
OpenJDK 64-Bit Server VM (build 13+33, mixed mode, sharing)

I tried adding the bytebuddy dependencies explicitly, just in case, due to this SpringBoot 2.1.0 throws ClassNotFoundException when trying to integrate database access, but then I get a different error:

Information:java: compiler message file broken: key=compiler.misc.msg.bug arguments=11.0.4, {1}, {2}, {3}, {4}, {5}, {6}, {7}
Information:java: java.lang.module.FindException: Unable to derive module descriptor for C:\Users\pupeno\.m2\repository\net\bytebuddy\byte-buddy-dep\1.10.1\byte-buddy-dep-1.10.1.jar
Information:java:   at java.base/jdk.internal.module.ModulePath.readJar(ModulePath.java:647)
... Backtrace cut due to Stack Overflow's size limit
Information:java: Caused by: java.lang.IllegalArgumentException: byte.buddy.dep: Invalid module name: 'byte' is not a Java identifier
Information:java:   at java.base/jdk.internal.module.Checks.requireModuleName(Checks.java:52)
Information:java:   at java.base/java.lang.module.ModuleDescriptor$Builder.<init>(ModuleDescriptor.java:1550)
Information:java:   at java.base/java.lang.module.ModuleDescriptor.newAutomaticModule(ModuleDescriptor.java:2438)
Information:java:   at java.base/jdk.internal.module.ModulePath.deriveModuleDescriptor(ModulePath.java:507)
Information:java:   at java.base/jdk.internal.module.ModulePath.readJar(ModulePath.java:643)
Information:java:   ... 49 more
Information:java: Errors occurred while compiling module 'projectserver'
Information:javac 11.0.4 was used to compile java sources
Information:Module "projectserver" was fully rebuilt due to project configuration/dependencies changes
Information:2019-10-02 08:24 - Build completed with 1 error and 0 warnings in 5 s 621 ms
Error:java: Compilation failed: internal java compiler error

Any ideas what's going on with this particular jar or what to try to get it to work?

Rafael Winterhalter, author of Byte Buddy, suggest this might be a bug on IntelliJ and I have already report it to them. One thing that gives me pause is that this library is required by Spring Boot itself, not my application:

[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.1.8.RELEASE:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.3.11.Final:compile
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.9.16:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.1.8.RELEASE:test
[INFO] |  +- org.mockito:mockito-core:jar:2.23.4:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.9.16:test

That would mean no Spring Boot application can run in Java >= 9 on IntelliJ. Surely I'm not the first one to hit this combination. Is there something else on my app that's causing it?

Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622

2 Answers2

1

I am fairly certain that this has something to do with the module descriptor that ships with Byte Buddy. The library's module-info.class is located in META-INF/versions/9, the designated folder for multi-release jars, to avoid disrupting applications running on older JVM versions. This was quite an issue when Byte Buddy shipped the module-info in the root package.

Supposedly, this class file should be ignored by class loaders that do not support multi-release jars what is not normally an issue since only the JVM built-in class loader processes module descriptors, normally.

I see a lot of org.jetbrains.jps in your stack trace. I'd argue that this is a problem of your IDE not treating multi-version modular jars correctly. What happens if you run this application directly?

Rafael Winterhalter
  • 42,759
  • 13
  • 108
  • 192
1

From the debug output of mvn spring-boot:run, it seems that Maven starts the JVM in the classpath mode. IDEA starts the app in the module path mode (see the use of -mp and -m options in the very first line of the log). Unfortunately, Spring Boot components aren't quite ready for that.

The particular problem with ByteBuddy is described in this article (section "Javassist Failure"); there is also a similar issue with Tomcat.