Example usage for java.rmi RemoteException getMessage

List of usage examples for java.rmi RemoteException getMessage

Introduction

In this page you can find the example usage for java.rmi RemoteException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message, including the message from the cause, if any, of this exception.

Usage

From source file:gridool.tools.GridTaskMover.java

public boolean moveTask(@Nonnull List<GridTask> tasks, @Nonnull List<GridNode> destNodes, boolean async) {
    if (tasks.isEmpty()) {
        return true;
    }/* ww w .  ja  v a2s .  c  o  m*/
    if (destNodes.isEmpty()) {
        return false;
    }
    final TaskMoveOperation ops = new TaskMoveOperation(tasks, destNodes, async);
    try {
        return grid.execute(GridLocalTaskMoveJob.class, ops);
    } catch (RemoteException e) {
        LOG.error("failed to move tasks: " + e.getMessage(), e);
        return false;
    }
}

From source file:gridool.tools.GridTaskMover.java

/**
 * Attempt work stealing.//  www.j  a va  2s. c o  m
 */
public boolean moveTask(@Nonnegative int tasks, @Nonnull GridNode fromNode, @Nonnull List<GridNode> destNodes,
        boolean async) {
    assert (tasks >= 0);
    if (tasks == 0) {
        return true;
    }
    if (destNodes.isEmpty()) {
        return false;
    }
    final TaskMoveOperation ops = new TaskMoveOperation(tasks, fromNode, destNodes, async);
    try {
        return grid.execute(GridTaskStealJob.class, ops);
    } catch (RemoteException e) {
        LOG.error("failed to move tasks: " + e.getMessage(), e);
        return false;
    }
}

From source file:net.sf.farrago.namespace.sfdc.SfdcNameDirectory.java

private boolean queryTables(FarragoMedMetadataQuery query, FarragoMedMetadataSink sink) throws SQLException {
    try {//w  ww . j a va  2 s.c om
        DescribeGlobalResult describeGlobalResult = server.getEntityTypes();
        if (!(describeGlobalResult == null)) {
            DescribeGlobalSObjectResult[] types = describeGlobalResult.getSobjects();
            if (!(types == null)) {
                for (int i = 0; i < types.length; i++) {
                    String tableName = types[i].getName();
                    if (isIncluded(tableName, query)) {
                        sink.writeObjectDescriptor(tableName, FarragoMedMetadataQuery.OTN_TABLE, null,
                                EMPTY_PROPERTIES);
                    }
                    if (isLovIncluded(tableName, query)) {
                        sink.writeObjectDescriptor(tableName + "_LOV", FarragoMedMetadataQuery.OTN_TABLE, null,
                                EMPTY_PROPERTIES);
                    }
                }
            }
        }
    } catch (RemoteException re) {
        throw SfdcResource.instance().BindingCallException.ex(re.getMessage());
    }
    return true;
}

From source file:net.sf.taverna.t2.activities.soaplab.SoaplabActivityFactory.java

