Search in sources :

Example 21 with ServerException

use of java.rmi.ServerException in project cloudstack by apache.

the class DestroyLunCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        netappMgr.destroyLunOnFiler(path);
        DeleteLUNCmdResponse response = new DeleteLUNCmdResponse();
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } catch (InvalidParameterValueException e) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
    } catch (ServerException e) {
        throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString());
    }
}
Also used : ServerException(java.rmi.ServerException) DeleteLUNCmdResponse(com.cloud.server.api.response.netapp.DeleteLUNCmdResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException)

Example 22 with ServerException

use of java.rmi.ServerException in project geode by apache.

the class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest method executeFunction.

public static void executeFunction() throws ServerException, InterruptedException {
    Region region = cache.getRegion(PartitionedRegionName);
    assertNotNull(region);
    final HashSet testKeysSet = new HashSet();
    for (int i = (totalNumBuckets.intValue() * 10); i > 0; i--) {
        testKeysSet.add("execKey-" + i);
    }
    DistributedSystem.setThreadsSocketPolicy(false);
    Function function = new TestFunction(true, TEST_FUNCTION2);
    FunctionService.registerFunction(function);
    Execution dataSet = FunctionService.onRegion(region);
    try {
        ResultCollector rc1 = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
        HashMap resultMap = ((HashMap) rc1.getResult());
        assertEquals(3, resultMap.size());
        Iterator mapIterator = resultMap.entrySet().iterator();
        Map.Entry entry = null;
        DistributedMember key = null;
        ArrayList resultListForMember = null;
        while (mapIterator.hasNext()) {
            entry = (Map.Entry) mapIterator.next();
            key = (DistributedMember) entry.getKey();
            resultListForMember = (ArrayList) entry.getValue();
            for (Object result : resultListForMember) {
                assertEquals(Boolean.TRUE, result);
            }
        }
    } catch (Exception e) {
        LogWriterUtils.getLogWriter().info("Got an exception : " + e.getMessage());
        assertTrue(e instanceof EOFException || e instanceof SocketException || e instanceof SocketTimeoutException || e instanceof ServerException || e instanceof IOException || e instanceof CacheClosedException);
    }
}
Also used : SocketException(java.net.SocketException) ServerException(java.rmi.ServerException) TestFunction(org.apache.geode.internal.cache.functions.TestFunction) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) IOException(java.io.IOException) CacheClosedException(org.apache.geode.cache.CacheClosedException) FunctionInvocationTargetException(org.apache.geode.cache.execute.FunctionInvocationTargetException) ServerException(java.rmi.ServerException) FunctionException(org.apache.geode.cache.execute.FunctionException) SocketException(java.net.SocketException) CacheClosedException(org.apache.geode.cache.CacheClosedException) SocketTimeoutException(java.net.SocketTimeoutException) IOException(java.io.IOException) EOFException(java.io.EOFException) IgnoredException(org.apache.geode.test.dunit.IgnoredException) Function(org.apache.geode.cache.execute.Function) TestFunction(org.apache.geode.internal.cache.functions.TestFunction) Execution(org.apache.geode.cache.execute.Execution) SocketTimeoutException(java.net.SocketTimeoutException) Iterator(java.util.Iterator) DistributedMember(org.apache.geode.distributed.DistributedMember) EOFException(java.io.EOFException) Region(org.apache.geode.cache.Region) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) ResultCollector(org.apache.geode.cache.execute.ResultCollector) HashMap(java.util.HashMap) Map(java.util.Map) HashSet(java.util.HashSet)

Example 23 with ServerException

use of java.rmi.ServerException in project adempiere by adempiere.

the class CLogFormatter method fillExceptionTrace.

//	getException
/**
     * 	Fill Exception Trace
     *	@param sb string buffer
     *	@param hdr header
     *	@param thrown thrown
     */
private static void fillExceptionTrace(StringBuffer sb, String hdr, Throwable thrown) {
    boolean firstError = hdr.length() == 0;
    sb.append(hdr).append(thrown.toString());
    if (thrown instanceof SQLException) {
        SQLException ex = (SQLException) thrown;
        sb.append("; State=").append(ex.getSQLState()).append("; ErrorCode=").append(ex.getErrorCode());
    }
    sb.append(NL);
    //
    StackTraceElement[] trace = thrown.getStackTrace();
    boolean adempiereTrace = false;
    int adempiereTraceNo = 0;
    for (int i = 0; i < trace.length; i++) {
        adempiereTrace = trace[i].getClassName().startsWith("org.compiere.");
        if (//	RMI
        thrown instanceof ServerException || adempiereTrace) {
            if (adempiereTrace)
                sb.append("\tat ").append(trace[i]).append(NL);
        } else if (i > 20 || (i > 10 && adempiereTraceNo > 8))
            break;
        else
            sb.append("\tat ").append(trace[i]).append(NL);
        if (adempiereTrace)
            adempiereTraceNo++;
    }
    //
    Throwable cause = thrown.getCause();
    if (cause != null)
        fillExceptionTrace(sb, "caused by: ", cause);
}
Also used : ServerException(java.rmi.ServerException) SQLException(java.sql.SQLException)

Aggregations

ServerException (java.rmi.ServerException)23 IOException (java.io.IOException)14 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)12 NaElement (netapp.manage.NaElement)8 NaException (netapp.manage.NaException)8 NaServer (netapp.manage.NaServer)8 ServerApiException (org.apache.cloudstack.api.ServerApiException)6 UnknownHostException (java.net.UnknownHostException)5 DB (com.cloud.utils.db.DB)4 TransactionLegacy (com.cloud.utils.db.TransactionLegacy)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 Iterator (java.util.Iterator)4 Map (java.util.Map)4 NaAPIFailedException (netapp.manage.NaAPIFailedException)4 EOFException (java.io.EOFException)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 SocketException (java.net.SocketException)3 SocketTimeoutException (java.net.SocketTimeoutException)3 HashSet (java.util.HashSet)3