Java Code Examples for java.rmi.RemoteException#getMessage()

The following examples show how to use java.rmi.RemoteException#getMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StratosApiV41Utils.java    From attic-stratos with Apache License 2.0 6 votes vote down vote up
/**
 * Remove Kubernetes Cluster
 *
 * @param kubernetesClusterId kubernetesClusterId
 * @return remove status
 * @throws RestAPIException
 */
public static boolean removeKubernetesCluster(String kubernetesClusterId)
        throws RestAPIException, CloudControllerServiceNonExistingKubernetesClusterExceptionException,
               CloudControllerServiceKubernetesClusterAlreadyUsedExceptionException {

    CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
    if (cloudControllerServiceClient != null) {
        try {
            cloudControllerServiceClient.undeployKubernetesCluster(kubernetesClusterId);
            return true;
        } catch (RemoteException e) {
            log.error(e.getMessage(), e);
            throw new RestAPIException(e.getMessage(), e);
        }
    }
    return false;
}
 
Example 2
Source File: RemoteVmManager.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return the current set of monitorable Java Virtual Machines.
 * <p>
 * The set returned by this method depends on the user name passed
 * to the constructor. If no user name was specified, then this
 * method will return all candidate JVMs on the system. Otherwise,
 * only the JVMs for the given user will be returned. This assumes
 * that the RMI server process has the appropriate permissions to
 * access the target set of JVMs.
 *
 * @return Set - the Set of monitorable Java Virtual Machines
 */
public Set<Integer> activeVms() throws MonitorException {
    int[] active = null;

    try {
        active = remoteHost.activeVms();

    } catch (RemoteException e) {
        throw new MonitorException("Error communicating with remote host: "
                                   + e.getMessage(), e);
    }

    Set<Integer> activeSet = new HashSet<Integer>(active.length);

    for (int i = 0; i < active.length; i++) {
        activeSet.add(new Integer(active[i]));
    }

    return activeSet;
}
 
Example 3
Source File: HsqldbTestDatabase.java    From tomee with Apache License 2.0 6 votes vote down vote up
public void createAccountTable() throws java.sql.SQLException {
    try {
        try {
            database.execute(_dropAccount);
        } catch (final Exception e) {
            // not concerned
        }
        database.execute(_createAccount);
    } catch (final RemoteException re) {
        if (re.detail != null && re.detail instanceof java.sql.SQLException) {
            throw (java.sql.SQLException) re.detail;
        } else {
            throw new java.sql.SQLException("Cannot create account table: " + re.getMessage(), _createAccount);
        }
    }
}
 
Example 4
Source File: F5BigIpResource.java    From cloudstack with Apache License 2.0 6 votes vote down vote up
private void deleteVirtualServerAndDefaultPool(String virtualServerName) throws ExecutionException {
    try {
        if (virtualServerExists(virtualServerName)) {
            // Delete the default pool's members
            List<String> poolMembers = getMembers(virtualServerName);
            for (String poolMember : poolMembers) {
                String[] destIpAndPort = getIpAndPort(poolMember);
                deletePoolMember(virtualServerName, destIpAndPort[0], Integer.parseInt(destIpAndPort[1]));
            }

            // Delete the virtual server
            s_logger.debug("Deleting virtual server " + virtualServerName);
            _virtualServerApi.delete_virtual_server(genStringArray(virtualServerName));

            if (getStrippedVirtualServers().contains(virtualServerName)) {
                throw new ExecutionException("Failed to delete virtual server " + virtualServerName);
            }

            // Delete the default pool
            deletePool(virtualServerName);
        }
    } catch (RemoteException e) {
        throw new ExecutionException(e.getMessage());
    }
}
 
Example 5
Source File: RemoteCacheListener.java    From commons-jcs with Apache License 2.0 6 votes vote down vote up
/**
 * Deregister itself.
 * <p>
 * @throws IOException
 */
@Override
public synchronized void dispose()
    throws IOException
{
    if ( !disposed )
    {
        log.info( "Unexporting listener." );
        try
        {
            UnicastRemoteObject.unexportObject( this, true );
        }
        catch ( RemoteException ex )
        {
            log.error( "Problem unexporting the listener.", ex );
            throw new IllegalStateException( ex.getMessage() );
        }
        disposed = true;
    }
}
 
Example 6
Source File: DerbyTestDatabase.java    From tomee with Apache License 2.0 6 votes vote down vote up
public void createEntityTable() throws java.sql.SQLException {
    try {
        try {
            database.execute(DerbyTestDatabase._dropEntity);
        } catch (final Exception e) {
            // not concerned
        }
        database.execute(DerbyTestDatabase._createEntity);
    } catch (final RemoteException re) {
        if (re.detail != null && re.detail instanceof java.sql.SQLException) {
            throw (java.sql.SQLException) re.detail;
        } else {
            throw new java.sql.SQLException("Cannot create entity table: " + re.getMessage(), DerbyTestDatabase._createEntity);
        }
    }
}
 
