users@glassfish.java.net

Re: Same entity deployed in multiple ears in same jvm

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Mon, 07 Jul 2008 20:58:34 -0700

Looking at Toplink Essentials code, it does not seem that you will run
into any issue if you are packaging your entities within each
application. That is different classloaders are used to load the two set
of (identical) entities, you should be fine. Can you please check that
you do not have a copy of entities somewhere higher up in classloader.
(see https://glassfish.dev.java.net/nonav/javaee5/docs/DG/beade.html for
more info on classloader hierarchy)

Thanks,
Mitesh

glassfish_at_javadesktop.org wrote:
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>