/** * 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; }
Message message = Message.obtain(null, MyService.ADD_RESPONSE_HANDLER); message.replyTo = messenger; try { myService.send(message); catch (RemoteException e) { e.printStackTrace(); }
/** * 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); }
@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";
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) {
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); }
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); } }
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; }
@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); } } }; }
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(); } }
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()); } }
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) {
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); }
public DomainInfoDTO[] getAllDomainInfos() throws RemoteException { try { return templateManagerAdminServiceStub.getAllDomainInfos(); } catch (RemoteException e) { log.error("RemoteException", e); throw new RemoteException(e.getMessage(), e); } } }
@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); } } }; }
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) {
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); }
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); } }
private void handleError(Exception e) throws RemoteException { LOG.error("Error occured while consuming Crowd REST service", e); throw new RemoteException(e.getMessage()); }
/** * 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()); } }