本文整理了Java中java.rmi.RemoteException
类的一些代码示例,展示了RemoteException
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RemoteException
类的具体详情如下:
包路径:java.rmi.RemoteException
类名称:RemoteException
[英]A RemoteException
is the common superclass for a number of communication-related exceptions that may occur during the execution of a remote method call. Each method of a remote interface, an interface that extends java.rmi.Remote
, must list RemoteException
in its throws clause.
As of release 1.4, this exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The "wrapped remote exception" that may be provided at construction time and accessed via the public #detail field is now known as the cause, and may be accessed via the Throwable#getCause() method, as well as the aforementioned "legacy field."
[中]RemoteException
是在执行远程方法调用期间可能发生的许多与通信相关的异常的常见超类。远程接口(扩展java.rmi.Remote
的接口)的每个方法都必须在其throws子句中列出RemoteException
。
从1.4版开始,此异常已进行了改装,以符合通用异常链接机制。可以在构建时提供并通过public#detail字段访问的“wrapped remote exception”现在被称为原因,可以通过Throwable#getCause()方法以及前面提到的“遗留字段”访问
代码示例来源:origin: spring-projects/spring-framework
/**
* Perform the actual reading of an invocation result object from the
* given ObjectInputStream.
* <p>The default implementation simply calls
* {@link java.io.ObjectInputStream#readObject()}.
* Can be overridden for deserialization of a custom wrapper object rather
* than the plain invocation, for example an encryption-aware holder.
* @param ois the ObjectInputStream to read from
* @return the RemoteInvocationResult object
* @throws java.io.IOException in case of I/O failure
* @throws ClassNotFoundException if case of a transferred class not
* being found in the local ClassLoader
*/
protected RemoteInvocation doReadRemoteInvocation(ObjectInputStream ois)
throws IOException, ClassNotFoundException {
Object obj = ois.readObject();
if (!(obj instanceof RemoteInvocation)) {
throw new RemoteException("Deserialized object needs to be assignable to type [" +
RemoteInvocation.class.getName() + "]: " + ClassUtils.getDescriptiveType(obj));
}
return (RemoteInvocation) obj;
}
代码示例来源:origin: stackoverflow.com
Message message = Message.obtain(null, MyService.ADD_RESPONSE_HANDLER);
message.replyTo = messenger;
try {
myService.send(message);
catch (RemoteException e) {
e.printStackTrace();
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Determine whether the given RMI exception indicates a connect failure.
* <p>Treats RMI's ConnectException, ConnectIOException, UnknownHostException,
* NoSuchObjectException and StubNotFoundException as connect failure.
* @param ex the RMI exception to check
* @return whether the exception should be treated as connect failure
* @see java.rmi.ConnectException
* @see java.rmi.ConnectIOException
* @see java.rmi.UnknownHostException
* @see java.rmi.NoSuchObjectException
* @see java.rmi.StubNotFoundException
*/
public static boolean isConnectFailure(RemoteException ex) {
return (ex instanceof ConnectException || ex instanceof ConnectIOException ||
ex instanceof UnknownHostException || ex instanceof NoSuchObjectException ||
ex instanceof StubNotFoundException || ex.getCause() instanceof SocketException);
}
代码示例来源:origin: wildfly/wildfly
@Override
public final RemoteException transactionPropagationNotSupported() {
final RemoteException result = new RemoteException(String.format(getLoggingLocale(), transactionPropagationNotSupported$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String cannotCallMethodInAfterCompletion = "WFLYEJB0388: Cannot call method %s in afterCompletion callback";
代码示例来源:origin: wmixvideo/nfe
public NFeDistDFeInteresseResponse nfeDistDFeInteresse(final NFeDistDFeInteresse nfeDistDFeInteresse) throws java.rmi.RemoteException {
org.apache.axis2.context.MessageContext _messageContext = null;
try {
final org.apache.axis2.client.OperationClient _operationClient = this._serviceClient.createClient(this._operations[0].getName());
_operationClient.getOptions().setAction("http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe/nfeDistDFeInteresse");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
this.addPropertyToOperationClient(_operationClient, org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&");
_messageContext = new org.apache.axis2.context.MessageContext();
env = this.toEnvelope(Stub.getFactory(_operationClient.getOptions().getSoapVersionURI()), nfeDistDFeInteresse, this.optimizeContent(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe", "nfeDistDFeInteresse")));
_messageContext.setEnvelope(env);
final java.lang.String exceptionClassName = (java.lang.String) this.faultExceptionClassNameMap.get(faultElt.getQName());
final java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
final java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance();
final java.lang.String messageClassName = (java.lang.String) this.faultMessageMap.get(faultElt.getQName());
final java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
final java.lang.Object messageObject = this.fromOM(faultElt, messageClass, null);
final java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", messageClass);
m.invoke(ex, messageObject);
throw new java.rmi.RemoteException(ex.getMessage(), ex);
} catch (final ClassCastException | InstantiationException | IllegalAccessException | java.lang.reflect.InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) {
代码示例来源:origin: org.wso2.esb/admin-clients
public ProfilesAdminServiceClient(String backEndUrl, String userName, String password)
throws RemoteException {
this.endPoint = backEndUrl + serviceName;
try {
profilesAdminServiceStub = new ProfilesAdminServiceStub(endPoint);
} catch (AxisFault axisFault) {
log.error("Error on initializing listMetadataServiceStub : " + axisFault.getMessage());
throw new RemoteException("Error on initializing listMetadataServiceStub : ", axisFault);
}
AuthenticateStub.authenticateStub(userName, password, profilesAdminServiceStub);
}
代码示例来源:origin: org.wso2.cep/org.wso2.cep.integration.common.clients
public boolean saveStreamMapping(StreamMappingDTO[]
streamMappingDTOs, String configName, String domainName) throws RemoteException {
try {
return templateManagerAdminServiceStub.saveStreamMapping(streamMappingDTOs, configName, domainName);
} catch (RemoteException e) {
log.error("RemoteException", e);
throw new RemoteException(e.getMessage(), e);
}
}
代码示例来源:origin: org.wso2.es/org.wso2.es.integration.common.clients
public SubscriptionBean subscribe(String path, String endpoint, String eventName,
String sessionId) throws RemoteException {
SubscriptionBean bean = null;
try {
bean = infoAdminServiceStub.subscribe(path, endpoint, eventName, sessionId);
} catch (RemoteException remoteException) {
log.error("infoAdminServiceStub subscription fail " + remoteException.getMessage());
throw new RemoteException("infoAdminServiceStub subscription fail " + remoteException.getMessage());
} catch (RegistryExceptionException registryException) {
log.error("infoAdminServiceStub subscription fail " + registryException.getMessage());
throw new AxisFault("infoAdminServiceStub subscription fail " + registryException.getMessage());
}
return bean;
}
代码示例来源:origin: apache/incubator-dubbo
@Override
protected <T> Runnable doExport(final T impl, Class<T> type, URL url) throws RpcException {
final RmiServiceExporter rmiServiceExporter = new RmiServiceExporter();
rmiServiceExporter.setRegistryPort(url.getPort());
rmiServiceExporter.setServiceName(url.getPath());
rmiServiceExporter.setServiceInterface(type);
rmiServiceExporter.setService(impl);
try {
rmiServiceExporter.afterPropertiesSet();
} catch (RemoteException e) {
throw new RpcException(e.getMessage(), e);
}
return new Runnable() {
@Override
public void run() {
try {
rmiServiceExporter.destroy();
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}
}
};
}
代码示例来源:origin: org.apache.airavata/airavata-client-api
private void launchWorkflow(String experimentId, String workflowGraph, NameValue[] inputs,
WorkflowContextHeaderBuilder builder) throws AiravataAPIInvocationException {
try {
builder.getWorkflowMonitoringContext().setExperimentId(experimentId);
WorkflowInterpretorStub stub = new WorkflowInterpretorStub(getClient().getAiravataManager().getWorkflowInterpreterServiceURL().toString());
OMElement wchOMElement = AXIOMUtil.stringToOM(XMLUtil.xmlElementToString(builder
.getXml()));
wchOMElement.addAttribute("submissionUser", builder.getSubmissionUser(), wchOMElement.getNamespace());
stub._getServiceClient().addHeader(
wchOMElement);
stub.launchWorkflow(workflowGraph, experimentId, inputs);
} catch (AxisFault e) {
e.printStackTrace();
} catch (XMLStreamException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
}
代码示例来源:origin: org.apache.oodt/oodt-commons
public void rebind(String name, Object obj) throws NamingException {
checkName(name);
try {
Registry registry = getRegistry();
registry.rebind(toRMIName(name), (Remote) obj);
} catch (RemoteException ex) {
ex.printStackTrace();
throw new NamingException("Remote exception: " + ex.getMessage());
}
}
代码示例来源:origin: wmixvideo/nfe
org.apache.axis2.context.MessageContext _messageContext = null;
try {
final org.apache.axis2.client.OperationClient _operationClient = this._serviceClient.createClient(this._operations[0].getName());
_operationClient.getOptions().setAction("http://www.portalfiscal.inf.br/nfe/wsdl/NFeRetAutorizacao4/nfeRetAutorizacaoLote");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
this.addPropertyToOperationClient(_operationClient, org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&");
_messageContext = new org.apache.axis2.context.MessageContext();
env = this.toEnvelope(Stub.getFactory(_operationClient.getOptions().getSoapVersionURI()), nfeDadosMsg0, this.optimizeContent(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/nfe/wsdl/NFeRetAutorizacao4", "nfeRetAutorizacaoLote")), new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/nfe/wsdl/NFeRetAutorizacao4", "nfeDadosMsg"));
_messageContext.setEnvelope(env);
final java.lang.String exceptionClassName = (java.lang.String) this.faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "nfeRetAutorizacaoLote"));
final java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
final java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class);
final java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());
final java.lang.String messageClassName = (java.lang.String) this.faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "nfeRetAutorizacaoLote"));
final java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
final java.lang.Object messageObject = this.fromOM(faultElt, messageClass);
final java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", messageClass);
m.invoke(ex, messageObject);
throw new java.rmi.RemoteException(ex.getMessage(), ex);
} catch (final ClassCastException | InstantiationException | IllegalAccessException | java.lang.reflect.InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) {
代码示例来源:origin: org.wso2.es/org.wso2.es.integration.common.clients
public UserProfileMgtServiceClient (String backEndUrl, String userName, String password)
throws RemoteException {
this.endPoint = backEndUrl + serviceName;
try {
userProfileMgtServiceStub = new UserProfileMgtServiceStub(endPoint);
} catch (AxisFault axisFault) {
log.error("Error on initializing userProfileMgtServiceStub : " + axisFault.getMessage());
throw new RemoteException("Error on initializing userProfileMgtServiceStub : ", axisFault);
}
AuthenticateStub.authenticateStub(userName, password, userProfileMgtServiceStub);
}
代码示例来源:origin: org.wso2.cep/org.wso2.cep.integration.common.clients
public DomainInfoDTO[] getAllDomainInfos()
throws RemoteException {
try {
return templateManagerAdminServiceStub.getAllDomainInfos();
} catch (RemoteException e) {
log.error("RemoteException", e);
throw new RemoteException(e.getMessage(), e);
}
}
}
代码示例来源:origin: apache/incubator-dubbo
@Override
protected <T> Runnable doExport(final T impl, Class<T> type, URL url) throws RpcException {
final RmiServiceExporter rmiServiceExporter = new RmiServiceExporter();
rmiServiceExporter.setRegistryPort(url.getPort());
rmiServiceExporter.setServiceName(url.getPath());
rmiServiceExporter.setServiceInterface(type);
rmiServiceExporter.setService(impl);
try {
rmiServiceExporter.afterPropertiesSet();
} catch (RemoteException e) {
throw new RpcException(e.getMessage(), e);
}
return new Runnable() {
@Override
public void run() {
try {
rmiServiceExporter.destroy();
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}
}
};
}
代码示例来源:origin: wmixvideo/nfe
org.apache.axis2.context.MessageContext _messageContext = null;
try {
final org.apache.axis2.client.OperationClient _operationClient = this._serviceClient.createClient(this._operations[0].getName());
_operationClient.getOptions().setAction("http://www.portalfiscal.inf.br/nfe/wsdl/NFeStatusServico4/nfeStatusServicoNF");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
this.addPropertyToOperationClient(_operationClient, org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&");
_messageContext = new org.apache.axis2.context.MessageContext();
env = this.toEnvelope(Stub.getFactory(_operationClient.getOptions().getSoapVersionURI()), nfeDadosMsg0, this.optimizeContent(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/nfe/wsdl/NFeStatusServico4", "nfeStatusServicoNF")), new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/nfe/wsdl/NFeStatusServico4", "nfeDadosMsg"));
_messageContext.setEnvelope(env);
final java.lang.String exceptionClassName = (java.lang.String) this.faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "nfeStatusServicoNF"));
final java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
final java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class);
final java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());
final java.lang.String messageClassName = (java.lang.String) this.faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "nfeStatusServicoNF"));
final java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
final java.lang.Object messageObject = this.fromOM(faultElt, messageClass);
final java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", messageClass);
m.invoke(ex, messageObject);
throw new java.rmi.RemoteException(ex.getMessage(), ex);
} catch (final ClassCastException | InstantiationException | IllegalAccessException | java.lang.reflect.InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) {
代码示例来源:origin: org.wso2.es/org.wso2.es.integration.common.clients
public ReportResourceSupplierClient(String backEndUrl, String userName, String password)
throws RemoteException {
this.endPoint = backEndUrl + serviceName;
try {
reportingResourcesSupplierStub = new ReportingResourcesSupplierStub(endPoint);
} catch (AxisFault axisFault) {
log.error("Error on initializing reportingResourcesSupplierStub : " + axisFault.getMessage());
throw new RemoteException("Error on initializing reportingResourcesSupplierStub : ", axisFault);
}
AuthenticateStub.authenticateStub(userName, password, reportingResourcesSupplierStub);
}
代码示例来源:origin: org.wso2.das/org.wso2.das.integration.common.clients
public String[] saveConfiguration(ScenarioConfigurationDTO scenarioConfigurationDTO) throws RemoteException {
try {
return templateManagerAdminServiceStub.saveConfiguration(scenarioConfigurationDTO);
} catch (RemoteException e) {
log.error("RemoteException", e);
throw new RemoteException(e.getMessage(), e);
}
}
代码示例来源:origin: igniterealtime/Openfire
private void handleError(Exception e) throws RemoteException {
LOG.error("Error occured while consuming Crowd REST service", e);
throw new RemoteException(e.getMessage());
}
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* Returns a list of bound objects.
* <p>
* This should match the list of cachePeers i.e. they should always be bound
*
* @return a list of String representations of <code>RMICachePeer</code> objects
*/
protected String[] listBoundRMICachePeers() throws CacheException {
try {
return registry.list();
} catch (RemoteException e) {
throw new CacheException("Unable to list cache peers " + e.getMessage());
}
}
内容来源于网络,如有侵权,请联系作者删除!