|
|
|
|
|
|
|
|
Re: Static package registration not populating same registry accessed by EMF deserialization code [message #758147 is a reply to message #758115] |
Tue, 22 November 2011 06:29 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Jon,
Can you reproduce the problem under debug control?
Here's my understanding of how web containers use class loaders. The
container itself has a class loader and it creates one for each thread
or each thing that runs in the container. That one has the container's
class loader as its parent. When the package is initialized,
Thread.getContextClassLoader determines which of a chain of registries
(corresponding to the chain of class loaders) will contain the
registration. When you do a lookup, the same process is used to find
it. So if the package is registered with one context and then lookup
happens with a different context that's not below the registered one
(below as defined by the opposite of ClassLoader.getParent), it won't be
visible. This allows different containers to avoid colliding their
registrations and even to register different versions of the same package.
As another nasty wrinkle, some web containers (e.g., WebSphere) use EMF
themselves and you might end up with their version of EMF, not your
own. You need to set some property for PARENT_LAST or something like
that so that the parent is the last place that's used to resolve classes
you need to load so you can ensure that your version of EMF is used.
As Ed suggested, do a Thread.dumpStack in your package init and see
where it's being registered. Registering early in a know context would
be a better workaround.
On 21/11/2011 11:20 PM, Jon.B wrote:
> What details can I look for or provide to explain the behaviour?
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03802 seconds