Example 7
Source File: RMIContext.java    From oodt with Apache License 2.0 6 votes vote down vote up
/**
 * Get the RMI registry.
 *
 * @return a <code>Registry</code> value.
 * @throws NamingException if an error occurs.
 */
private Registry getRegistry() throws NamingException {
	if (registry != null) {
	  return registry;
	}
	try {
		String host = environment.containsKey("host")? (String) environment.get("host") : "localhost";
		int port = environment.containsKey("port")? (Integer) environment.get("port")
			: Registry.REGISTRY_PORT;

		
		registry = LocateRegistry.getRegistry(host, port);
	} catch (RemoteException ex) {
		throw new NamingException("Remote exception locating registry: " + ex.getMessage());
	}
	return registry;
}
 
Example 8
Source File: StratosApiV40Utils.java    From attic-stratos with Apache License 2.0 6 votes vote down vote up
public static AutoscalePolicyBean[] getAutoScalePolicies() throws RestAPIException {

        org.apache.stratos.autoscaler.stub.autoscale.policy.AutoscalePolicy[] autoscalePolicies = null;
        AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
        if (autoscalerServiceClient != null) {
            try {
                autoscalePolicies = autoscalerServiceClient.getAutoScalePolicies();

            } catch (RemoteException e) {
                String errorMsg = "Error while getting available autoscaling policies. Cause : " + e.getMessage();
                log.error(errorMsg, e);
                throw new RestAPIException(errorMsg, e);
            }
        }
        return ObjectConverter.convertStubAutoscalePoliciesToAutoscalePolicies(autoscalePolicies);
    }
 
Example 9
Source File: SAMLSSOValidatorServiceClient.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Validate SAML request
 *
 * @param samlRequest
 * @param isPost
 * @return ValidatedItemDTO array
 * @throws AxisFault
 */
public ValidatedItemDTO[] validate(String samlRequest, boolean isPost) throws AxisFault {
    try {
        return stub.validateAuthnRequest(samlRequest, isPost);
    } catch (RemoteException e) {
        log.error("Error validating SAML request", e);
        throw new AxisFault(e.getMessage(), e);
    }
}
 
Example 10
Source File: LocalEntryAdminClient.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
/**
 * This method is used to get the LocalEntry.
 *
 * @param key Local entry key to be retrieved.
 * @return LocalEntry
 * @throws AxisFault If error occurs when retrieving Local Entry.
 */
public Boolean localEntryExists(String key) throws AxisFault {
    try {
        Object localEntryObject = localEntryAdminServiceStub.getEntry(key, tenantDomain);
        return localEntryObject != null;
    } catch (RemoteException e) {
        throw new AxisFault("Error occurred while getting the Local Entry: ", e.getMessage(), e);
    }
}
 
Example 11
Source File: F5BigIpResource.java    From cloudstack with Apache License 2.0 5 votes vote down vote up
private List<Long> getRouteDomains() throws ExecutionException {
    try {
        List<Long> routeDomains = new ArrayList<Long>();
        long[] routeDomainsArray = _routeDomainApi.get_list();

        for (long routeDomainName : routeDomainsArray) {
            routeDomains.add(routeDomainName);
        }

        return routeDomains;
    } catch (RemoteException e) {
        throw new ExecutionException(e.getMessage());
    }
}
 
Example 12
Source File: DerbyTestDatabase.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void dropEntityTable() throws java.sql.SQLException {
    try {
        database.execute(DerbyTestDatabase._dropEntity);
    } catch (final RemoteException re) {
        if (re.detail != null && re.detail instanceof java.sql.SQLException) {
            throw (java.sql.SQLException) re.detail;
        } else {
            throw new java.sql.SQLException("Unable to drop entity table: " + re.getMessage(), DerbyTestDatabase._dropEntity);
        }
    }
}
 
Example 13
Source File: TemplateManagerAdminServiceClient.java    From product-cep with Apache License 2.0 5 votes vote down vote up
public String[] editConfiguration(ScenarioConfigurationDTO scenarioConfigurationDTO) throws RemoteException {
    try {
        return templateManagerAdminServiceStub.editConfiguration(scenarioConfigurationDTO);
    } catch (RemoteException e) {
        log.error("RemoteException", e);
        throw new RemoteException(e.getMessage(), e);
    }
}
 
Example 14
Source File: TemplateManagerAdminServiceClient.java    From product-cep with Apache License 2.0 5 votes vote down vote up
public int getConfigurationsCount(String domainName) throws RemoteException {
    int count = 0;
    try {
        ScenarioConfigurationInfoDTO[] configs = templateManagerAdminServiceStub.getConfigurationInfos(domainName);
        if (configs != null) {
            count = configs.length;
        }
        return count;
    } catch (RemoteException e) {
        log.error("RemoteException", e);
        throw new RemoteException(e.getMessage(), e);
    }
}
 
