try { this.invokeInitMethods(beanName, wrappedBean, mbd); } catch (Throwable ex
When does this exception occurs in the application ?
Also When does this exception occurs ?
try {
this.populateBean(beanName, mbd, instanceWrapper);
exposedObject = this.initializeBean(beanName, exposedObject, mbd);
} catch (Throwable var18) {
if (var18 instanceof BeanCreationException bce) {
if (beanName.equals(bce.getBeanName())) {
throw bce;
}
}
Also when does this exception comes
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: jakarta/persistence/PersistenceUnitTransactionType
Also when does this exception occurs ?
if (mbd.isSingleton()) {
sharedInstance = this.getSingleton(beanName, () -> {
try {
return this.createBean(beanName, mbd, args);
} catch (BeansException ex) {
this.destroySingleton(beanName);
throw ex;
}
});
beanName: entityManagerFactory
Exception :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: jakarta/persistence/PersistenceUnitTransactionType
I m getting this error currently when starting the application
17 Replies
⌛ This post has been reserved for your question.
Hey @DevAakash! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
Please format your code to make it more readable. For java, it should look like this:
what is the
Can anyone help me with this one ?
#help-notifications Can anyone help?
show the stack trace for that error you are getting
im on mobile so cant view the files
show where it says causedby
where I can find it ?
when you get the error its gonna say
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: jakarta/persistence/PersistenceUnitTransactionType
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1826) ~[spring-beans-6.2.8.jar:6.2.8]
but the caused by message
lower in the exception its gonna say caused by
Caused by: java.lang.ClassNotFoundException: jakarta.persistence.PersistenceUnitTransactionType
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[na:na]
... 34 common frames omitted
@ayylmao123xdd is this something you're looking for ?
yes
it says it cant find persistence unit transaction type
see if you imported it
ill look into it tomorrow cuz i gtg
I have used the normal imports in the project
import jakarta.persistence.*;
You're getting this:
vbnet
Copy
Edit
BeanCreationException: Error creating bean with name 'entityManagerFactory'
Caused by: ClassNotFoundException: jakarta.persistence.PersistenceUnitTransactionType
🎯 Cause
You're missing the Jakarta Persistence API dependency. Hibernate 6+ and Spring Boot 3+ require it.
✅ Fix
If using Maven:
xml
Copy
Edit
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.1.0</version>
</dependency>
If using Gradle:
groovy
Copy
Edit
implementation 'jakarta.persistence:jakarta.persistence-api:3.1.0'
Add it to your build, then clean and restart the app.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.I already have this dependency in my project
but its still giving the error
can you run mvn clean compile
if you se maven
if gradle use ./gradlew clean build
also copy and paste from ai isnt the best idea to help
(if u used it)
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.