@Override
public Set<ActivityInputPort> getInputPorts(JsonNode json) throws ActivityConfigurationException {
    Set<ActivityInputPort> inputPorts = new HashSet<>();
    try {//from   www.  j ava 2  s .c o m
        // Do web service type stuff[tm]
        Map<String, String>[] inputs = (Map<String, String>[]) Soap
                .callWebService(json.get("endpoint").textValue(), "getInputSpec");
        // Iterate over the inputs
        for (int i = 0; i < inputs.length; i++) {
            Map<String, String> input_spec = inputs[i];
            String input_name = input_spec.get("name");
            String input_type = input_spec.get("type").toLowerCase();
            // Could get other properties such as defaults here
            // but at the moment we've got nowhere to put them
            // so we don't bother.
            if (input_type.equals("string")) {
                inputPorts.add(edits.createActivityInputPort(input_name, 0, true, null, String.class));
            } else if (input_type.equals("string[]")) {
                inputPorts.add(edits.createActivityInputPort(input_name, 1, true, null, String.class));
            } else if (input_type.equals("byte[]")) {
                inputPorts.add(edits.createActivityInputPort(input_name, 0, true, null, byte[].class));
            } else if (input_type.equals("byte[][]")) {
                inputPorts.add(edits.createActivityInputPort(input_name, 1, true, null, byte[].class));
            } else {
                // Count number of [] to get the arrays right
                int depth = (input_type.split("\\[\\]", -1).length) - 1;
                logger.info("Soaplab input type '" + input_type + "' unknown for input '" + input_name + "' in "
                        + json.get("endpoint").textValue() + ", will attempt to add as String depth " + depth);
                inputPorts.add(edits.createActivityInputPort(input_name, depth, true, null, String.class));
            }
        }
    } catch (ServiceException se) {
        throw new ActivityConfigurationException(json.get("endpoint").textValue()
                + ": Unable to create a new call to connect\n   to soaplab, error was : " + se.getMessage());
    } catch (RemoteException re) {
        throw new ActivityConfigurationException(": Unable to call the get spec method for\n   endpoint : "
                + json.get("endpoint").textValue() + "\n   Remote exception message " + re.getMessage());
    } catch (NullPointerException npe) {
        // If we had a null pointer exception, go around again - this is a
        // bug somewhere between axis and soaplab
        // that occasionally causes NPEs to happen in the first call or two
        // to a given soaplab installation. It also
        // manifests in the Talisman soaplab clients.
        return getInputPorts(json);
    }
    return inputPorts;
}

From source file:net.sf.taverna.t2.activities.soaplab.SoaplabActivityFactory.java

@Override
public Set<ActivityOutputPort> getOutputPorts(JsonNode json) throws ActivityConfigurationException {
    Set<ActivityOutputPort> outputPorts = new HashSet<>();
    try {//from  ww  w . j av  a 2s  .co m
        // Get outputs
        Map<String, String>[] results = (Map<String, String>[]) Soap
                .callWebService(json.get("endpoint").textValue(), "getResultSpec");
        // Iterate over the outputs
        for (int i = 0; i < results.length; i++) {
            Map<String, String> output_spec = results[i];
            String output_name = output_spec.get("name");
            String output_type = output_spec.get("type").toLowerCase();
            // Check to see whether the output is either report or
            // detailed_status, in
            // which cases we ignore it, this is soaplab metadata rather
            // than application data.
            if ((!output_name.equalsIgnoreCase("detailed_status"))) {

                // && (!output_name.equalsIgnoreCase("report"))) {
                if (output_type.equals("string")) {
                    outputPorts.add(createOutput(output_name, 0, "text/plain"));
                } else if (output_type.equals("string[]")) {
                    outputPorts.add(createOutput(output_name, 1, "text/plain"));
                } else if (output_type.equals("byte[]")) {
                    outputPorts.add(createOutput(output_name, 0, "application/octet-stream"));
                } else if (output_type.equals("byte[][]")) {
                    outputPorts.add(createOutput(output_name, 1, "application/octet-stream"));
                } else {
                    // Count number of [] to get the arrays right
                    int depth = (output_type.split("\\[\\]", -1).length) - 1;
                    logger.info("Soaplab output type '" + output_type + "' unknown for output '" + output_name
                            + "' in " + json.get("endpoint").textValue() + ", will add as depth " + depth);
                    outputPorts.add(createOutput(output_name, depth, null));
                }
            }
        }

    } catch (ServiceException se) {
        throw new ActivityConfigurationException(json.get("endpoint").textValue()
                + ": Unable to create a new call to connect\n   to soaplab, error was : " + se.getMessage());
    } catch (RemoteException re) {
        throw new ActivityConfigurationException(": Unable to call the get spec method for\n   endpoint : "
                + json.get("endpoint").textValue() + "\n   Remote exception message " + re.getMessage());
    } catch (NullPointerException npe) {
        // If we had a null pointer exception, go around again - this is a
        // bug somewhere between axis and soaplab
        // that occasionally causes NPEs to happen in the first call or two
        // to a given soaplab installation. It also
        // manifests in the Talisman soaplab clients.
        return getOutputPorts(json);
    }
    return outputPorts;
}

