Re: Re: Re: Re: Re: Re: Strange ClassCastException when looking up SLSB RemoteHome from "external" .war webapp

"Hans J. Prueller" <[email protected]>
Newsgroups gmane.comp.java.objectweb.jonas
Organization LBS logics GmbH
Message-ID <1295452748.2234.1.camel@kodos>
sorry, see below. btw: now no (remote) ejb home lookup works, also not
the one of the .war-webapps contained within the ear (which worked
previously):

javax.naming.NamingException: Cannot perform lookup [Root exception is
javax.naming.NameNotFoundException: Guardian2Home]
	at
org.ow2.carol.jndi.intercept.spi.InterceptableContext.namingException(InterceptableContext.java:823)
	at
org.ow2.carol.jndi.intercept.spi.InterceptableContext.lookup(InterceptableContext.java:126)
	at
org.ow2.carol.jndi.spi.VirtualJNDILookup.lookup(VirtualJNDILookup.java:109)
	at javax.naming.InitialContext.lookup(InitialContext.java:392)
	at
com.lbslogics.ims.ws.DataExchangeService.lookupGuardian(DataExchangeService.java:252)
	at
com.lbslogics.ims.ws.DataExchangeService.exportData(DataExchangeService.java:309)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194)
	at
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
	at
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
	at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
	at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167)
	at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:142)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.ow2.jonas.web.tomcat6.CheckOpenResourcesValve.invoke(CheckOpenResourcesValve.java:73)
	at
org.ow2.jonas.web.tomcat6.tx.TransactionValve.invoke(TransactionValve.java:90)
	at
org.ow2.jonas.web.tomcat6.ResetAuthenticationValve.invoke(ResetAuthenticationValve.java:95)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
	at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint
$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:662)
Caused by: javax.naming.NameNotFoundException: Guardian2Home
	at
com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:99)
	at javax.naming.InitialContext.lookup(InitialContext.java:396)
	at org.ow2.carol.jndi.spi.AbsContext.lookup(AbsContext.java:142)
	at org.ow2.carol.jndi.spi.AbsContext.lookup(AbsContext.java:152)
	at javax.naming.InitialContext.lookup(InitialContext.java:392)
	at org.ow2.carol.jndi.spi.MultiContext.lookup(MultiContext.java:117)
	at
org.ow2.carol.jndi.intercept.operation.StringLookupInterceptionContext.executeLast(StringLookupInterceptionContext.java:48)
	at
org.ow2.carol.jndi.intercept.operation.AbstractInterceptionContext.proceed(AbstractInterceptionContext.java:57)
	at
org.ow2.jonas.jndi.interceptors.impl.datasource.DataSourceLeakDetectorContextInterceptor.intercept(DataSourceLeakDetectorContextInterceptor.java:63)
	at
org.ow2.carol.jndi.intercept.operation.AbstractInterceptionContext.proceed(AbstractInterceptionContext.java:55)
	at
org.ow2.carol.jndi.intercept.spi.InterceptableContext.lookup(InterceptableContext.java:124)
	... 32 more
2011-01-19 16:57:55,000 : DataExchangeService.lookupGuardian : could not
lookup Guardian2Home: Cannot perform lookup
[ERROR] Exception occurred while trying to invoke service method
exportData


hans


Am Mittwoch, den 19.01.2011, 16:45 +0100 schrieb Guillaume Sauthier:

> Can you give us the full stack trace please ?
> --G
> 
> Le 19/01/2011 16:42, Hans J. Prueller a écrit : 
> 
> > tried it out, classcast problem gone but another error occurs:
> > 
> > javax.naming.NamingException: Cannot perform lookup [Root exception
> > is javax.naming.NameNotFoundException: Guardian2Home]
> > at
> > org.ow2.carol.jndi.intercept.spi.InterceptableContext.namingException(InterceptableContext.java:823)
> > at
> > org.ow2.carol.jndi.intercept.spi.InterceptableContext.lookup(InterceptableContext.java:126)
> > at
> > org.ow2.carol.jndi.spi.VirtualJNDILookup.lookup(VirtualJNDILookup.java:109)
> > at javax.naming.InitialContext.lookup(InitialContext.java:392)
> > 
> > hans
> > 
> > 
> > Am Mittwoch, den 19.01.2011, 10:45 +0100 schrieb Guillaume Sauthier:
> > 
> > > Can you try with local.registry set to false ?
> > > --G
> > > 
> > > Le 19/01/2011 10:32, Hans J. Prueller a écrit : 
> > > 
> > > > Guillaume,
> > > > 
> > > > thank you. I know about the fact you mentioned
> > > > 
> > > > >>That means that you can have the same class (same name, same
> > > > bytecode, same everything), loaded by 2 different classloaders 
> > > > >> but that will be incompatible (you cannot cast one of them
> > > > into the other).
> > > > 
> > > > and I already "suspected" a classloader issue being responsible
> > > > for the classcast problem  ;-)  I already tried to remove the
> > > > EJB API from 
> > > > the WEB-INF/lib of the axis2 webapp, but that didn't solve the
> > > > problem but lead to a classnotfound or noclassdeffound error.
> > > > 
> > > > I did not change carol.properites - I am simply using JOnAS
> > > > 5.1.5 with its default values!
> > > > 
> > > > carol.jvm.rmi.local.call = false
> > > > carol.jvm.rmi.local.registry = true
> > > > 
> > > > regards,
> > > > Hans
> > > > 
> > > > Am Mittwoch, den 19.01.2011, 10:25 +0100 schrieb Guillaume
> > > > Sauthier:
> > > > 
> > > > > Hi Hans
> > > > > 
> > > > > A Class object is defined by its name AND the ClassLoader that
> > > > > loaded it.
> > > > > That means that you can have the same class (same name, same
> > > > > bytecode, same everything), loaded by 2 different classloaders
> > > > > but that will be incompatible (you cannot cast one of them
> > > > > into the other).
> > > > > 
> > > > > So in your case, you have 2 places where your EJB API is
> > > > > available: inside the EAR and inside the WEB-INF/lib of the
> > > > > axis2 webapp. So they are not sharing the same Class
> > > > > definition for your EJB API.
> > > > > What seems to happen is that JNDI returns an instance coming
> > > > > from your EAR.
> > > > > 
> > > > > Did you change your carol.properties ?
> > > > > Can you show me the value of the following properties:
> > > > > * carol.jvm.rmi.local.call
> > > > > * carol.jvm.rmi.local.registry
> > > > > 
> > > > > --G
> > > > > 
> > > > > Le 19/01/2011 08:10, Hans J. Prueller a écrit : 
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > we are still working on migrating our JOnAS 4.10 based Java
> > > > > > EE 1.4 EAR to JOnAS 5.1.5. One (seems really to be the last)
> > > > > > open issue 
> > > > > > we have is the following:
> > > > > > 
> > > > > > Our Java EE 1.4 Application is packaged as EAR, it contains
> > > > > > the EjB-JAR.JAR containing the EJB 2.1 SLSB's. It also
> > > > > > contains 2 or 3
> > > > > > webapps as .WAR file  (war files within the EAR file), which
> > > > > > are looking up the remote homes and remote interfaces of the
> > > > > > SLSB's
> > > > > > which works fine.
> > > > > > 
> > > > > > Then we have another webapp, based on AXIS2 which provides
> > > > > > webservices to external clients. The axis2 war file provies
> > > > > > web-services,
> > > > > > which also lookup the Remote Homes and Remote Interfaces of
> > > > > > some of the SLSB's contained in the ear mentioned above. 
> > > > > > 
> > > > > > Therefore the remote home and remote interface stubs are
> > > > > > packaged as .jar file in web-inf/lib of the axis2.war
> > > > > > webapp. 
> > > > > > 
> > > > > > Basically this is all as it is meant to be by the Java EE
> > > > > > standard, this is what remote home and remote interfaces of
> > > > > > EJB's are for, and it
> > > > > > really works fine and smooth on JOnAS 4.10.X
> > > > > > 
> > > > > > When we now deploy our .EAR file and the axis2.WAR on JOnAS
> > > > > > 5.1.5    and  make a test-invocation of the web-service, we
> > > > > > get a really strange
> > > > > > ClassCastException:
> > > > > > 
> > > > > > Cannot cast
> > > > > > 'org.ow2.jonas_gen.com.lbslogics.ims.guardian.interfaces.JOnASGuardian2Bean1797447629Home' in 'com.lbslogics.ims.guardian.interfaces.Guardian2Home'
> > > > > > 
> > > > > > When I check the source file
> > > > > > (JOnASGuardian2Bean1797447629Home) generated by GenIC, it
> > > > > > explicitly says:
> > > > > > 
> > > > > > public class JOnASGuardian2Bean1797447629Home extends
> > > > > > JSessionHome implements
> > > > > > com.lbslogics.ims.guardian.interfaces.Guardian2Home {
> > > > > > 
> > > > > >     // JOnAS version used to deploy
> > > > > >     public static final String JONAS_VERSION = "5.1.5";
> > > > > > 
> > > > > > [ ..... ]
> > > > > > 
> > > > > > 
> > > > > > ======>  so, the cast has to be possible.  (and btw this
> > > > > > works fine with all other .WAR's contained in the EAR itself
> > > > > > doing the same).  So why or what
> > > > > > is the problem here ??? 
> > > > > > 
> > > > > > Any ideas are appreciated because we cannot migrate our
> > > > > > production servers unless also the webservices are working!
> > > > > > 
> > > > > > regards,
> > > > > > Hans
> > > > > > 
> > > > 
> > > >
(unnamed) (image/png, 1 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.