In my project we pack our application using EAR file. We read BEA's article, which
discussed the class loaders hierarchy and it looks like this problem should not occur:
When the garbage collection is being invoked - it somehow fails to resolve the class
weblogic.jndi.WLInitialContextFactory.
We have encountered the following error (stack trace):
Message: severity="ERROR" sessionId="9IUUN4xoQf1wOkfEN8m62SFjEpNC1e4lLHSzyc2s01GPk5Up25cJ!-1680906364!182460375!7559!7002!1728341859!182464192!7559!7002!1023972500766"
date="Jun 13, 2002" time="3:49:05 PM" threadId="Finalizer"
Description:
Throw: amdocs.jspInfra.exceptions.FailedToRemoveEjbException: [an error occurred
while trying to remove an ejb.]
null- caused by: amdocs.jspInfra.exceptions.InitialContextCreationFailureException:
[an error occurred while trying to create a new initial context.]
null- caused by: javax.naming.NoInitialContextException: Cannot instantiate class:
weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException:
weblogic/jndi/WLInitialContextFactory]
amdocs.jspInfra.exceptions.InitialContextCreationFailureException: [an error occurred
while trying to create a new initial context.]
null- caused by: javax.naming.NoInitialContextException: Cannot instantiate class:
weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException:
weblogic/jndi/WLInitialContextFactory]
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory.
Root exception is java.lang.ClassNotFoundException: weblogic/jndi/WLInitialContextFactory
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:195)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:45)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
at javax.naming.InitialContext.init(InitialContext.java:222)
at javax.naming.InitialContext.<init>(InitialContext.java:198)
at amdocs.jspInfra.userManagement.RequestContext._createContext(RequestContext.java:550)
at amdocs.jspInfra.userManagement.RequestContext.createContext(RequestContext.java:391)
at amdocs.jspInfra.userManagement.RequestContext.createContext(RequestContext.java:415)
at amdocs.jspInfra.beans.GenericJspBean._removeConversation(GenericJspBean.java:466)
at amdocs.jspInfra.beans.GenericJspBean._cleanUp_(GenericJspBean.java:413)
at amdocs.jspInfra.beans.GenericJspBean.cleanUp_(GenericJspBean.java:117)
at amdocs.jspInfra.beans.GenericJspBean.finalize(GenericJspBean.java:593)
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:86)
at java.lang.ref.Finalizer.access$100(Finalizer.java:17)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:163)
Does any one have any idea what could be the problem ?
Thanks,
Yossi.
Anyway, if you really need to do this you can try :
public void finalize() {
ClassLoader saved = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
try {
...
} finally {
Thread.currentThread().setContextClassLoader(saved);
}
}
Yossi Cohen <yos...@amdocs.com> wrote:
> Hi,
> Thanks,
> Yossi.
--
Dimitri