Persistence Unit Service starting multille times

a 夏天 提交于 2019-12-12 04:59:07

问题


I am having EAR project which contains 1 EJB 3.0 Project and 2 WAR Project. I have defined persistence.xml in my EJB project.

However when the application starts it starts persistence unit service 3 times. As per log on startup I can see

Starting Persistence Unit Service 'xyz-ear.ear/xyz-ejb-1_0_0-SNAPSHOT.jar#xyzUnit'
Starting Persistence Unit Service 'xyz-ear.ear/xyz-war-1_0_0-SNAPSHOT.war#xyzUnit'
Starting Persistence Unit Service 'xyz-ear.ear/xyz-service-war-1_0_0-SNAPSHOT.war#xyzUnit'

Beacuse of this my database schema validation is happening 3 times.

@Startup
@Singleton
@PostConstruct

is getting called 3 times.

Has anyone faced this issue before? Please let me know if you need any other info.

PS: I have declared the EJB as ejb and not as ejb-client in pom.xml of both war module.

Can that cause this issue ?

来源:https://stackoverflow.com/questions/36759110/persistence-unit-service-starting-multille-times

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!