Sanatbek Matlatipov
Sanatbek Matlatipov

Reputation: 171

Error in javax.persistence.PersistenceContext.synchronization()

I am trying to build my Jhipster Spring boot application in maven. However, Maven is not building in the debug mode. Otherwise, it is working fine.

I have added following dependency, didn't help.

<dependency>
    <groupId>javax.persistence</groupId>
    <artifactId>persistence-api</artifactId>
    <version>1.0</version>
</dependency>
Description:

An attempt was made to call the method javax.persistence.PersistenceContext.synchronization()Ljavax/persistence/SynchronizationType; but it does not exist. Its class, javax.persistence.PersistenceContext, is available from the following locations:

    jar:file:/C:/Users/User/Documents/audio-book-admin/lib/javax.persistence.jar!/javax/persistence/PersistenceContext.class
    jar:file:/C:/Users/User/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.2.Final/hibernate-jpa-2.1-api-1.0.2.Final.jar!/javax/persistence/PersistenceContext.class
    jar:file:/C:/Users/User/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar!/javax/persistence/PersistenceContext.class

It was loaded from the following location:

    file:/C:/Users/User/Documents/audio-book-admin/lib/javax.persistence.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of javax.persistence.PersistenceContext

So, How can I properly correct classpath of my application to reslove the above issues? I am new in Spring boot!

Upvotes: 0

Views: 4082

Answers (1)

DEBENDRA DHINDA
DEBENDRA DHINDA

Reputation: 1193

First remove in your repository maven the directory hibernate and then make a maven clean install to re import correctly your dependencies.

if it still doesn't fix your problem make a maven tree:dependency to detect what dependence is causing issue and exclude it in your pom

Upvotes: 1

Related Questions