Examples of RPCException


Examples of org.ow2.easybeans.rpc.api.RPCException

        this.methodName = methodName;

        try {
            this.byteArgs = storeObject(args);
        } catch (IOException e) {
            throw new RPCException("Cannot serialize the arguments of the request.", e);
        }
        this.args = args;
        this.containerId = containerId;
        this.factoryName = factoryName;
        this.beanId = beanId;
View Full Code Here

Examples of org.ow2.easybeans.rpc.api.RPCException

        EasyBeansSLSB bean = null;
        try {
            bean = getBean(null);
        } catch (IllegalArgumentException e) {
            ejbResponse.setRPCException(new RPCException("Cannot get element in the pool", e));
            return ejbResponse;
        } catch (NoSuchEJBException e) {
            ejbResponse.setRPCException(new RPCException("Bean has been removed", e));
            return ejbResponse;
        }

        Method m = getHashes().get(localCallRequest.getMethodHash());

        if (m == null) {
            ejbResponse.setRPCException(new RPCException("Cannot find method called on the bean '" + getClassName() + "'.",
                    new NoSuchMethodException("The method is not found on the bean")));
            return ejbResponse;
        }

        Object value = null;

        // set ClassLoader
        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getContainer().getClassLoader());

        // Busines interface
        String oldInvokedBusinessInterface = getInvokedBusinessInterfaceNameThreadLocal().get();
        getInvokedBusinessInterfaceNameThreadLocal().set(localCallRequest.getInvokedBusinessInterfaceName());

        // Operation state
        OperationState oldState = getOperationState();
        getOperationStateThreadLocal().set(BUSINESS_METHOD);

        // Dispatch the bean invocation begin event.
        String methodEventProviderId = getJ2EEManagedObjectId() + "/" + J2EEManagedObjectNamingHelper.getMethodSignature(m)
                    + "@Local";
        boolean enabledEvent = !localCallRequest.isCalledFromRemoteRequest();

        EZBEventBeanInvocation event = null;
        long number = 0;

        IAuditID previousID = null;
        // Compute and send begin event only if required
        if (enabledEvent) {
            // Invocation ID
            if (getCurrentInvocationID() != null) {
                previousID = getCurrentInvocationID().newInvocation();
            }

            event = getInvocationEventBegin(methodEventProviderId, localCallRequest.getMethodArgs());
            number = event.getInvocationNumber();
            getEventDispatcher().dispatch(event);
        }

        // Invoke method
        try {
            value = m.invoke(bean, localCallRequest.getMethodArgs());
        } catch (IllegalArgumentException e) {
            ejbResponse.setRPCException(new RPCException(e));
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
            }
        } catch (IllegalAccessException e) {
            ejbResponse.setRPCException(new RPCException(e));
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
            }
        } catch (InvocationTargetException e) {
            Throwable cause = e.getCause();
            RPCException rpcException = new RPCException(cause);
            // ApplicationException ?
            ApplicationException applicationException = getBeanInfo().getApplicationExceptions().get(cause.getClass().getName());
            if (applicationException != null) {
                rpcException.setApplicationException();
            }
            ejbResponse.setRPCException(rpcException);
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
            }
        } finally {
            // send events only if not called remotely
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationEnd(methodEventProviderId, number, value));
                // Restore previous ID
                if (getCurrentInvocationID() != null) {
                    getCurrentInvocationID().setAuditID(previousID);
                }
            }

            Thread.currentThread().setContextClassLoader(oldClassLoader);
            getInvokedBusinessInterfaceNameThreadLocal().set(oldInvokedBusinessInterface);
            getOperationStateThreadLocal().set(oldState);

            // push back into the pool
            try {
                getPool().release(bean);
            } catch (PoolException e) {
                ejbResponse.setRPCException(new RPCException("cannot release bean", e));
            }

        }
        ejbResponse.setValue(value);
        return ejbResponse;
View Full Code Here

Examples of org.ow2.easybeans.rpc.api.RPCException

        // bean removed ?
        setRemoved(response.isRemoved());

        // Handle exception
        RPCException rpcException = response.getRPCException();
        if (rpcException != null) {
            handleThrowable(convertThrowable(rpcException.getCause()), rpcException.isApplicationException(), method,
                    rpcException);
        }

        // Needs to rebuild the proxy as we only have the invocation handler
        if (RECREATE_DYNAMIC_PROXY) {
View Full Code Here

Examples of org.ow2.easybeans.rpc.api.RPCException

        }

        // bean removed ?
        setRemoved(response.isRemoved());

        RPCException rpcException = response.getRPCException();
        if (rpcException != null) {
            handleThrowable(rpcException.getCause(), rpcException.isApplicationException(), method, rpcException);
        }



