org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJp aAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javassist/bytecode/ClassFile


Samebug tips10

you can change your scala version to 2.11.11


1 month ago

A few things cause this exception:
1) Check if you have all jars and if they're in the correct path.
2) Your classpath might be broken, you can define it in the command line with java -cp yourClassPath or at your IDE if you're using one.


8 months ago
Expert tip

Solutions on the web3764

Solution icon of stackoverflow
via Stack Overflow by Mr U
, 8 months ago
Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJp aAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javassist/bytecode/ClassFile

Solution icon of github
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: javassist/bytecode/ClassFile

Solution icon of web
Error creating bean with nameentityManagerFactorydefined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javassist/bytecode/ClassFile

Solution icon of stackoverflow
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: javassist/bytecode/ClassFile

Solution icon of stackoverflow
via Stack Overflow by Do Nhu Vy
, 4 months ago
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: javassist/bytecode/ClassFile

Solution icon of stackoverflow
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: javassist/bytecode/ClassFile

Solution icon of github
Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJp aAutoConfiguration.class]: Invocation of init method failed; nested exception is com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: FATAL: password authenticatio n failed for user "demo"

Solution icon of github
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.NullPointerException

Solution icon of stackoverflow
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.NullPointerException

Solution icon of stackoverflow
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.NullPointerException

Stack trace

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJp
aAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javassist/bytecode/ClassFile
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1051)[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:828)[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)[spring-boot-1.3.1.BUILD-SNAPSHOT.jar:1.3.1.BUILD-SNAPSHOT]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)[spring-boot-1.3.1.BUILD-SNAPSHOT.jar:1.3.1.BUILD-SNAPSHOT]
	at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:347)[spring-boot-1.3.1.BUILD-SNAPSHOT.jar:1.3.1.BUILD-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:295)[spring-boot-1.3.1.BUILD-SNAPSHOT.jar:1.3.1.BUILD-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1112)[spring-boot-1.3.1.BUILD-SNAPSHOT.jar:1.3.1.BUILD-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1101)[spring-boot-1.3.1.BUILD-SNAPSHOT.jar:1.3.1.BUILD-SNAPSHOT]
	at com.practice.songbook.Application.main(Application.java:17)[classes/: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.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:467)[spring-boot-maven-plugin-1.3.1.BUILD-SNAPSHOT.jar:1.3.1.BUILD-SNAPSHOT]
	at java.lang.Thread.run(Thread.java:745)[na:1.8.0_65]
Caused by: java.lang.NoClassDefFoundError: javassist/bytecode/ClassFile
	at org.hibernate.jpa.boot.scan.spi.ClassFileArchiveEntryHandler.toClassFile(ClassFileArchiveEntryHandler.java:85)[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
	at org.hibernate.jpa.boot.scan.spi.ClassFileArchiveEntryHandler.handleEntry(ClassFileArchiveEntryHandler.java:65)[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
	at org.hibernate.jpa.boot.archive.internal.ExplodedArchiveDescriptor.processDirectory(ExplodedArchiveDescriptor.java:167)[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
	at org.hibernate.jpa.boot.archive.internal.ExplodedArchiveDescriptor.processDirectory(ExplodedArchiveDescriptor.java:142)[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
	at org.hibernate.jpa.boot.archive.internal.ExplodedArchiveDescriptor.processDirectory(ExplodedArchiveDescriptor.java:142)[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
	at org.hibernate.jpa.boot.archive.internal.ExplodedArchiveDescriptor.processDirectory(ExplodedArchiveDescriptor.java:142)[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
	at org.hibernate.jpa.boot.archive.internal.ExplodedArchiveDescriptor.visitArchive(ExplodedArchiveDescriptor.java:78)[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
	at org.hibernate.jpa.boot.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:72)[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.scan(EntityManagerFactoryBuilderImpl.java:725)[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:221)[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:188)[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
	at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:54)[spring-orm-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)[spring-orm-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)[spring-orm-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	... 22 more
Caused by: java.lang.ClassNotFoundException: javassist.bytecode.ClassFile
	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 java.lang.ClassLoader.loadClass(ClassLoader.java:357)[na:1.8.0_65]
	... 38 more

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

Once, 1 month ago
6 times, 1 month ago
Samebug visitor profile picture
Unknown user
2 times, 2 months ago
4 times, 2 months ago
3 times, 3 months ago
2468 more bugmates