Example usage for org.springframework.remoting RemoteLookupFailureException RemoteLookupFailureException

List of usage examples for org.springframework.remoting RemoteLookupFailureException RemoteLookupFailureException

Introduction

In this page you can find the example usage for org.springframework.remoting RemoteLookupFailureException RemoteLookupFailureException.

Prototype

public RemoteLookupFailureException(String msg, Throwable cause) 

Source Link

Document

Constructor for RemoteLookupFailureException.

Usage

From source file:org.xins.common.spring.XinsClientInterceptor.java

public void prepare() {
    try {// ww w .  j av a2 s . c o m
        capi = createCapi();
    } catch (MalformedURLException murlex) {
        throw new RemoteLookupFailureException("Service URL [" + getServiceUrl() + "] is invalid", murlex);
    } catch (Exception ex) {
        throw new BeanCreationException(ex.getMessage(), ex);
    }
}

From source file:com.zz.cluster4spring.support.invocation.DefaultEndpointSelectionPolicy.java

/**
 * Selects endpoint for invocation from the given list of endpoints. Simply
 * selects the first element from the list.
 *
 * @param aEndpoints/*  w w  w  . j a  v  a 2 s  . c  o  m*/
 *            list of endpoints available for invocation of remote service
 * @return selected endpoints
 * @throws org.springframework.remoting.RemoteAccessException
 *             throw if some error occured during seleting endpoint for
 *             invocation
 */
public E selectServiceEndpoint(List<E> aEndpoints) throws RemoteAccessException {
    if (aEndpoints == null) {
        String message = "Unable to obtain service endpoint - list of endpoints is null";
        if (fLog.isErrorEnabled()) {
            fLog.error(message);
        }
        throw new RemoteAccessException(message);
    }
    E result = null;
    try {
        // we simply always return first item from the list
        result = aEndpoints.iterator().next();
        if (fLog.isTraceEnabled()) {
            SI serviceInfo = result.getServiceInfo();
            String message = format("EndPoint selected. Service URL: [{0}]", serviceInfo);
            fLog.trace(message);
        }
    } catch (Exception e) {
        throw new RemoteLookupFailureException("Unable to obtain service endpoint", e);
    }
    return result;
}

From source file:org.apache.mina.springrpc.MinaClientInterceptor.java

@Override
public String getHostName() {
    try {// w  w  w  .java 2 s  . com
        return getURL().getHost();
    } catch (MalformedURLException e) {
        throw new RemoteLookupFailureException("Service URL [" + getServiceUrl() + "] is invalid", e);
    }
}

From source file:org.apache.mina.springrpc.MinaClientInterceptor.java

@Override
public int getPort() {
    try {//from   www .  j  a  v  a2  s. c o m
        return getURL().getPort();
    } catch (MalformedURLException e) {
        throw new RemoteLookupFailureException("Service URL [" + getServiceUrl() + "] is invalid", e);
    }
}

From source file:org.openspaces.remoting.SpaceRemotingServiceExporter.java

public Object invokeExecutor(ExecutorRemotingTask task) throws Throwable {
    waitTillInitialized();/* w w w  .  j  a v  a2 s .  c o m*/
    String lookupName = task.getLookupName();
    if (lookupName.endsWith(asyncInterfaceSuffix)) {
        lookupName = lookupName.substring(0, lookupName.length() - asyncInterfaceSuffix.length());
    }

    Object service = interfaceToService.get(lookupName);
    if (service == null) {
        // we did not get an interface, maybe it is a bean name?
        try {
            service = applicationContext.getBean(lookupName);
        } catch (NoSuchBeanDefinitionException e) {
            // do nothing, write back a proper exception
            throw new RemoteLookupFailureException("Failed to find service for lookup [" + lookupName + "]", e);
        }
        if (service == null) {
            throw new RemoteLookupFailureException("Failed to find service for lookup [" + lookupName + "]");
        }
    }

    autowireArguments(service, task.getArguments());

    IMethod method = null;
    try {
        if (task.getMethodHash() != null) {
            method = methodInvocationLookup.get(lookupName).get(task.getMethodHash());
        }
        if (method == null) {
            method = methodInvocationCache.findMethod(lookupName, service, task.getMethodName(),
                    task.getArguments());
        }
    } catch (Exception e) {
        failedExecution(service);
        throw new RemoteLookupFailureException("Failed to find method [" + task.getMethodName()
                + "] for lookup [" + task.getLookupName() + "]", e);
    }
    try {
        Object retVal;
        if (serviceExecutionAspect != null) {
            retVal = serviceExecutionAspect.invoke(task, new InternalMethodInvocation(method), service);
        } else {
            retVal = method.invoke(service, task.getArguments());
        }
        processedExecution(service);
        return retVal;
    } catch (InvocationTargetException e) {
        failedExecution(service);
        throw e.getTargetException();
    } catch (IllegalAccessException e) {
        failedExecution(service);
        throw new RemoteLookupFailureException("Failed to access method [" + task.getMethodName()
                + "] for lookup [" + task.getLookupName() + "]");
    }
}

From source file:org.openspaces.remoting.SpaceRemotingServiceExporter.java

private void waitTillInitialized() throws RemoteLookupFailureException {
    if (initialized) {
        return;/*  w w w  .j ava 2  s.c  om*/
    }
    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");
    }
}