[jboss-user] [Remoting] - ClassNotFoundException while calling remote ejb3 across isol

avogt_sundn do-not-reply at jboss.com
Wed Apr 9 08:25:40 EDT 2008


Using JBoss Portal 2.6.4 with JDK1.5.0

It seems to me that RMI class loading does not work with my configuration
I gave a security policy to the jboss to allow for RMI class loading.
And i gave the loaderport parameter to the DefaultEjb3Connector as described here [URL]http://www.jboss.com/index.html?module=bb&op=viewtopic&t=126930[/URL]


  |    <mbean code="org.jboss.remoting.transport.Connector"
  |           name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
  |       <depends>jboss.aop:service=AspectDeployer</depends>
  |       <!--attribute name="InvokerLocator">socket://${jboss.bind.address}:3873/?loaderport=4873</attribute-->
  | 	 
  |       <attribute name="Configuration">
  | 		  <config>
  | 		   <invoker transport="socket">
  | 			   <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
  | 			   <attribute name="serverBindPort">3873</attribute>              
  | 			   <attribute name="numAcceptThreads">1</attribute>
  | 			   <attribute name="maxPoolSize">300</attribute>
  | 			   <attribute name="clientMaxPoolSize" isParam="true">50</attribute>
  | 			   <attribute name="timeout" isParam="true">60000</attribute>
  | 			   <attribute name="loaderport" isParam="true">4873</attribute>
  | 			   <attribute name="serializationtype" isParam="true">jboss</attribute>   
  | 			   <attribute name="byvalue" isParam="true">true</attribute>  
  | 			   <attribute name="force_remote" isParam="true">true</attribute>  			   
  | 	      </invoker>
  | 		    <handlers>
  |             <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
  |          </handlers>
  | 		  </config>
  |        
  |       </attribute>
  |    </mbean>
  | 

I get a ClassNotFoundException for the implementing ejb class of the method parameter, but I expected the class to be loaded via RMI loader (via WebService on localhost:8083). Is there something else that I need to configure?


  | Caused by: java.lang.ClassNotFoundException: palmyra.baustein.geschaeftsverwaltung.antrag.ProtokollVBeanEjb
  |         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
  |         at java.security.AccessController.doPrivileged(Native Method)
  |         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  |         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
  |         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
  |         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
  |         at java.lang.Class.forName0(Native Method)
  |         at java.lang.Class.forName(Class.java:242)
  |         at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:430)
  |         at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
  |         at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
  |         at org.jboss.system.JBossRMIClassLoader.loadClass(JBossRMIClassLoader.java:91)
  |         at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
  |         at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
  |         at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544)
  |         at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
  |         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
  |         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
  |         at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1634)
  |         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
  |         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
  |         at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
  |         at org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:267)
  | 

Let me explain the overall situation.
Consider this: one ejb A gets another ejb B injected via @EJB annotation.
ejb A is thus owning a proxy to ejb B.
the respective classes are deployed in two ears that are isolated ie. have their own class loader repositories declared in jboss-app.xml
In order to call methods on B, the ear with ejb A contains the ejb interface and parameter classes of ejb B.

Now while there is no problem ejb A calling methods on ejb B, B cannot call on A vice versa, because the ear of ejb B does not contain the classes of ejb A. 
But I want ejb B to be able to callback its owning ejb A. I therefore transmitted the proxy of ejb A to ejb B. 

class EjbB {
  |  public void setOwner(MyCommonInterface bean) { .. }
  | 


  | class MyInterceptor{
  |   @Resource
  | 	SessionContext sessionContext;
  |  void propagateOwner() {
  |       iface = sessionContext.getInvokedBusinessInterface();
  |       MyCommonInterface owner = (MyCommonInterface)     
  |                  sessionContext.getBusinessObject(iface);	
  |       EventListener listener = (EventListener) new InitialContext()						.lookup("my-ear/EventListenerEjb/remote");
  | 	owner.setEventListener(listener);
  |      // the next line throw ClassNotFoundException
  |         listener.setReceiver(vbean);	
  |       
  | 


  | 14:14:39,978 ERROR [VBeanInterceptor] VBean: palmyra.baustein.geschaeftsverwaltung.antrag.ProtokollVBeanEjb at d213c: java.lang.Runti
  | meException: java.lang.ClassNotFoundException: palmyra.baustein.geschaeftsverwaltung.antrag.ProtokollVBeanEjb java.lang.ClassNotFo
  | undException: palmyra.baustein.geschaeftsverwaltung.antrag.ProtokollVBeanEjb
  | java.lang.RuntimeException: java.lang.ClassNotFoundException: palmyra.baustein.geschaeftsverwaltung.antrag.ProtokollVBeanEjb
  |         at org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:276)
  |         at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:328)
  |         at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:81)
  |         at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.stateful.StatefulRemoteProxy.invoke(StatefulRemoteProxy.java:139)
  |         at $Proxy400.setReceiver(Unknown Source)
  |         at palmyra.core.vorgangssteuerung.interceptor.VBeanInterceptor.doEJBAnnotation(VBeanInterceptor.java:125)
  |         at palmyra.core.vorgangssteuerung.interceptor.VBeanInterceptor.postConstruct(VBeanInterceptor.java:97)
  | 


  | Caused by: java.lang.ClassNotFoundException: palmyra.baustein.geschaeftsverwaltung.antrag.ProtokollVBeanEjb
  |         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
  |         at java.security.AccessController.doPrivileged(Native Method)
  |         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  |         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
  |         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
  |         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
  |         at java.lang.Class.forName0(Native Method)
  |         at java.lang.Class.forName(Class.java:242)
  |         at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:430)
  |         at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
  |         at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
  |         at org.jboss.system.JBossRMIClassLoader.loadClass(JBossRMIClassLoader.java:91)
  |         at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
  |         at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
  |         at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544)
  |         at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
  |         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
  |         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
  |         at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1634)
  |         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
  |         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
  |         at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
  |         at org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:267)
  | 



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

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



More information about the jboss-user mailing list