Announcement Announcement Module
Collapse
No announcement yet.
Unable to export two Services through RMI Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to export two Services through RMI

    When i deploy a bundle which exports two services through RMI on bundle activation the following exception is raised:
    Code:
    ...
    Caused by: java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
        java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.springsource.kernel.userregion.internal.equinox.KernelBundleClassLoader
        at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:227)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
        at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
        at org.springframework.remoting.rmi.RmiServiceExporter.prepare(RmiServiceExporter.java:286)
    I simply can't understand why a classloader has to be exported...

    The failure happens while rebinding the second service in the rmi registry:

    Code:
    RmiServiceExporter.prepare() {
    	...
    
    	// Bind RMI object to registry.
    	try {
    		if (this.replaceExistingBinding) {
    			this.registry.rebind(this.serviceName, this.exportedObject);
    		}
    		...
    	}
    	...
    }
    Beside, even why does anything be serialized at that moment?

    When i deploy the bundle exporting one or the other but only one at the same time it does work!

    BTW, the same configuration (with two exported services) worked on dm Server 1.0.2.RELEASE!

    spring-context file:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
    
    	<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
        		<property name="serviceName" value="service1" />
        		<property name="service" ref="service1" />
        		<property name="serviceInterface" value="com.not.exists.service.IService" />
        	</bean>
        
    	<bean id="service1" class="com.not.exists.server.service.ServiceImpl" />
    	
    	<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
        		<property name="serviceName" value="service2" />
        		<property name="service" ref="service2" />
        		<property name="serviceInterface" value="com.not.exists.service.IService" />
        	</bean>
        
    	<bean id="service2" class="com.not.exists.server.service.Service2" />
    </beans>
Working...
X