View Full Code Here

Examples of org.ow2.easybeans.rpc.api.RPCException

        EasyBeansSingletonSB bean = null;
        try {
            bean = getBean(null);
        } catch (IllegalArgumentException e) {
            ejbResponse.setRPCException(new RPCException("Cannot get element in the pool", e));
            return ejbResponse;
        } catch (NoSuchEJBException e) {
            ejbResponse.setRPCException(new RPCException("Bean has been removed", e));
            return ejbResponse;
        }

        Method m = getHashes().get(localCallRequest.getMethodHash());

        if (m == null) {
            ejbResponse.setRPCException(new RPCException("Cannot find method called on the bean '" + getClassName() + "'."));
            return ejbResponse;
        }

        Object value = null;

        // set ClassLoader
        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getContainer().getClassLoader());

        // Busines interface
        String oldInvokedBusinessInterface = getInvokedBusinessInterfaceNameThreadLocal().get();
        getInvokedBusinessInterfaceNameThreadLocal().set(localCallRequest.getInvokedBusinessInterfaceName());

        // Operation state
        OperationState oldState = getOperationState();
        getOperationStateThreadLocal().set(BUSINESS_METHOD);



        // Dispatch the bean invocation begin event.
        String methodEventProviderId = getJ2EEManagedObjectId() + "/" + J2EEManagedObjectNamingHelper.getMethodSignature(m)
                    + "@Local";
        boolean enabledEvent = !localCallRequest.isCalledFromRemoteRequest();

        EZBEventBeanInvocation event = null;
        long number = 0;
        IAuditID previousID = null;

        // Compute and send begin event only if required
        if (enabledEvent) {
            // Invocation ID
            if (getCurrentInvocationID() != null) {
                previousID = getCurrentInvocationID().newInvocation();
            }
            event = getInvocationEventBegin(methodEventProviderId, localCallRequest.getMethodArgs());
            number = event.getInvocationNumber();
            getEventDispatcher().dispatch(event);
        }

        // TODO: manage lock per method and read or write lock !
        // for now, use only write lock

        // acquire lock
        Lock writeLock = this.lock.writeLock();
        writeLock.lock();

        try {
            value = m.invoke(bean, localCallRequest.getMethodArgs());
        } catch (IllegalArgumentException e) {
            ejbResponse.setRPCException(new RPCException(e));
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
            }
        } catch (IllegalAccessException e) {
            ejbResponse.setRPCException(new RPCException(e));
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
            }
        } catch (InvocationTargetException e) {
            Throwable cause = e.getCause();
            RPCException rpcException = new RPCException(cause);
            // ApplicationException ?
            ApplicationException applicationException = getBeanInfo().getApplicationExceptions().get(cause.getClass().getName());
            if (applicationException != null) {
                rpcException.setApplicationException();
            }
            ejbResponse.setRPCException(rpcException);
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
            }
        } finally {
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationEnd(methodEventProviderId, number, value));
                // Restore previous ID
                if (getCurrentInvocationID() != null) {
                    getCurrentInvocationID().setAuditID(previousID);
                }
            }

            Thread.currentThread().setContextClassLoader(oldClassLoader);
            getInvokedBusinessInterfaceNameThreadLocal().set(oldInvokedBusinessInterface);
            getOperationStateThreadLocal().set(oldState);

            // push back into the pool
            try {
                getPool().release(bean);
            } catch (PoolException e) {
                ejbResponse.setRPCException(new RPCException("cannot release bean", e));
            }
            // release lock
            writeLock.unlock();
        }
        ejbResponse.setValue(value);
View Full Code Here

