Search in sources :

Example 1 with RemoteInvocationFailureException

use of org.springframework.remoting.RemoteInvocationFailureException in project spring-framework by spring-projects.

the class JmsInvokerClientInterceptor method invoke.

@Override
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
    if (AopUtils.isToStringMethod(methodInvocation.getMethod())) {
        return "JMS invoker proxy for queue [" + this.queue + "]";
    }
    RemoteInvocation invocation = createRemoteInvocation(methodInvocation);
    RemoteInvocationResult result;
    try {
        result = executeRequest(invocation);
    } catch (JMSException ex) {
        throw convertJmsInvokerAccessException(ex);
    }
    try {
        return recreateRemoteInvocationResult(result);
    } catch (Throwable ex) {
        if (result.hasInvocationTargetException()) {
            throw ex;
        } else {
            throw new RemoteInvocationFailureException("Invocation of method [" + methodInvocation.getMethod() + "] failed in JMS invoker remote service at queue [" + this.queue + "]", ex);
        }
    }
}
Also used : RemoteInvocation(org.springframework.remoting.support.RemoteInvocation) RemoteInvocationResult(org.springframework.remoting.support.RemoteInvocationResult) JMSException(javax.jms.JMSException) RemoteInvocationFailureException(org.springframework.remoting.RemoteInvocationFailureException)

Example 2 with RemoteInvocationFailureException

use of org.springframework.remoting.RemoteInvocationFailureException in project spring-framework by spring-projects.

the class HttpInvokerClientInterceptor method invoke.

@Override
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
    if (AopUtils.isToStringMethod(methodInvocation.getMethod())) {
        return "HTTP invoker proxy for service URL [" + getServiceUrl() + "]";
    }
    RemoteInvocation invocation = createRemoteInvocation(methodInvocation);
    RemoteInvocationResult result;
    try {
        result = executeRequest(invocation, methodInvocation);
    } catch (Throwable ex) {
        RemoteAccessException rae = convertHttpInvokerAccessException(ex);
        throw (rae != null ? rae : ex);
    }
    try {
        return recreateRemoteInvocationResult(result);
    } catch (Throwable ex) {
        if (result.hasInvocationTargetException()) {
            throw ex;
        } else {
            throw new RemoteInvocationFailureException("Invocation of method [" + methodInvocation.getMethod() + "] failed in HTTP invoker remote service at [" + getServiceUrl() + "]", ex);
        }
    }
}
Also used : RemoteInvocation(org.springframework.remoting.support.RemoteInvocation) RemoteInvocationResult(org.springframework.remoting.support.RemoteInvocationResult) RemoteAccessException(org.springframework.remoting.RemoteAccessException) RemoteInvocationFailureException(org.springframework.remoting.RemoteInvocationFailureException)

Aggregations

RemoteInvocationFailureException (org.springframework.remoting.RemoteInvocationFailureException)2 RemoteInvocation (org.springframework.remoting.support.RemoteInvocation)2 RemoteInvocationResult (org.springframework.remoting.support.RemoteInvocationResult)2 JMSException (javax.jms.JMSException)1 RemoteAccessException (org.springframework.remoting.RemoteAccessException)1