org.springframework.remoting.rmi.JndiRmiProxyFactoryBean Maven / Gradle / Ivy
Show all versions of spring-context Show documentation
/*
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.remoting.rmi;
import javax.naming.NamingException;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.util.ClassUtils;
/**
* {@link FactoryBean} for RMI proxies from JNDI.
*
* Typically used for RMI-IIOP (CORBA), but can also be used for EJB home objects
* (for example, a Stateful Session Bean home). In contrast to a plain JNDI lookup,
* this accessor also performs narrowing through {@link javax.rmi.PortableRemoteObject}.
*
*
With conventional RMI services, this invoker is typically used with the RMI
* service interface. Alternatively, this invoker can also proxy a remote RMI service
* with a matching non-RMI business interface, i.e. an interface that mirrors the RMI
* service methods but does not declare RemoteExceptions. In the latter case,
* RemoteExceptions thrown by the RMI stub will automatically get converted to
* Spring's unchecked RemoteAccessException.
*
*
The JNDI environment can be specified as "jndiEnvironment" property,
* or be configured in a {@code 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 #setServiceInterface
* @see #setJndiName
* @see #setJndiTemplate
* @see #setJndiEnvironment
* @see #setJndiName
* @see JndiRmiServiceExporter
* @see org.springframework.remoting.RemoteAccessException
* @see java.rmi.RemoteException
* @see java.rmi.Remote
* @see javax.rmi.PortableRemoteObject#narrow
*/
public class JndiRmiProxyFactoryBean extends JndiRmiClientInterceptor
implements FactoryBean