Right now your configuration loads the same jar into each of the web app classloaders, so the classes are different (same bytes, different classloaders). You need to get the common jar into a shared classloader. Some ways to do this are:

1. create a configuration with (only) that common jar as a dependency, and have a dependency on this configuration in both web apps
2. make one web app depend on the other one
3. use the shared-lib feature (I don't recommend this)

thanks
david jencks

On Nov 26, 2007, at 6:33 AM, Jochen Zink wrote:

Hello,

I try to put a Javaobjekt to the global JNDI Context, and access this Objekt from different Applications.

A WebApplication (named webAppA) deployed as standalone WAR File, puts an Object to the global JNDI Context:
InitialContext ic = new InitialContext();
Context namingContext = (Context) ic.lookup("ger:");
RolleDTO objectToBind = new RolleDTO();
namingContext.bind( "myObject" , objectToBind);

Another WebApplication (named webAppB) deployed as WAR File inside an EAR File, trys to access the Object with name myObject:

InitialContext ic = new InitialContext();
Context context = (Context) ic.lookup("ger:");
RolleDTO rolle = (RolleDTO) context.lookup("myObject ");

The Result is the follwoing ClassCastException.

Both Webapplications uses a common lib, which contains the RolleDTO class, and both has a dependency entry in geronimo-web.xml to this Library. This lib only exists as common lib. No local versions are placed inside the war files or inside the ear file.

I’m using Geronimo 2.0.1. Has anyone an idea what is going wrong?

Thanks a lot
Jochen

javax.naming.NameNotFoundException: com.accumio.ae.Test
at org.apache.xbean.naming.context.AbstractContext.lookup (AbstractContext.java:163) at org.apache.xbean.naming.context.AbstractContext.lookup (AbstractContext.java:597) at com.accumio.ae.jobtrigger.TriggerServlet.init (TriggerServlet.java:58) at org.apache.catalina.core.StandardWrapper.loadServlet (StandardWrapper.java:1053) at org.apache.catalina.core.StandardWrapper.load (StandardWrapper.java:955) at org.apache.catalina.core.StandardContext.loadOnStartup (StandardContext.java:4035) at org.apache.catalina.core.StandardContext.start (StandardContext.java:4338) at org.apache.geronimo.tomcat.GeronimoStandardContext.access$201 (GeronimoStandardContext.java:60) at org.apache.geronimo.tomcat.GeronimoStandardContext $SystemMethodValve.invoke(GeronimoStandardContext.java:343) at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke (GeronimoBeforeAfterValve.java:47) at org.apache.geronimo.tomcat.GeronimoStandardContext.start (GeronimoStandardContext.java:196) at org.apache.catalina.core.ContainerBase.addChildInternal (ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild (ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild (StandardHost.java:525) at org.apache.geronimo.tomcat.TomcatContainer.addContext (TomcatContainer.java:355) at org.apache.geronimo.tomcat.TomcatContainer$$FastClassByCGLIB$ $9370b073.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke (FastMethodInvoker.java:38) at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke (GBeanOperation.java:124) at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke (GBeanInstance.java:830) at org.apache.geronimo.gbean.runtime.RawInvoker.invoke (RawInvoker.java:57) at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke (RawOperationInvoker.java:35) at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept (ProxyMethodInterceptor.java:96) at org.apache.geronimo.tomcat.TomcatContainer$$EnhancerByCGLIB$ $34b6a2f8.addContext(<generated>) at org.apache.geronimo.tomcat.TomcatWebAppContext.doStart (TomcatWebAppContext.java:524) at org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance (GBeanInstance.java:996) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart( GBeanInstanceState.java:268) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start (GBeanInstanceState.java:102) at org.apache.geronimo.gbean.runtime.GBeanInstance.start (GBeanInstance.java:539) at org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart (GBeanDependency.java:111) at org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget (GBeanDependency.java:146) at org.apache.geronimo.gbean.runtime.GBeanDependency$1.running (GBeanDependency.java:120) at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEven t(BasicLifecycleMonitor.java:176) at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access $300(BasicLifecycleMonitor.java:44) at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor $RawLifecycleBroadcaster.fireRunningEvent (BasicLifecycleMonitor.java:254) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart( GBeanInstanceState.java:294) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start (GBeanInstanceState.java:102) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive (GBeanInstanceState.java:124) at org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive (GBeanInstance.java:553) at org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean (BasicKernel.java:379) at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfiguration GBeans(ConfigurationUtil.java:448) at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfiguration GBeans(ConfigurationUtil.java:485) at org.apache.geronimo.kernel.config.KernelConfigurationManager.start (KernelConfigurationManager.java:187) at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConf iguration(SimpleConfigurationManager.java:530) at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConf iguration(SimpleConfigurationManager.java:511) at org.apache.geronimo.kernel.config.SimpleConfigurationManager$ $FastClassByCGLIB$$ce77a924.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke (FastMethodInvoker.java:38) at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke (GBeanOperation.java:124) at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke (GBeanInstance.java:830) at org.apache.geronimo.gbean.runtime.RawInvoker.invoke (RawInvoker.java:57) at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke (RawOperationInvoker.java:35) at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept (ProxyMethodInterceptor.java:96) at org.apache.geronimo.gbean.GBeanLifecycle$$EnhancerByCGLIB$ $4c0db839.startConfiguration(<generated>) at org.apache.geronimo.deployment.plugin.local.StartCommand.run (StartCommand.java:67)
        at java.lang.Thread.run(Thread.java:619)


______________________________________________________________________ _
Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 3 Monate
kostenlos testen. http://www.pc-sicherheit.web.de/startseite/? mc=022220


Reply via email to