I use Wildfly 18 to deploy ear of my JavaEE application. My ear consists of ejb.jar and war. JPA stuff with persistence.xml is situated in separated jar which is a dependency of war.
The problem is when I deploying ear, Wildfly reads the same persistence unit twice.
18:40:48,730 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 37) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'ear-1.0-SNAPSHOT.ear/org.example-webapp-1.0-SNAPSHOT.war#FriendPU'
18:40:48,730 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 38) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'ear-1.0-SNAPSHOT.ear/org.example-persistence-1.0-SNAPSHOT.jar#FriendPU'
18:40:48,946 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 38) HHH000204: Processing PersistenceUnitInfo [
name: FriendPU
...]
18:40:48,946 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 37) HHH000204: Processing PersistenceUnitInfo [
name: FriendPU
...]
It seems Wildfly reaches persistence unit through persistence.jar as war dependency in the first time and then directly through this jar. Why does it happen and how can it be fixed?
Thanks!