Example usage for javax.jms JMSException getMessage

List of usage examples for javax.jms JMSException getMessage

Introduction

In this page you can find the example usage for javax.jms JMSException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.apache.axis2.transport.jms.JMSListener.java

/**
 * Starts listening for messages on this service
 *
 * @param service the AxisService just deployed
 *///from   ww w  . ja va 2 s  .  c o m
private void startListeningForService(AxisService service) {
    processService(service);
    JMSConnectionFactory cf = getConnectionFactory(service);
    if (cf == null) {
        String msg = "Service " + service.getName() + " does not specify"
                + "a JMS connection factory or refers to an invalid factory."
                + "This service is being marked as faulty and will not be "
                + "available over the JMS transport";
        log.warn(msg);
        JMSUtils.markServiceAsFaulty(service.getName(), msg, service.getAxisConfiguration());
        return;
    }

    String destination = JMSUtils.getDestination(service);
    try {
        cf.listenOnDestination(destination);
        log.info("Started listening on destination : " + destination + " for service " + service.getName());

    } catch (JMSException e) {
        handleException("Could not listen on JMS for service " + service.getName(), e);
        JMSUtils.markServiceAsFaulty(service.getName(), e.getMessage(), service.getAxisConfiguration());
    }
}

From source file:com.googlecode.fascinator.indexer.SolrWrapperQueueConsumer.java

/**
 * Callback function for incoming messages.
 * /*from w  w w  .  j a  va2s. co  m*/
 * @param message The incoming message
 */
@Override
public void onMessage(Message message) {
    MDC.put("name", name);
    try {
        // Make sure thread priority is correct
        if (!Thread.currentThread().getName().equals(thread.getName())) {
            Thread.currentThread().setName(thread.getName());
            Thread.currentThread().setPriority(thread.getPriority());
        }

        // Get the message details
        String text = ((TextMessage) message).getText();
        JsonSimple config = new JsonSimple(text);
        String event = config.getString(null, "event");
        if (event == null) {
            log.error("Invalid message received: '{}'", text);
            return;
        }

        // Commit on the index
        if (event.equals("commit")) {
            log.debug("Commit received");
            submitBuffer(true);
        }
        // Index the incoming document
        if (event.equals("index")) {
            String index = config.getString(null, "index");
            String document = config.getString(null, "document");
            if (index == null || document == null) {
                log.error("Invalid message received: '{}'", text);
                return;
            }
            addToBuffer(index, document);
        }

    } catch (JMSException jmse) {
        log.error("Failed to send/receive message: {}", jmse.getMessage());
    } catch (IOException ioe) {
        log.error("Failed to parse message: {}", ioe.getMessage());
    }
}

From source file:org.openadaptor.auxil.connector.jms.JMSReadConnector.java

/** Unpack the message contents */
protected Object unpackJMSMessage(Message msg) {
    Object msgContents = null;/* ww  w  . java2s . c  om*/
    if (msg != null) {
        try {
            msgContents = messageConvertor.unpackMessage(msg);
        } catch (JMSException e) {
            throw new ConnectionException("Error processing JMS Message text.", e, this);
        } catch (RecordFormatException e) {
            throw new ProcessingException(e.getMessage(), this);
        }
    }
    return msgContents;
}

From source file:be.fedict.trust.service.bean.TrustServiceBean.java

/**
 * Harvest the CRLs for specified certificate chain if caching is set for
 * the trust domain and no cache is yet active.
 *///from www  .  j a  v  a 2 s.  c o  m
private void harvest(TrustDomainEntity trustDomain, List<X509Certificate> certificateChain) {

    if (trustDomain.isUseCaching()) {
        for (X509Certificate certificate : certificateChain) {
            String issuerName = certificate.getIssuerX500Principal().toString();
            LOG.debug("harvest - Don't have Issuer's Serial Number??");
            CertificateAuthorityEntity certificateAuthority = this.certificateAuthorityDAO
                    .findCertificateAuthority(issuerName);
            if (null != certificateAuthority && (certificateAuthority.getStatus().equals(Status.INACTIVE)
                    || certificateAuthority.getStatus().equals(Status.NONE))) {
                if (null != certificateAuthority.getCrlUrl()) {
                    certificateAuthority.setStatus(Status.PROCESSING);
                    try {
                        this.notificationService.notifyDownloader(certificateAuthority.getName(), false);
                        if (null != certificateAuthority.getTrustPoint()
                                && null == certificateAuthority.getTrustPoint().getFireDate()) {
                            this.schedulingService.startTimer(certificateAuthority.getTrustPoint());
                        }
                    } catch (JMSException e) {
                        this.auditDAO.logAudit("Failed to notify harvester: " + e.getMessage());
                        LOG.error(e.getMessage(), e);
                    } catch (InvalidCronExpressionException e) {
                        this.auditDAO.logAudit("Failed to start timer for trust point: "
                                + certificateAuthority.getTrustPoint().getName());
                        LOG.error(e.getMessage(), e);
                    }
                } else {
                    certificateAuthority.setStatus(Status.NONE);
                }
            }
        }
    }
}

