Interface javax.persistence.persistenceContext Annotation not found on protected javax.persistence.EntityManager when migrating app from Jboss 7.2 to wildlfy 24

149 views
Skip to first unread message

Benoit Chaurand

unread,
Feb 23, 2022, 12:13:35 PM2/23/22
to WildFly
Hello,

I am trying to migrate an old app from Jboss 7.2 to wildfly 24, but it failed with the error :
Interface javax.persistence.persistenceContext Annotation not found on protected javax.persistence.EntityManager. 
Obviously both classes are in the module hibernate-jpa-2.1-api which i've declared in my pom.

I've joined the stack trace and my configuration in the message, would you have an idea where the problem come from?

Thank you in advance !

server-1.log
persistence.xml
standalone-Wildfly24.xml
jboss-deployment-structure.xml
pom.xml

Wolfgang

unread,
Feb 23, 2022, 4:22:40 PM2/23/22
to WildFly
Hi,

you probably need this:

<dependency>

  <groupId>jakarta.persistence</groupId>

  <artifactId>jakarta.persistence-api</artifactId>

  <scope>provided</scope>

</dependency>

By the way: I suggest to declare the WildFly BOM dependency. Thus you import the WildFly dependency chain and can declare all jar files bundled with WildFly in "pom.xml" without version definitions:


<dependencyManagement>

  <dependencies>

    <dependency>
      <groupId>org.wildfly.bom</groupId>

      <artifactId>wildfly-jakartaee8-with-tools</artifactId>

      <version>24.0.0.Final</version>

      <type>pom</type>

      <scope>import</scope>

    </dependency>

  </dependencies>
<dependencyManagement> 

You might create a blank new project from the archetype "wildfly-jakartaee-ear-archetype" and take at look at the way the dependencies are declared there.

Hope this helps

Wolfgang
Reply all
Reply to author
Forward
0 new messages