users@glassfish.java.net

Same entity deployed in multiple ears in same jvm

From: <glassfish_at_javadesktop.org>
Date: Sat, 05 Jul 2008 12:40:06 PDT

I've been working on a home grown application framework just to learn and removed a lot of issues I've encountered when working with EJB3 apps at various locations.

The main problem I am trying to address is how to create a common set of services that can be used by multiple applications (i.e. security, persistence, reference). I've managed to generalize the services so they can be extended and packaged with different persistence units (2 ears can't have the same persistence unit) and application specific JNDI names for EJB's with remote JNDI names. Local JNDI names should not be an issue as they should be restricted in scope to the ear itself. The applications also share a common set of entities for security, user preferences and a few other things that can be shared among multiple applications within the same organization. Each application works fine on it's own when deployed into a standalone application server but when I deploy more than one application in the same JVM my entity mappings are getting corrupted.

For example, I can login to applicaiton A and get to it's start page. I can also login to application B and get to it's start page. When I return to application A and refresh the page it just presented, I get the following:

        Exception [TOPLINK-6007] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.QueryException

Exception Description: Missing descriptor for [class xxx.xxx.xxx].

The same entity is referenced by two difference persistence units but the net mapping based on the classes annotations is identical. I'm also under the impression that since the same class is packaged into each application separately, the classpath and any byte code modifications from weaving the entities together should also not be a problem. So why is the descriptor for this class getting corrupted? Does Toplink Essentials pool the descriptors and entities across applications instead of maintaining application specific mappings? Can this be configured?

This is not completely critical at the moment because in a production environment, each application should be deployed in a separate JVM. Unfortunately I've also worked in development shops which like to over partition their applications which means this deployment problem is not a development only problem. My primary reason for wanting this to work is during development, these applications work together so it would be nice to have them in the same JVM to save resources on workstations and notebooks with only 2GB of memory. Secondary reason to figure this out is for those shops who can't be convinced they are over partitioning their applications and want exactly this deployment model.

Does anyone know how this can be fixed or is this even possible.

Any advice is welcome.

Thanks

Sean
[Message sent by forum member 'redmondcs' (redmondcs)]

http://forums.java.net/jive/thread.jspa?messageID=284528