I wanted to add a comment to my previous posting: if it's true that 
deployment-based scoping will cause a ClassCastException in case a component in 
App2 tries to get through JNDI a component in App1, it is true that in the 
following scenario, only through deployment-based scoping it will be possible 
to run the application with success:

App1: contains a reference to ExternalApp (declared as module in the EAR)
App2: contains a reference to ExternalApp (declared as module in the EAR)

However, we added an additional method to ExternalApp and deployed the version 
with the extra method only with App2. 

If we deploy *without* jboss-app.xml, App1 will load ExternalApp before App2, 
and since the unified class-loading mechanism follows a 
first-loaded-first-served strategy, when invoking the additional method on 
App2, we'll get the following exception:


  | 2006-02-12 18:55:09,140 ERROR [org.jboss.ejb.plugins.LogInterceptor] 
Unexpected Error in method: public abstract void uk.co.jemos.uclte
  | st2.intf.Session2Session.executeUcl1HelloWorld() throws 
java.rmi.RemoteException
  | java.lang.NoSuchMethodError: uk.co.jemos.ucltestcommon.App.helloWorld2()V
  |         at 
uk.co.jemos.ucltest2.ejbs.sessions.Session2Bean.executeUcl1HelloWorld(Session2Bean.java:75)
  |         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:585)
  |         at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
  |         at 
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
  |         at 
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
  |         at 
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
  |         at 
org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)
  |         at 
org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
  |         at 
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
  |         at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
  |         at 
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
  |         at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
  |         at 
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
  |         at 
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
  |         at 
org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
  |         at org.jboss.ejb.Container.invoke(Container.java:873)
  |         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:585)
  |         at 
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
  |         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
  |         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
  |         at 
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
  |         at 
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
  |         at 
org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
  |         at 
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
  |         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:585)
  |         at 
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
  |         at sun.rmi.transport.Transport$1.run(Transport.java:153)
  |         at java.security.AccessController.doPrivileged(Native Method)
  |         at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
  |         at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
  |         at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
  |         at java.lang.Thread.run(Thread.java:595)
  | 
  | 
  | while if the deploy with deployment-based scoping (i.e. by putting 
jboss-app.xml in the META-INF folder) the invocation of the new method by App2 
will work fine (tested).
  | 
  | Therefore deployement-based scoping solves the problem of deploying with 
different version of the same *plain* class, but if our EAR has to use a JNDI 
component deployed in another EAR, we'll get a ClassCastException, unless there 
is another way of bypassing the problem. 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3923158#3923158

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3923158


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to