From source file:net.sf.farrago.namespace.sfdc.SfdcNameDirectory.java

private boolean queryColumns(FarragoMedMetadataQuery query, FarragoMedMetadataSink sink) throws SQLException {
    try {/*from w w w . j  av  a  2  s .  co  m*/
        DescribeGlobalResult describeGlobalResult = server.getEntityTypes();
        if (!(describeGlobalResult == null)) {
            // Get the array of object names
            DescribeGlobalSObjectResult[] types = describeGlobalResult.getSobjects();
            for (int i = 0; i < types.length; i++) {
                if (!isIncluded(types[i].getName(), query) && !isLovIncluded(types[i].getName(), query)) {
                    continue;
                }

                // verify can access objects
                DescribeSObjectResult describeSObjectResult = (DescribeSObjectResult) server
                        .getEntityDescribe(types[i].getName());

                // check the name
                if ((describeSObjectResult != null)
                        && describeSObjectResult.getName().equals(types[i].getName())) {
                    if (isIncluded(types[i].getName(), query)) {
                        com.sforce.soap.partner.Field[] fields = describeSObjectResult.getFields();
                        int ordinal = 0;
                        for (int j = 0; j < fields.length; j++) {
                            RelDataType reltype = toRelType(fields[j], sink.getTypeFactory());
                            sink.writeColumnDescriptor(types[i].getName(), fields[j].getName(), ordinal,
                                    reltype, null, null, EMPTY_PROPERTIES);
                            ordinal++;
                        }
                    }
                    if (isLovIncluded(types[i].getName(), query)) {
                        // import picklist LOV as well
                        RelDataType reltype = sink.getTypeFactory()
                                .createTypeWithNullability(sink.getTypeFactory()
                                        .createSqlType(SqlTypeName.VARCHAR, 25 + this.varcharPrecision), true);
                        sink.writeColumnDescriptor(types[i].getName() + "_LOV", "Field", 0, reltype, null, null,
                                EMPTY_PROPERTIES);
                        reltype = sink.getTypeFactory().createTypeWithNullability(sink.getTypeFactory()
                                .createSqlType(SqlTypeName.VARCHAR, MAX_PRECISION + this.varcharPrecision),
                                true);
                        sink.writeColumnDescriptor(types[i].getName() + "_LOV", "Value", 1, reltype, null, null,
                                EMPTY_PROPERTIES);
                    }
                } else {
                    if (types[i].getName().endsWith("__c")) {
                        log.info(SfdcResource.instance().ObjectExtractErrorMsg.str(types[i].getName()));
                    } else {
                        throw SfdcResource.instance().InvalidObjectException.ex(types[i].getName());
                    }
                }
            }
        }
    } catch (RemoteException re) {
        throw SfdcResource.instance().BindingCallException.ex(re.getMessage());
    }
    return true;
}

From source file:de.tudarmstadt.lt.lm.web.servlet.LanguageModelProviderServlet.java

private boolean connectToLanguageModel(String key) throws Exception {
    try {/*from   w  w  w  . jav a 2 s . c  o m*/
        int index = _lm_keys.get(key);
        Registry registry = LocateRegistry.getRegistry(_host, _port);
        StringProviderMXBean lmprvdr = (StringProviderMXBean) registry.lookup(key);
        if (lmprvdr.getModelReady()) {
            _lm_provider.set(index, lmprvdr);
            return true;
        }

    } catch (RemoteException e) {
        LOG.error("Unable to connect to rmi registry on {}:{}. {}: {}.", _host, _port,
                e.getClass().getSimpleName(), e.getMessage());
    } catch (NotBoundException e) {
        LOG.error("Unable to connect to service {}. {}: {}.", key, e.getClass().getSimpleName(),
                e.getMessage());
    }
    return false;
}

