简体   繁体   English

如何在同一JVM中运行的多个应用程序(Web或ejb)之间共享实例?

[英]How to share an instance between multiple applications (web or ejb) running in the same JVM?

I have to design a way to be able to share the same object between multiple applications. 我必须设计一种能够在多个应用程序之间共享同一对象的方法。 All applications will be on same JVM. 所有应用程序都将在同一JVM上。 They can be different war sides or jar sides. 他们可以是不同的战争方面或罐子方面。 The problem that I am trying to fix is as follows. 我要解决的问题如下。 I have a jar side and in a web application, i create stubs to be used in the war side for ejb invocations. 我有一个jar端,并且在Web应用程序中,我创建了要在war端用于ejb调用的存根。 I have another application and want to be able to use to inspect the same object (which is being referenced by the first web app using stubs). 我有另一个应用程序,希望能够用来检查相同的对象(第一个Web应用程序使用存根引用了该对象)。 Is there a way to achieve this. 有没有办法实现这一目标。

Amogh. 阿莫

I ran into a similar issue once that took a week to debug, it ended up being a classpath issue. 我花了一个星期的时间进行调试,遇到了类似的问题,最终成为类路径问题。 When you are building your app, you will need to create a jar that will hold the classes that you want to share between apps. 在构建应用程序时,您将需要创建一个jar,其中包含要在应用程序之间共享的类。

So you would end up building the 3 ( or N ) projects in the following order: 因此,您将按照以下顺序构建3个(或N)项目:

shared.jar shared.jar

And then put the shared.jar on the path of the other war and ear files when you compile. 然后在编译时将shared.jar放在另一个war和ear文件的路径上。

app.war ejb.jar app.ear etc... app.war ejb.jar app.ear等...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 EJB3.1-在同一JVM中通过多个应用程序进行事务 - EJB3.1 - Transactions over multiple applications in the same JVM 在同一Tomcat实例中运行的Web应用程序之间传输文件 - Transferring files between web applications running in the same Tomcat Instance 当多个应用程序在同一JVM上运行时,JVM内存分析 - JVM memory profiling when multiple applications are running on the same JVM 在同一JVM上使用JavaEE应用程序共享对象(使用JNDI) - Share object between JavaEE applications on the same JVM (using JNDI) 如何使用JBoss在Web应用程序之间共享库 - How to share libs between web applications with JBoss 单个容器中的多个Web应用程序 - JVM的多少个实例? - Multiple web applications in a single container - How many instances of JVM? Glassfish - 在节点之间共享EJB Web应用程序 - Glassfish - share EJB web application between nodes 如何在同一WebSphere Application Server上安装的应用程序之间共享EJB本地接口? - How to share EJB local interface across applications installed on the same WebSphere Application Server? 如何在Java Web应用程序之间共享通用组件? - How can I share common components between Java web applications? 在多个ejb之间共享env-entry - share env-entry between multiple ejb
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM