[英]Weblogic 12c - Deploy an ear twice
我試圖在Weblogic 12.2.1.3.0上部署一個 ear 文件兩次。 應用程序與上下文根相同。
他們有:
java.lang.ClassCastException: com.myApplication.models.entityOne 不能轉換為 com.myApplication.models.entityOne
似乎第一只耳朵使用自己的模型,但第二只耳朵的 EntityManager 。
我的耳朵文件的結構是這樣的:
/
- lib
- jar-with-my-models.jar
- jar-with-persistance.jar
Persistence.xml 定義如下:
<persistence-unit name="my-persistance-unit" transaction-type="JTA">
<jar-file>jar-with-my-models.jar</jar-file>
</persistence-unit>
Weblogic.xml 定義如下:
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90">
<context-root>/console</context-root>
<container-descriptor>
<show-archived-real-path-enabled>true</show-archived-real-path-enabled>
<prefer-web-inf-classes>false</prefer-web-inf-classes>
<prefer-application-packages>
<package-name>antlr.*</package-name>
</prefer-application-packages>
</container-descriptor>
<session-descriptor>
<persistent-store-type>memory</persistent-store-type>
<sharing-enabled>true</sharing-enabled>
</session-descriptor>
</weblogic-web-app>
我部署了兩次我的耳朵文件,因為我想復制我在 WebLogic 中並行部署期間收到的問題
編輯 1
我注意到@PersistenceContext 注入的實體管理器在應用程序之間是相同的
請求第一個應用程序em:com.sun.proxy.$Proxy523
請求第二個應用程序em:com.sun.proxy.$Proxy523
如果在同一個 Weblogic 托管服務器上部署兩個應用程序(如果它們共享相同的 bean - 相同的包 + 類名稱),則 Weblogic 類加載器之間可能存在問題。
我建議您為不同的應用程序創建不同的 Weblogic 托管服務器。 這樣你就不會有問題了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.