2

I am having an exsiting code where we are using org.springframework.remoting.rmi.RmiRegistryFactoryBean. I am upgrading our Spring version and looks like RmiRegistryFactoryBean is deprecated in latest spring(spring-context.jar) version.

below is the code snippit I am using

<bean id="registry"
    class="org.springframework.remoting.rmi.RmiRegistryFactoryBean">
    <property name="port" value="{jmx.port}" />
    <property name="clientSocketFactory" ref="sslRMIClientSocketFactory" />
    <property name="serverSocketFactory" ref="sslRMIServerSocketFactory" />
</bean>

<bean id="serverConnector"
    class="org.springframework.jmx.support.ConnectorServerFactoryBean"
    depends-on="registry">
    <property name="serviceUrl"
        value="service:jmx:rmi://0.0.0.0:{jmx.port}/jndi/rmi://0.0.0.0:{jmx.port}/drsrmi" />
    <property name="environment">
        <map>
            <entry key="jmx.remote.jndi.rebind" value="true"/>
            <entry key="jmx.remote.tls.need.client.authentication" value="true"/>
            <entry key="jmx.remote.rmi.server.socket.factory" value-ref="sslRMIServerSocketFactory"/>
            <entry key="jmx.remote.rmi.client.socket.factory" value-ref="sslRMIClientSocketFactory"/>
            <entry key="com.sun.jndi.rmi.factory.socket" value-ref="sslRMIClientSocketFactory"/>
        </map>
    </property>
</bean>

Now my ConnectorServerFactoryBean depends on registry. How can i handel this now is there any alternative for RmiRegistryFactoryBean or I can create ConnectorServerFactoryBean without registry?

  • There isn't and this all has to do with the deprecation of RMI in the JRE/JDK itself and the inherent security flaws that java based serialization has. It only depends on the bean it doesn't need it. So remove it and remove the `depends-on`. – M. Deinum Sep 05 '22 at 06:08
  • 1
    What was the final solution to this problem? – Michael Starkie Feb 15 '23 at 17:18

0 Answers0