Example 15
Source File: NDPIImageNative.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String readInfoString(String filename) throws OrbitImageServletException {
    try {
        logger.debug("file: "+this.filename);
        String info = getServer().getInfo(this.filename, level);
        return info;
    } catch (RemoteException e) {
        throw new OrbitImageServletException(e.getMessage() + "\nCause:" + e.getCause());
    }
}
 
Example 16
Source File: RmiCache.java    From oodt with Apache License 2.0 5 votes vote down vote up
public void sync(List<String> uniqueElementProductTypeNames) throws CacheException {
    try {
        rmiCacheServer.sync(uniqueElementProductTypeNames);
    } catch (RemoteException e) {
        throw new CacheException(e.getMessage(), e);
    }

}
 
Example 17
Source File: HsqldbTestDatabase.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void dropAccountTable() throws java.sql.SQLException {
    try {
        database.execute(_dropAccount);
    } catch (final RemoteException re) {
        if (re.detail != null && re.detail instanceof java.sql.SQLException) {
            throw (java.sql.SQLException) re.detail;
        } else {
            throw new java.sql.SQLException("Cannot drop account table: " + re.getMessage(), _dropAccount);
        }
    }
}
 
Example 18
Source File: InstantDbTestDatabase.java    From tomee with Apache License 2.0 5 votes vote down vote up
private void dropTable(final String drop) throws java.sql.SQLException {
    try {
        database.execute(drop);
    } catch (final RemoteException re) {
        if (re.detail != null && re.detail instanceof java.sql.SQLException) {
            throw (java.sql.SQLException) re.detail;
        } else {
            throw new java.sql.SQLException("Unable to drop table: " + re.getMessage(), drop);
        }
    }
}
 
Example 19
Source File: StratosApiV41Utils.java    From attic-stratos with Apache License 2.0 5 votes vote down vote up
/**
 * Update Network Partition
 *
 * @param networkPartition NetworkPartitionBean
 */
public static void updateNetworkPartition(NetworkPartitionBean networkPartition)
        throws RestAPIException, CloudControllerServiceNetworkPartitionNotExistsExceptionException {
    try {
        CloudControllerServiceClient serviceClient = CloudControllerServiceClient.getInstance();
        serviceClient.updateNetworkPartition(ObjectConverter.
                convertNetworkPartitionToCCStubNetworkPartition(networkPartition));
    } catch (RemoteException e) {
        String message = e.getMessage();
        log.error(message);
        throw new RestAPIException(message, e);
    }
}
 
Example 20
Source File: F5BigIpResource.java    From cloudstack with Apache License 2.0 4 votes vote down vote up
private void addVirtualServer(String virtualServerName, LbProtocol protocol, String srcIp, int srcPort, StickinessPolicyTO[] stickyPolicies)
    throws ExecutionException {
    try {
        if (!virtualServerExists(virtualServerName)) {
            s_logger.debug("Adding virtual server " + virtualServerName);
            _virtualServerApi.create(genVirtualServerDefinition(virtualServerName, protocol, srcIp, srcPort), new String[] {"255.255.255.255"},
                genVirtualServerResource(virtualServerName), genVirtualServerProfile(protocol));
            _virtualServerApi.set_snat_automap(genStringArray(virtualServerName));
            if (!virtualServerExists(virtualServerName)) {
                throw new ExecutionException("Failed to add virtual server " + virtualServerName);
            }
        }

        if ((stickyPolicies != null) && (stickyPolicies.length > 0) && (stickyPolicies[0] != null)) {
            StickinessPolicyTO stickinessPolicy = stickyPolicies[0];
            if (StickinessMethodType.LBCookieBased.getName().equalsIgnoreCase(stickinessPolicy.getMethodName())) {

                String[] profileNames = genStringArray("Cookie-profile-" + virtualServerName);
                if (!persistenceProfileExists(profileNames[0])) {
                    LocalLBPersistenceMode[] lbPersistenceMode = new iControl.LocalLBPersistenceMode[1];
                    lbPersistenceMode[0] = iControl.LocalLBPersistenceMode.PERSISTENCE_MODE_COOKIE;
                    _persistenceProfileApi.create(profileNames, lbPersistenceMode);
                    _virtualServerApi.add_persistence_profile(genStringArray(virtualServerName), genPersistenceProfile(profileNames[0]));
                }

                List<Pair<String, String>> paramsList = stickinessPolicy.getParams();
                for (Pair<String, String> param : paramsList) {
                    if ("holdtime".equalsIgnoreCase(param.first())) {
                        long timeout = 180; //F5 default
                        if (param.second() != null) {
                            timeout = Long.parseLong(param.second());
                        }
                        LocalLBProfileULong[] cookieTimeout = new LocalLBProfileULong[1];
                        cookieTimeout[0] = new LocalLBProfileULong();
                        cookieTimeout[0].setValue(timeout);
                        _persistenceProfileApi.set_cookie_expiration(profileNames, cookieTimeout);
                    }
                }
            }
        } else {
            _virtualServerApi.remove_all_persistence_profiles(genStringArray(virtualServerName));
        }

    } catch (RemoteException e) {
        throw new ExecutionException(e.getMessage());
    }
}