spring-framework / org.springframework.remoting.rmi / JndiRmiServiceExporter

JndiRmiServiceExporter

open class JndiRmiServiceExporter : RmiBasedExporter, InitializingBean, DisposableBean

Service exporter which binds RMI services to JNDI. Typically used for RMI-IIOP (CORBA).

Exports services via the javax.rmi.PortableRemoteObject class. You need to run "rmic" with the "-iiop" option to generate corresponding stubs and skeletons for each exported service.

Also supports exposing any non-RMI service via RMI invokers, to be accessed via JndiRmiClientInterceptor / JndiRmiProxyFactoryBean's automatic detection of such invokers.

With an RMI invoker, RMI communication works on the RmiInvocationHandler level, needing only one stub for any service. Service interfaces do not have to extend java.rmi.Remote or throw java.rmi.RemoteException on all methods, but in and out parameters have to be serializable.

The JNDI environment can be specified as "jndiEnvironment" bean property, or be configured in a jndi.properties file or as system properties. For example:

<property name="jndiEnvironment"> <props> <prop key="java.naming.factory.initial">com.sun.jndi.cosnaming.CNCtxFactory</prop> <prop key="java.naming.provider.url">iiop://localhost:1050</prop> </props> </property>

Author
Juergen Hoeller

Since
1.1

See Also
#setService#setJndiTemplate#setJndiEnvironment#setJndiNameJndiRmiClientInterceptorJndiRmiProxyFactoryBeanjavax.rmi.PortableRemoteObject#exportObject

Constructors

<init>

JndiRmiServiceExporter()

Service exporter which binds RMI services to JNDI. Typically used for RMI-IIOP (CORBA).

Exports services via the javax.rmi.PortableRemoteObject class. You need to run "rmic" with the "-iiop" option to generate corresponding stubs and skeletons for each exported service.

Also supports exposing any non-RMI service via RMI invokers, to be accessed via JndiRmiClientInterceptor / JndiRmiProxyFactoryBean's automatic detection of such invokers.

With an RMI invoker, RMI communication works on the RmiInvocationHandler level, needing only one stub for any service. Service interfaces do not have to extend java.rmi.Remote or throw java.rmi.RemoteException on all methods, but in and out parameters have to be serializable.

The JNDI environment can be specified as "jndiEnvironment" bean property, or be configured in a jndi.properties file or as system properties. For example:

<property name="jndiEnvironment"> <props> <prop key="java.naming.factory.initial">com.sun.jndi.cosnaming.CNCtxFactory</prop> <prop key="java.naming.provider.url">iiop://localhost:1050</prop> </props> </property>

Functions

afterPropertiesSet

open fun afterPropertiesSet(): Unit

destroy

open fun destroy(): Unit

Unbind the RMI service from JNDI on bean factory shutdown.

prepare

open fun prepare(): Unit

Initialize this service exporter, binding the specified service to JNDI.

rebind

open fun rebind(): Unit

Rebind the specified service to JNDI, for recovering in case of the target registry having been restarted.

setJndiEnvironment

open fun setJndiEnvironment(jndiEnvironment: Properties): Unit

Set the JNDI environment to use for JNDI lookups. Creates a JndiTemplate with the given environment settings.

setJndiName

open fun setJndiName(jndiName: String): Unit

Set the JNDI name of the exported RMI service.

setJndiTemplate

open fun setJndiTemplate(jndiTemplate: JndiTemplate): Unit

Set the JNDI template to use for JNDI lookups. You can also specify JNDI environment settings via "jndiEnvironment".