From source file:net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProvider.java

/**
 * @return a list of {@link CachePeer} peers, excluding the local peer.
 *//*from   w w  w  .  j  a v a  2s .c  o m*/
public List listRemoteCachePeers(Ehcache cache) throws CacheException {
    List remoteCachePeers = new ArrayList();
    List staleCachePeers = new ArrayList();
    String jndiProviderUrl = null;
    synchronized (lock) {
        for (Iterator iterator = peerUrls.keySet().iterator(); iterator.hasNext();) {
            jndiProviderUrl = (String) iterator.next();
            String providerUrlCacheName = extractCacheName(jndiProviderUrl);
            try {
                if (!providerUrlCacheName.equals(cache.getName())) {
                    continue;
                }
                CachePeer cachePeer = lookupCachePeer(jndiProviderUrl);
                remoteCachePeers.add(cachePeer);
            } catch (NamingException ne) {
                LOG.debug(jndiProviderUrl + " " + ne.getMessage());
                staleCachePeers.add(jndiProviderUrl);
            } catch (Exception ex) {
                LOG.error(ex.getMessage(), ex);
                throw new CacheException(
                        jndiProviderUrl + " Unable to list remote cache peers. Error was " + ex.getMessage(),
                        ex);
            }
        }
    }
    if (!staleCachePeers.isEmpty()) {

        // Do this after loop so don't modify peerUrls in it.
        unregisterStalePeers(staleCachePeers);
    }
    if (LOG.isDebugEnabled()) {
        try {
            LOG.debug("listRemoteCachePeers " + cache.getName() + " returning " + remoteCachePeers.size() + " "
                    + printCachePeers(remoteCachePeers));
        } catch (RemoteException e) {
            LOG.warn(e.getMessage(), e);
            LOG.debug("listRemoteCachePeers " + cache.getName() + " returning " + remoteCachePeers.size());
        }
    }
    return remoteCachePeers;
}

From source file:net.i2cat.csade.life2.backoffice.servlet.UserManagementService.java