From source file:hermes.renderers.DefaultMessageRenderer.java

/**
 * Show the TextMessage in a JTextArea.//  ww  w.j av a 2  s. co  m
 * 
 * @param textMessage
 * @return
 * @throws JMSException
 */
protected JComponent handleTextMessage(final TextMessage textMessage) throws JMSException {
    //
    // Show the text in a JTextArea, you can edit the message in place and
    // then drop it onto another queue/topic.

    final String text = textMessage.getText();
    final JTextArea textPane = new JTextArea();

    // final CharBuffer bytes = CharBuffer.wrap(text.subSequence(0,
    // text.length())) ;
    // final JTextArea textPane = new MyTextArea(new PlainDocument(new
    // MappedStringContent(bytes))) ;

    textPane.setEditable(false);
    textPane.setFont(Font.decode("Monospaced-PLAIN-12"));
    textPane.setLineWrap(true);
    textPane.setWrapStyleWord(true);

    textPane.append(text);

    textPane.getDocument().addDocumentListener(new DocumentListener() {
        public void doChange() {
            try {
                textMessage.setText(textPane.getText());
            } catch (JMSException e) {
                JOptionPane.showMessageDialog(textPane, "Unable to update the TextMessage: " + e.getMessage(),
                        "Error modifying message content", JOptionPane.ERROR_MESSAGE);

                try {
                    textPane.setText(textMessage.getText());
                } catch (JMSException e1) {
                    log.error(e1.getMessage(), e1);
                }

                textPane.setEditable(false);
                textPane.getDocument().removeDocumentListener(this);
            }
        }

        @Override
        public void changedUpdate(DocumentEvent arg0) {
            doChange();
        }

        @Override
        public void insertUpdate(DocumentEvent arg0) {
            doChange();
        }

        @Override
        public void removeUpdate(DocumentEvent arg0) {
            doChange();
        }
    });

    textPane.setCaretPosition(0);

    return textPane;
}

From source file:com.googlecode.fascinator.messaging.EmailNotificationConsumer.java

/**
 * Stop the Render Queue Consumer. Including stopping the storage and
 * indexer//from  w  ww.j  a v a 2 s  .  co  m
 */
@Override
public void stop() throws Exception {
    log.info("Stopping {}...", name);
    if (producer != null) {
        try {
            producer.close();
        } catch (JMSException jmse) {
            log.warn("Failed to close producer: {}", jmse);
        }
    }
    if (consumer != null) {
        try {
            consumer.close();
        } catch (JMSException jmse) {
            log.warn("Failed to close consumer: {}", jmse.getMessage());
            throw jmse;
        }
    }
    if (session != null) {
        try {
            session.close();
        } catch (JMSException jmse) {
            log.warn("Failed to close consumer session: {}", jmse);
        }
    }
    if (connection != null) {
        try {
            connection.close();
        } catch (JMSException jmse) {
            log.warn("Failed to close connection: {}", jmse);
        }
    }
}

From source file:org.wso2.carbon.inbound.endpoint.protocol.jms.factory.JMSConnectionFactory.java

public void start(Connection connection) {
    try {//from   w w w .  j av  a  2s.  c  o  m
        connection.start();
    } catch (JMSException e) {
        logger.error("JMS Exception while starting connection for factory '" + this.connectionFactoryString
                + "' " + e.getMessage(), e);
    }
}

From source file:org.wso2.carbon.inbound.endpoint.protocol.jms.factory.JMSConnectionFactory.java

public void stop(Connection connection) {
    try {//ww  w  .j  a v a2  s . c  o m
        connection.stop();
    } catch (JMSException e) {
        logger.error("JMS Exception while stopping connection for factory '" + this.connectionFactoryString
                + "' " + e.getMessage(), e);
    }
}

From source file:org.grouter.common.jms.QueueSenderDestination.java

@Override
public synchronized void sendMessage(Serializable message) {
    try {//from w ww. j  av  a  2  s  .c  o m
        ObjectMessage msg = createMessage(message, null);
        setJMSHeader(msg);
        queueSender.send(msg);
        logger.debug("Message sent to destination : " + destinationName);
    } catch (JMSException ex) {
        logger.error("Failed sending message to JMS provider using destination " + destinationName
                + ". Error message : " + ex.getMessage());
        throw new JMSRuntimeException("Could not send message.", ex);
    }
}

From source file:org.wso2.carbon.inbound.endpoint.protocol.jms.factory.JMSConnectionFactory.java

public QueueConnection createQueueConnection() throws JMSException {
    try {/* www  .j ava 2s. c om*/
        return ((QueueConnectionFactory) (this.connectionFactory)).createQueueConnection();
    } catch (JMSException e) {
        logger.error("JMS Exception while creating queue connection through factory '"
                + this.connectionFactoryString + "' " + e.getMessage(), e);
    }
    return null;
}