[英]Weblogic 12c - Deploy an ear twice
I'm trying to deploy an ear file twice on Weblogic 12.2.1.3.0 .我试图在Weblogic 12.2.1.3.0上部署一个 ear 文件两次。 The applications are the same expect for context-root.应用程序与上下文根相同。
They have:他们有:
java.lang.ClassCastException: com.myApplication.models.entityOne cannot be cast to com.myApplication.models.entityOne java.lang.ClassCastException: com.myApplication.models.entityOne 不能转换为 com.myApplication.models.entityOne
It seems that the first ear uses its own models but the EntityManager of second one ear.似乎第一只耳朵使用自己的模型,但第二只耳朵的 EntityManager 。
Structure of my ear file is something like that:我的耳朵文件的结构是这样的:
/
- lib
- jar-with-my-models.jar
- jar-with-persistance.jar
Persistence.xml is defined as following: Persistence.xml 定义如下:
<persistence-unit name="my-persistance-unit" transaction-type="JTA">
<jar-file>jar-with-my-models.jar</jar-file>
</persistence-unit>
Weblogic.xml is defined as follows: 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>
I'm deploying twice my ear file because I want to replicate an issue that I received during parallel deploy in WebLogic我部署了两次我的耳朵文件,因为我想复制我在 WebLogic 中并行部署期间收到的问题
EDIT 1编辑 1
I noticed that entity manager inject by @PersistenceContext is the same between applications我注意到@PersistenceContext 注入的实体管理器在应用程序之间是相同的
Request on first application em: com.sun.proxy.$Proxy523请求第一个应用程序em:com.sun.proxy.$Proxy523
Request on second application em: com.sun.proxy.$Proxy523请求第二个应用程序em:com.sun.proxy.$Proxy523
probably there is a problem between Weblogic class loader if you deploy two applications on the same Weblogic Managed Server (if they share same beans - same package+class name).如果在同一个 Weblogic 托管服务器上部署两个应用程序(如果它们共享相同的 bean - 相同的包 + 类名称),则 Weblogic 类加载器之间可能存在问题。
I suggest you to create differents Weblogic Managed Servers for differents applications.我建议您为不同的应用程序创建不同的 Weblogic 托管服务器。 In this way you won't have problem.这样你就不会有问题了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.