本文整理汇总了Java中org.springframework.remoting.RemoteLookupFailureException类的典型用法代码示例。如果您正苦于以下问题:Java RemoteLookupFailureException类的具体用法?Java RemoteLookupFailureException怎么用?Java RemoteLookupFailureException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RemoteLookupFailureException类属于org.springframework.remoting包,在下文中一共展示了RemoteLookupFailureException类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepare
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
/**
* Fetches RMI stub on startup, if necessary.
* @throws RemoteLookupFailureException if RMI stub creation failed
* @see #setLookupStubOnStartup
* @see #lookupStub
*/
public void prepare() throws RemoteLookupFailureException {
// Cache RMI stub on initialization?
if (this.lookupStubOnStartup) {
Remote remoteObj = lookupStub();
if (logger.isDebugEnabled()) {
if (remoteObj instanceof RmiInvocationHandler) {
logger.debug("RMI stub [" + getServiceUrl() + "] is an RMI invoker");
}
else if (getServiceInterface() != null) {
boolean isImpl = getServiceInterface().isInstance(remoteObj);
logger.debug("Using service interface [" + getServiceInterface().getName() +
"] for RMI stub [" + getServiceUrl() + "] - " +
(!isImpl ? "not " : "") + "directly implemented");
}
}
if (this.cacheStub) {
this.cachedStub = remoteObj;
}
}
}
示例2: prepare
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
/**
* Fetches the RMI stub on startup, if necessary.
* @throws RemoteLookupFailureException if RMI stub creation failed
* @see #setLookupStubOnStartup
* @see #lookupStub
*/
public void prepare() throws RemoteLookupFailureException {
// Cache RMI stub on initialization?
if (this.lookupStubOnStartup) {
Object remoteObj = lookupStub();
if (logger.isDebugEnabled()) {
if (remoteObj instanceof RmiInvocationHandler) {
logger.debug("JNDI RMI object [" + getJndiName() + "] is an RMI invoker");
}
else if (getServiceInterface() != null) {
boolean isImpl = getServiceInterface().isInstance(remoteObj);
logger.debug("Using service interface [" + getServiceInterface().getName() +
"] for JNDI RMI object [" + getJndiName() + "] - " +
(!isImpl ? "not " : "") + "directly implemented");
}
}
if (this.cacheStub) {
this.cachedStub = remoteObj;
}
}
}
示例3: testJaxRpcPortProxyFactoryBeanWithDynamicCallsAndLazyLookupAndServiceException
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
public void testJaxRpcPortProxyFactoryBeanWithDynamicCallsAndLazyLookupAndServiceException() throws Exception {
JaxRpcPortProxyFactoryBean factory = new JaxRpcPortProxyFactoryBean();
factory.setServiceFactoryClass(CallMockServiceFactory.class);
factory.setNamespaceUri("myNamespace");
factory.setServiceName("myServiceX");
factory.setPortName("myPort");
factory.setServiceInterface(IRemoteBean.class);
factory.setLookupServiceOnStartup(false);
factory.afterPropertiesSet();
assertTrue(factory.getObject() instanceof IRemoteBean);
IRemoteBean proxy = (IRemoteBean) factory.getObject();
try {
proxy.setName("exception");
fail("Should have thrown RemoteException");
}
catch (RemoteLookupFailureException ex) {
// expected
assertTrue(ex.getCause() instanceof ServiceException);
}
}
示例4: testJaxRpcPortProxyFactoryBeanWithPortInterfaceAndServiceException
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
public void testJaxRpcPortProxyFactoryBeanWithPortInterfaceAndServiceException() throws Exception {
JaxRpcPortProxyFactoryBean factory = new JaxRpcPortProxyFactoryBean();
factory.setServiceFactoryClass(MockServiceFactory.class);
factory.setNamespaceUri("myNamespace");
factory.setServiceName("myServiceX");
factory.setPortInterface(IRemoteBean.class);
factory.setPortName("myPort");
factory.setServiceInterface(IRemoteBean.class);
try {
factory.afterPropertiesSet();
fail("Should have thrown RemoteLookupFailureException");
}
catch (RemoteLookupFailureException ex) {
// expected
}
}
示例5: testJaxRpcPortProxyFactoryBeanWithPortInterfaceAndLazyLookupAndServiceException
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
public void testJaxRpcPortProxyFactoryBeanWithPortInterfaceAndLazyLookupAndServiceException() throws Exception {
JaxRpcPortProxyFactoryBean factory = new JaxRpcPortProxyFactoryBean();
factory.setServiceFactoryClass(MockServiceFactory.class);
factory.setNamespaceUri("myNamespace");
factory.setServiceName("myServiceX");
factory.setPortName("myPort");
factory.setPortInterface(IRemoteBean.class);
factory.setServiceInterface(IRemoteBean.class);
factory.setLookupServiceOnStartup(false);
factory.afterPropertiesSet();
assertTrue(factory.getObject() instanceof IRemoteBean);
IRemoteBean proxy = (IRemoteBean) factory.getObject();
try {
proxy.setName("exception");
fail("Should have thrown Service");
}
catch (RemoteLookupFailureException ex) {
// expected
assertTrue(ex.getCause() instanceof ServiceException);
}
}
示例6: prepare
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
/**
* Initialize the Hessian proxy for this interceptor.
* @throws RemoteLookupFailureException if the service URL is invalid
*/
public void prepare() throws RemoteLookupFailureException {
try {
this.hessianProxy = createHessianProxy(this.proxyFactory);
}
catch (MalformedURLException ex) {
throw new RemoteLookupFailureException("Service URL [" + getServiceUrl() + "] is invalid", ex);
}
}
示例7: prepare
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
/**
* Initialize the Burlap proxy for this interceptor.
* @throws RemoteLookupFailureException if the service URL is invalid
*/
public void prepare() throws RemoteLookupFailureException {
try {
this.burlapProxy = createBurlapProxy(this.proxyFactory);
}
catch (MalformedURLException ex) {
throw new RemoteLookupFailureException("Service URL [" + getServiceUrl() + "] is invalid", ex);
}
}
示例8: getStub
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
/**
* Return the RMI stub to use. Called for each invocation.
* <p>The default implementation returns the stub created on initialization,
* if any. Else, it invokes {@link #lookupStub} to get a new stub for
* each invocation. This can be overridden in subclasses, for example in
* order to cache a stub for a given amount of time before recreating it,
* or to test the stub whether it is still alive.
* @return the RMI stub to use for an invocation
* @throws RemoteLookupFailureException if RMI stub creation failed
* @see #lookupStub
*/
protected Remote getStub() throws RemoteLookupFailureException {
if (!this.cacheStub || (this.lookupStubOnStartup && !this.refreshStubOnConnectFailure)) {
return (this.cachedStub != null ? this.cachedStub : lookupStub());
}
else {
synchronized (this.stubMonitor) {
if (this.cachedStub == null) {
this.cachedStub = lookupStub();
}
return this.cachedStub;
}
}
}
示例9: getStub
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
/**
* Return the RMI stub to use. Called for each invocation.
* <p>The default implementation returns the stub created on initialization,
* if any. Else, it invokes {@link #lookupStub} to get a new stub for
* each invocation. This can be overridden in subclasses, for example in
* order to cache a stub for a given amount of time before recreating it,
* or to test the stub whether it is still alive.
* @return the RMI stub to use for an invocation
* @throws NamingException if stub creation failed
* @throws RemoteLookupFailureException if RMI stub creation failed
*/
protected Object getStub() throws NamingException, RemoteLookupFailureException {
if (!this.cacheStub || (this.lookupStubOnStartup && !this.refreshStubOnConnectFailure)) {
return (this.cachedStub != null ? this.cachedStub : lookupStub());
}
else {
synchronized (this.stubMonitor) {
if (this.cachedStub == null) {
this.cachedStub = lookupStub();
}
return this.cachedStub;
}
}
}
示例10: preparePortStub
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
/**
* Prepare the given JAX-WS port stub, applying properties to it.
* Called by {@link #prepare}.
* @param stub the current JAX-WS port stub
* @see #setUsername
* @see #setPassword
* @see #setEndpointAddress
* @see #setMaintainSession
* @see #setCustomProperties
*/
protected void preparePortStub(Object stub) {
Map<String, Object> stubProperties = new HashMap<String, Object>();
String username = getUsername();
if (username != null) {
stubProperties.put(BindingProvider.USERNAME_PROPERTY, username);
}
String password = getPassword();
if (password != null) {
stubProperties.put(BindingProvider.PASSWORD_PROPERTY, password);
}
String endpointAddress = getEndpointAddress();
if (endpointAddress != null) {
stubProperties.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);
}
if (isMaintainSession()) {
stubProperties.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
}
if (isUseSoapAction()) {
stubProperties.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
}
String soapActionUri = getSoapActionUri();
if (soapActionUri != null) {
stubProperties.put(BindingProvider.SOAPACTION_URI_PROPERTY, soapActionUri);
}
stubProperties.putAll(getCustomProperties());
if (!stubProperties.isEmpty()) {
if (!(stub instanceof BindingProvider)) {
throw new RemoteLookupFailureException("Port stub of class [" + stub.getClass().getName() +
"] is not a customizable JAX-WS stub: it does not implement interface [javax.xml.ws.BindingProvider]");
}
((BindingProvider) stub).getRequestContext().putAll(stubProperties);
}
}
示例11: lookup
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
/**
* This overridden lookup implementation performs a narrow operation
* after the JNDI lookup, provided that a home interface is specified.
* @see #setHomeInterface
* @see javax.rmi.PortableRemoteObject#narrow
*/
@Override
protected Object lookup() throws NamingException {
Object homeObject = super.lookup();
if (this.homeInterface != null) {
try {
homeObject = PortableRemoteObject.narrow(homeObject, this.homeInterface);
}
catch (ClassCastException ex) {
throw new RemoteLookupFailureException(
"Could not narrow EJB home stub to home interface [" + this.homeInterface.getName() + "]", ex);
}
}
return homeObject;
}
示例12: refreshAndRetry
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
/**
* Refresh the EJB home object and retry the given invocation.
* Called by invoke on connect failure.
* @param invocation the AOP method invocation
* @return the invocation result, if any
* @throws Throwable in case of invocation failure
* @see #invoke
*/
protected Object refreshAndRetry(MethodInvocation invocation) throws Throwable {
try {
refreshHome();
}
catch (NamingException ex) {
throw new RemoteLookupFailureException("Failed to locate remote EJB [" + getJndiName() + "]", ex);
}
return doInvoke(invocation);
}
示例13: waitTillInitialized
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
private void waitTillInitialized() throws RemoteLookupFailureException {
if (initialized) {
return;
}
try {
initializationLatch.await(60, TimeUnit.SECONDS);
} catch (InterruptedException e) {
throw new RemoteLookupFailureException("Space remoting service exporter interrupted while waiting for initialization", e);
}
if (!initialized) {
throw new RemoteLookupFailureException("Space remoting service exporter not initialized yet");
}
}
示例14: prepare
import org.springframework.remoting.RemoteLookupFailureException; //导入依赖的package包/类
/**
* Initialize the Hessian proxy for this interceptor.
*
* @throws org.springframework.remoting.RemoteLookupFailureException if the service URL is invalid
*/
public void prepare() throws RemoteLookupFailureException {
if (httpClientUtil == null) {
this.httpClientUtil = new HttpClientUtil();
}
try {
thriftProxy = ThriftUtil.buildClient(getServiceInterface(), protocolFactory.getProtocol(getTransport()));
} catch (Exception e) {
throw new RuntimeException(e);
}
}