/**
 * Funcin que se ejecuta cuando el servlet recibe los datos
 *//*from  www .  ja  v a2s  . c om*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    ChangablePropertiesManager cpm = new ChangablePropertiesManager(this.getServletContext());
    String operation = request.getParameter("operation");
    PlatformUserManager pum = new PlatformUserManager();
    String data = "";
    if (operation != null && !"".equals(operation)) {
        if (operation.equals("savePicturePreference")) {
            String photo_hor = request.getParameter("photo_hor");
            cpm.saveProperty("photo_hor", photo_hor);

            data = "{ \"message\": \"preferences saved.\" }";
        }
        if (operation.equals("getPicturePreference")) {
            String photo_hor = cpm.getProperty("photo_hor");

            data = "{ \"photo_hor\": \"" + photo_hor + "\"}";
        }

        if (operation.equals("getPlatformUser")) {
            String login = request.getParameter("login");
            try {
                data = pum.getUser(login).toJSON().toString();
            } catch (RemoteException re) {
                data = "{ \"message\": \"Could not not retrieve user with login=" + login + " Reason:"
                        + re.getMessage() + ".\" }";
            } catch (ServiceException se) {
                data = "{ \"message\": \"Could not not retrieve user with login=" + login + " Reason:"
                        + se.getMessage() + ".\" }";
            }
        }
        if (operation.equals("delPlatformUser")) {
            String login = request.getParameter("login");
            try {
                if (!request.isUserInRole("admin"))
                    throw new ServiceException("You are not allowed to delete users");
                if (login != null && login.equals(request.getUserPrincipal().getName()))
                    throw new ServiceException("You cannot delete your own user");
                pum.deleteUser(login);
                data = "{ \"message\": \"User with login " + login + " deleted.\" }";
            } catch (RemoteException re) {
                data = "{ \"message\": \"Could not not delete user with login=" + login + " Reason:"
                        + re.getMessage() + ".\" }";
            } catch (ServiceException se) {
                data = "{ \"message\": \"Could not not delete user with login=" + login + " Reason:"
                        + se.getMessage() + ".\" }";
            }
        }
        if (operation.equals("savePlatformUser")) {
            FileItem uploadedFile = null;
            PlatformUser user = null;
            int res = 0;
            byte[] foto = null;
            try {
                if (!request.isUserInRole("admin"))
                    throw new ServiceException("You are not allowed to upadte users");
                user = new PlatformUser();
                user.setNew(false);
                ServletFileUpload sfu = new ServletFileUpload(new DiskFileItemFactory());
                sfu.setFileSizeMax(329000);
                sfu.setHeaderEncoding("UTF-8");
                @SuppressWarnings("unchecked")
                List<FileItem> items = sfu.parseRequest(request);

                for (FileItem item : items) {
                    if (item.isFormField()) {
                        if (item.getFieldName().equals("login"))
                            user.setLogin(item.getString());
                        if (item.getFieldName().equals("username"))
                            user.setLogin(item.getString());
                        if (item.getFieldName().equals("password")) {
                            user.setPass(item.getString());
                        }
                        if (item.getFieldName().equals("idUser")) {
                            if (item.getString() == null || "".equals(item.getString()))
                                user.setNew(true);
                        }
                        if (item.getFieldName().equals("name")) {
                            byte[] fnb = item.get();
                            String text = PasswordGenerator.utf8Decoder(fnb);
                            user.setName(text);
                        }
                        if (item.getFieldName().equals("email")) {
                            String mail = item.getString();
                            if (MailUtils.isValidEmail(mail))
                                user.setEmail(mail);
                            else
                                throw new ServiceException("El email del usuario es incorrecto");
                        }
                        if (item.getFieldName().equals("telephonenumber"))
                            user.setTelephonenumber(item.getString());
                        if (item.getFieldName().equals("role"))
                            user.setRole(Integer.parseInt(item.getString()));
                        if (item.getFieldName().equals("language"))
                            user.setLanguage(item.getString());
                        if (item.getFieldName().equals("notification_level"))
                            user.setNotification_level(item.getString());
                        if (item.getFieldName().equals("promoter_id"))
                            user.setPromoter_id(item.getString());
                        if (item.getFieldName().equals("user_average_mark"))
                            user.setUser_average_mark(item.getString());
                        if (item.getFieldName().equals("user_votes"))
                            user.setUser_votes(item.getString());
                        if (item.getFieldName().equals("latitude"))
                            user.setHome_area_lat(item.getString());
                        if (item.getFieldName().equals("longitude"))
                            user.setHome_area_lon(item.getString());
                        if (item.getFieldName().equals("enabled"))
                            user.setEnabled(item.getString().equals("0") ? 0 : 1);
                    } else {
                        uploadedFile = item;
                        String inputExtension = FilenameUtils
                                .getExtension(uploadedFile.getName().toLowerCase());
                        if ("jpg".equals(inputExtension) || "gif".equals(inputExtension)
                                || "png".equals(inputExtension)) {
                            InputStream filecontent = item.getInputStream();
                            foto = new byte[(int) uploadedFile.getSize()];
                            filecontent.read(foto, 0, (int) uploadedFile.getSize());

                        }
                        //else
                        //   throw new FileUploadException("Extension not supported. Only jpg,gif or png files are allowed");
                    }
                }
                res = pum.saveUser(user);
                if (foto != null) {
                    //String v=cpm.getProperty("photo_hor");
                    //byte[] resizedPhoto=ImageUtil.resizeImageAsJPG(foto, (v==null || "".equals(v)) ?200:Integer.parseInt(v));
                    pum.uploadFoto(user.getLogin(), foto);
                }
                data = "{ \"message\": \"User with login " + user.getLogin() + " (id=" + res + ") saved.\" }";
            } catch (RemoteException exc) {
                data = "{ \"message\": \"Could not not save user with login=" + user.getLogin() + " Reason:"
                        + exc.getMessage() + ".\" }";
            } catch (ServiceException exc) {
                data = "{ \"message\": \"Could not not save user with login=" + user.getLogin() + " Reason:"
                        + exc.getMessage() + ".\" }";
            } catch (FileUploadException exc) {
                data = "{ \"message\": \"User with login " + user.getLogin() + " (id=" + res
                        + ") saved, but there was a problem uploading picture:" + exc.getMessage() + "\" }";
            }
        }
        if (operation.equals("listPlatformUsers")) {
            JQueryDataTableParamModel param = DataTablesParamUtility.getParam(request);
            try {
                JSONObject jsonResponse = pum.getPlatformUsersJSON(param);
                data = jsonResponse.toString();

            } catch (RemoteException re) {
                data = "{ \"message\": \"Could not not retrieve platform user listing. Reason:"
                        + re.getMessage() + ".\" }";
            } catch (ServiceException se) {
                data = "{ \"message\": \"Could not not retrieve platform user listing.  Reason:"
                        + se.getMessage() + ".\" }";
            }
        }
    }
    response.setContentType("application/json;charset=UTF-8");
    //response.setContentType("application/json");
    response.getWriter().print(data);
    response.getWriter().close();
}

From source file:medsavant.uhn.cancer.UserCommentApp.java

@Override
public void setVariantRecord(final VariantRecord variantRecord) {
    try {//  ww w  .j a  va 2 s  . c  o m
        //Get comment group associated with this variant.
        UserCommentGroup lcg = MedSavantClient.VariantManager.getUserCommentGroup(
                LoginController.getSessionID(), ProjectController.getInstance().getCurrentProjectID(),
                ReferenceController.getInstance().getCurrentReferenceID(), variantRecord);
        boolean hasComments = false;
        JPanel innerPanel = null;
        if (lcg != null) {
            //Build a mapping from ontology terms to all comments pertaining to that ontology term.
            //Iterating through this map will return the ontology terms in alphabetical order, and the comments
            //within each ontology will be ordered by their insertion id.
            Map<OntologyTerm, Collection<UserComment>> otCommentMap = new TreeMap<OntologyTerm, Collection<UserComment>>();

            for (Iterator<UserComment> li = lcg.iterator(); li.hasNext();) {
                UserComment lc = li.next();
                Collection<UserComment> ontologyComments = otCommentMap.get(lc.getOntologyTerm());
                if (ontologyComments == null) {
                    ontologyComments = new ArrayList<UserComment>();
                    hasComments = true;
                }
                ontologyComments.add(lc);

                otCommentMap.put(lc.getOntologyTerm(), ontologyComments);
            }
            if (hasComments) {
                innerPanel = getMainCommentPanel(otCommentMap, lcg, variantRecord);
            }
        }

        if (innerPanel == null) {
            innerPanel = getNoCommentsPanel();
        }

        JButton newCommentButton = new JButton("New Comment");
        newCommentButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                newComment(variantRecord);
            }
        });

        JPanel cp = new JPanel();
        cp.setLayout(new BoxLayout(cp, BoxLayout.X_AXIS));
        cp.add(Box.createHorizontalGlue());
        if (roleManager.checkRole(GENETIC_COUNSELLOR_ROLENAME) || roleManager.checkRole(RESIDENT_ROLENAME)) {
            cp.add(newCommentButton);
        }
        cp.add(Box.createHorizontalGlue());
        innerPanel.add(cp);
        final JScrollPane jsp = new JScrollPane(innerPanel);

        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {

                panel.removeAll();
                panel.add(jsp);
                panel.revalidate();
                panel.repaint();
            }
        });

    } catch (SessionExpiredException see) {
        LOG.error(see.getMessage(), see);
    } catch (SQLException sqe) {
        LOG.error(sqe.getMessage(), sqe);

    } catch (RemoteException rex) {
        LOG.error(rex.getMessage(), rex);
    }
}