[jboss-user] [EJB 3.0] - Cannot load @Remote interfaces with remote class loader into

avogt_sundn do-not-reply at jboss.com
Thu Sep 25 18:28:43 EDT 2008


Im looking desperately for a solution to my problem:

I tried to lookup an session bean - named ServiceEjb - from which i only have one @Remote interface in my class loader (ie. in the ear or in the unit test runner) from within another session bean, say the SessionBeanFactory. 

That session bean - named ServiceEjb - implements other @Remote interfaces. But i dont care for them. My code is like the user of the factory pattern: InitialContext().lookup() ist the factory, i get an session bean, i communicate with it across the one @Remote interface known to me.

Reason why the other @Remote interface needs to be loaded is that the deserialized statelessproxystub references it in its internals.

When I activate remote class loading ... i can see that the referenced session bean interfaces get remotely downloaded... but they are not available for the container that hosts the referencing session bean. 

I have a complete example project I can offer to anyone interested (unfortunately one cannot attach files here). So please ask.


java.lang.RuntimeException: javax.naming.NamingException: Could not dereference object [Root exception is java.lang.ClassNotFoundExcep
  | remote.classloading.problem.integration.remote.UnknownRemoteInterface]
  |         at remote.classloading.problem.integration.ear2.SessionBeanFactoryEjb.createBean(SessionBeanFactoryEjb.java:27)
  |         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.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
  |         at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
  |         at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  |         at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
  |         at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
  |         at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
  |         at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
  |         at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:809)
  |         at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:572)
  |         at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
  |         at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
  |         at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
  |         at org.jboss.remoting.Client.invoke(Client.java:1634)
  |         at org.jboss.remoting.Client.invoke(Client.java:548)
  |         at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
  |         at $Proxy6.createBean(Unknown Source)
  |         at remote.classloading.problem.integration.SessionBeanFactoryTest.testLookupWithoutInterface(SessionBeanFactoryTest.java:25)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


Here the server tells us that he is loading class bytecode.

00:16:18,203 DEBUG [MarshallerLoaderHandler] MarshallerLoaderHandler received invocation with param of load_class and data type of
  |  null
  | 00:16:18,203 DEBUG [MarshallerLoaderHandler] MarshallerLoaderHandler: loading class: remote.classloading.problem.integration.remot
  | e.UnknownRemoteInterface
  | 00:16:18,203 DEBUG [MarshallerLoaderHandler] searching repository integration:loader=integration-1.0.EAR
  | 00:16:18,203 DEBUG [MarshallerLoaderHandler] found class in repository integration:loader=integration-1.0.EAR
  | 00:16:18,203 DEBUG [MarshallerLoaderHandler] MarshallerLoaderHandler: returning class: remote.classloading.problem.integration.rem
  | ote.UnknownRemoteInterface: ClassBytes [class=remote.classloading.problem.integration.remote.UnknownRemoteInterface,value=[B at 9f6c2
  | b]
  | 00:16:18,203 DEBUG [ClassByteClassLoader] loaded from network: ClassBytes [class=remote.classloading.problem.integration.remote.Un
  | knownRemoteInterface,value=[B at 18b9d9b]
  | 00:16:18,203 DEBUG [ClassByteClassLoader] attempting to load from network: remote.classloading.problem.integration.remote.KnownRem
  | oteInterface


In the deploy/ejb3.deployer/META-INF/jboss-service.xml I put this configuration:

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

The server jboss starts with 
anonymous wrote : set JAVA_OPTS=-Djava.security.manager=java.rmi.RMISecurityManager -Djava.security.policy=server.policy  %JAVA_OPTS%


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

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



More information about the jboss-user mailing list