[英]AttributeNotFoundException through JMX in Startup bean on Wildfly
[英]Wildfly - How to startup bean before persistence is loaded?
我想在將持久性單元加載到Wildfly 8.0中之前執行一些邏輯。 我有這樣的結構:
beans.jar包含具有persistence.XML的實體bean和會話bean
before-persistence-bean.jar包含一個類:
@Startup
@Singleton
public class BeforePersistenceServiceBean {
@PostConstruct
public void performOperations() {...}
}
在application.xml中,我有:
<initialize-in-order>true</initialize-in-order>
<module>
<ejb>before-persistence-bean.jar</ejb>
</module>
<module>
<ejb>beans.jar</ejb>
</module>
<module>
<web>
<web-uri>xxx.war</web-uri>
<context-root>/xxx</context-root>
</web>
</module>
現在,在啟動Wildfly之后,出現以下錯誤:
service jboss.persistenceunit."xxx.ear/beans.jar#pu_name" (missing) dependents:
[service jboss.deployment.subunit."xxx.ear"."before-persistence
bean.jar".component.BeforePersistenceServiceBean.START]
但是BeforePersistenceServiceBean不依賴於Persistence Unit,這是怎么回事?
- -編輯 - -
在持久性啟動之前未能部署該bean之后,我使用了與CDI Extension for Flyway中所述類似的解決方案(即,使用Hibernate Integrator API)
如果您的EAR表示您希望隔離子 jboss-deployment-structure.xml
請將jboss-deployment-structure.xml
添加到META-INF
目錄。
我想其中的內容看起來像
<subsystem xmlns="urn:jboss:domain:ee:1.0" >
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<sub-deployment name="xxx.war">
<dependencies>
<module name="deployment.xxx.ear.beans.jar" />
</dependencies>
</sub-deployment>
</subsystem>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.