Examples of railo.runtime.net.rpc.RPCException

        parameters = (Parameters)bEntry.getParameters().get(tmpOp);
                break;
      }
    }
    if(operation == null || parameters == null)
      throw new RPCException("Cannot locate method " + methodName + " in webservice " + wsdlUrl);
   
        org.apache.axis.client.Call call = (Call)axisService.createCall(QName.valueOf(port.getName()), QName.valueOf(tmpOp.getName()));
       
        if(!StringUtil.isEmpty(username,true)){
          call.setUsername(username);
          call.setPassword(password);
        }
       
        org.apache.axis.encoding.TypeMapping tm = (org.apache.axis.encoding.TypeMapping)
          axisService.getTypeMappingRegistry().getDefaultTypeMapping();
        //TypeMappingRegistry reg=(TypeMappingRegistry) axisService.getTypeMappingRegistry();
       
        //tm=reg.getOrMakeTypeMapping("http://schemas.xmlsoap.org/soap/encoding/");
        tm=call.getMessageContext().getTypeMapping();
       
        Vector<String> inNames = new Vector<String>();
    Vector<Parameter> inTypes = new Vector<Parameter>();
    Vector<String> outNames = new Vector<String>();
    Vector<Parameter> outTypes = new Vector<Parameter>();
    for(int j = 0; j < parameters.list.size(); j++) {
      p = (Parameter)parameters.list.get(j);
      map(pc,secondChanceConfig,call,tm,p.getType());
      switch(p.getMode()) {
            case Parameter.IN:
                inNames.add(p.getQName().getLocalPart());
                inTypes.add(p);
            break;
            case Parameter.OUT:
                outNames.add(p.getQName().getLocalPart());
                outTypes.add(p);
            break;
            case Parameter.INOUT:
                inNames.add(p.getQName().getLocalPart());
                inTypes.add(p);
                outNames.add(p.getQName().getLocalPart());
                outTypes.add(p);
            break;
            }
    }

    // set output type
    if (parameters.returnParam != null) {
          QName rtnQName = parameters.returnParam.getQName();
          TypeEntry rtnType = parameters.returnParam.getType();
          map(pc,secondChanceConfig,call,tm,rtnType);
            outNames.add(rtnQName.getLocalPart());
            outTypes.add(parameters.returnParam);
           
        }
       
       
       
        //Iterator it = outTypes.iterator();
      
        // check arguments
        Object[] inputs = new Object[inNames.size()];
        TimeZone tz;
    if(pc==null)tz=ThreadLocalPageContext.getTimeZone(secondChanceConfig);
    else tz=ThreadLocalPageContext.getTimeZone(pc);
        if(arguments!=null) {
        if(inNames.size() != arguments.length)
          throw new RPCException("Invalid arguments count for operation " + methodName+" ("+arguments.length+" instead of "+inNames.size()+")");
       
            for(int pos = 0; pos < inNames.size(); pos++) {
          p = inTypes.get(pos);
          inputs[pos]=getArgumentData(tm,tz, p, arguments[pos]);
        }
        }
        else {
          UDFUtil.argumentCollection(namedArguments);
            if(inNames.size() != namedArguments.size())
                throw new RPCException("Invalid arguments count for operation " + methodName+" ("+namedArguments.size()+" instead of "+inNames.size()+")");
           
           
            Object arg;
            for(int pos = 0; pos < inNames.size(); pos++) {
                p = inTypes.get(pos);
                arg=namedArguments.get(KeyImpl.init(p.getName()),null);
               
                if(arg==null) {
                    throw new RPCException("Invalid arguments for operation " + methodName,
                            getErrorDetailForArguments(inNames.toArray(new String[inNames.size()]),CollectionUtil.keysAsString(namedArguments)));
                }
                inputs[pos]=getArgumentData(tm,tz, p, arg);
            }
        }
View Full Code Here

Examples of rocket.remoting.client.RpcException

          break;
        }
      }

      if (false == thrown) {
        result = new RpcException(caught.getMessage());
      }
      exceptionWasThrown = true;

    } catch (final RuntimeException runtimeException) {
      exceptionWasThrown = true;
      result = new RpcException(runtimeException.getMessage());
    } catch (final Throwable throwable) {
      exceptionWasThrown = true;
      result = new RpcException(throwable.getMessage());
    }

    // write the result...
    outputStream.writeBoolean(exceptionWasThrown);
    outputStream.writeObject(result);
View Full Code Here

Examples of rocks.xmpp.extensions.rpc.RpcException

                                        if (parameters.get(0).getAsInteger() == 6) {
                                            return new Value("Colorado");
                                        }
                                    }
                                }
                                throw new RpcException(123, "Invalid method name or parameter.");
                            }
                        });

                        AvatarManager avatarManager = xmppSession.getExtensionManager(AvatarManager.class);
                        avatarManager.addAvatarChangeListener(new AvatarChangeListener() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.