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:com.cognifide.aet.runner.distribution.RunnerMessageListener.java

private void processTestSuite(Message wrapperMessage, TaskMessage message) {
    Suite suite = (Suite) message.getData();
    try {/*from   w  w  w.ja  v  a  2s  .  co m*/
        boolean isMaintenanceMessage = StringUtils.endsWith(wrapperMessage.getJMSDestination().toString(),
                maintenanceDestinationName);
        testRunProcessor.process(suite, wrapperMessage.getJMSReplyTo(), isMaintenanceMessage);
    } catch (JMSException e) {
        LOGGER.error("Error wile processing RUN {}: ", suite.getCorrelationId(), e);
        sendFatalMessage(wrapperMessage, e.getMessage());
    } catch (StorageException e) {
        LOGGER.error("Failed to process test suite", e);
        sendFatalMessage(wrapperMessage, e.getMessage());
    }
}

From source file:edu.biu.scapi.comm.twoPartyComm.QueueCommunicationSetup.java

protected void doConstruct(ConnectionFactory factory, DestroyDestinationUtil destroyer, PartyData me,
        PartyData party) throws DuplicatePartyException {
    //Check that the party is the right object.
    if (!(me instanceof QueuePartyData) && !(party instanceof QueuePartyData)) {
        throw new IllegalArgumentException("each party in the list must be an instance of JMSParty");
    }//from w w  w.  j  ava  2 s .  c  om
    this.me = ((QueuePartyData) me);
    this.other = (QueuePartyData) party;

    if (this.me.getId() == other.getId()) {
        throw new DuplicatePartyException("each party should have a unique Id");
    }

    // Create a ConnectionFactory with the given URL, and enable/disable nagle's algorithm (by defining tcpNoDelay) using the given enableNagle.
    //ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("failover:tcp://"+url+"?socket.tcpNoDelay="+!enableNagle);
    this.connectionFactory = factory;
    this.destroyer = destroyer;

    // Create and start a Connection.
    try {
        connection = connectionFactory.createConnection();
        connection.start();

    } catch (JMSException e) {
        throw new edu.biu.scapi.exceptions.JMSException(e.getMessage());
    }
    connectionsNumber = 0;
}

From source file:hermes.renderers.fix.FIXMessageRenderer.java

@Override
public boolean canRender(Message message) {
    try {/*from   w w  w  . j a v a2  s  .c o m*/
        return FIXUtils.isFIX(message);
    } catch (JMSException ex) {
        log.error("during FIXMessage.isValid(): " + ex.getMessage(), ex);
        return false;
    }
}

From source file:com.linagora.obm.sync.TestQueueManager.java

private void shutdownQueueManager() {
    for (Session s : sessions) {
        try {/*from  w  w w .  j av  a 2  s .c o m*/
            s.close();
        } catch (JMSException e) {
            logger.error(e.getMessage(), e);
        }
    }
    for (Connection c : connections) {
        try {
            c.stop();
        } catch (JMSException e) {
            logger.error(e.getMessage(), e);
        }
        try {
            c.close();
        } catch (JMSException e) {
            logger.error(e.getMessage(), e);
        }
    }
    try {
        queueManager.stop();
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
    }
}

From source file:org.apigw.monitoring.jms.messagelistener.MonitoringMessageListener.java

@Override
public void onMessage(final Message message) {
    String textMessage = null;/*w  w  w.  ja v a2  s  .  c  o  m*/
    try {
        textMessage = ((TextMessage) message).getText();
        log.debug("Monitoring message: " + textMessage);

        if (message.getJMSRedelivered()) {
            log.debug("Detected a redelivered message with payload: " + textMessage);
            if (isMessageAlreadyPersisted(textMessage)) {
                return; //Finish the JMS transaction without persisting any message 
            }
            //Otherwise just continue business as usual as we want to consume this message
        }
        if (isResourceEvent(textMessage)) {
            ResourceEvent event = parseJSONToResourceEvent(textMessage);
            if (event != null)
                resourceEventRepository.save(event);
        } else {
            //If not a resource event, then it must be a AuthEvent
            AuthEvent event = parseJSONToAuthEvent(textMessage);
            if (event != null)
                authEventRepository.save(event);
        }
    } catch (JMSException e) {
        log.error(e.getMessage());
        log.debug("Rethrowing a JMSException as a RuntimeException in order to get a redelivery");
        throw new RuntimeException(e.getMessage());
    } catch (IOException e) {
        log.error(e.getMessage());
        log.debug("Rethrowing a JMSException as a RuntimeException in order to get a redelivery");
    }
}

From source file:com.cws.esolutions.agent.AgentDaemon.java

public void stop() {
    final String methodName = AgentDaemon.CNAME + "#stop()";

    if (DEBUG) {/* w ww  . j ava 2  s .co  m*/
        DEBUGGER.debug(methodName);
    }

    final MessageProducer producer = AgentDaemon.agentBean.getProducer();
    final Session session = AgentDaemon.agentBean.getSession();

    try {
        if (producer != null) {
            AgentDaemon.agentBean.getProducer().close();
        }

        if (session != null) {
            AgentDaemon.agentBean.getSession().close();
        }

        if (this.consumer != null) {
            this.consumer.close();
        }

        if (this.conn != null) {
            this.conn.close();
            this.conn.stop();
        }
    } catch (JMSException jx) {
        ERROR_RECORDER.error(jx.getMessage(), jx);

        this.exitCode = 1;
    }

    destroy();
}

From source file:eu.learnpad.simulator.mon.impl.ComplexEventProcessorImpl.java

public void init(TopicConnectionFactory connectionFact, InitialContext initConn) {
    try {//from   www.  j  a  v  a  2 s  .  c  o  m
        DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(),
                "Creating connection object ");
        connection = connectionFact.createTopicConnection();
        DebugMessages.ok();

        DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(),
                "Creating public session object ");
        publishSession = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
        DebugMessages.ok();

        DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(),
                "Creating subscribe object ");
        subscribeSession = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
        DebugMessages.ok();

        DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(),
                "Setting up reading topic ");
        connectionTopic = (Topic) initConn.lookup(topic);
        tSub = subscribeSession.createSubscriber(connectionTopic, null, true);
        DebugMessages.ok();

        DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(),
                "Setting up destination topic ");
        connectionTopic = publishSession.createTopic(this.topic);
        tPub = publishSession.createPublisher(connectionTopic);
        DebugMessages.ok();

        DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(),
                "Reading knowledge base ");

        knowledgeBase = createKnowledgeBase();
        ksession = knowledgeBase.newStatefulKnowledgeSession();
        ksession.setGlobal("EVENTS EntryPoint", eventStream);
        eventStream = ksession.getWorkingMemoryEntryPoint("DEFAULT");
        cepRuleManager = new DroolsRulesManager(knowledgeBuilder, knowledgeBase, ksession);
        DebugMessages.ok();

    } catch (JMSException e) {
        DebugMessages.println(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(), e.getMessage());
    } catch (NamingException e) {
        DebugMessages.println(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(), e.getMessage());
    }
}

From source file:org.apache.qpid.server.security.auth.manager.ExternalAuthenticationTest.java

/**
 * Tests that when EXTERNAL authentication manager is set as the default, clients presenting certificates are able to connect.
 * Also, checks a client with valid username and password but not using ssl is unable to connect to the non SSL port.
 *//*w  w w.  j  a  va2  s . co m*/
public void testExternalAuthenticationManagerAsDefault() throws Exception {
    setCommonBrokerSSLProperties(true);
    getBrokerConfiguration().setBrokerAttribute(Broker.DEFAULT_AUTHENTICATION_PROVIDER,
            TestBrokerConfiguration.ENTRY_NAME_EXTERNAL_PROVIDER);
    super.setUp();

    setClientKeystoreProperties();
    setClientTrustoreProperties();

    try {
        getConnection();
        fail("Connection should not succeed");
    } catch (JMSException e) {
        // pass
    }

    try {
        getExternalSSLConnection(false);
    } catch (JMSException e) {
        fail("Should be able to create a connection to the SSL port. " + e.getMessage());
    }
}

From source file:it.cnr.isti.labsedc.glimpse.impl.ComplexEventProcessorImpl.java

public void init(TopicConnectionFactory connectionFact, InitialContext initConn) {
    try {//from w  ww  . j  a va  2  s .  c o m
        DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(),
                "Creating connection object ");
        connection = connectionFact.createTopicConnection();
        DebugMessages.ok();

        DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(),
                "Creating public session object ");
        publishSession = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
        DebugMessages.ok();

        DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(),
                "Creating subscribe object ");
        subscribeSession = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
        DebugMessages.ok();

        DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(),
                "Setting up reading topic ");
        connectionTopic = (Topic) initConn.lookup(topic);
        tSub = subscribeSession.createSubscriber(connectionTopic, null, true);
        DebugMessages.ok();

        DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(),
                "Setting up destination topic ");
        connectionTopic = publishSession.createTopic(this.topic);
        tPub = publishSession.createPublisher(connectionTopic);
        DebugMessages.ok();

        DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(),
                "Reading knowledge base ");
        knowledgeBase = createKnowledgeBase();
        ksession = knowledgeBase.newStatefulKnowledgeSession();
        ksession.setGlobal("EVENTS EntryPoint", eventStream);
        eventStream = ksession.getWorkingMemoryEntryPoint("DEFAULT");
        cepRuleManager = new DroolsRulesManager(knowledgeBuilder, knowledgeBase, ksession);
        DebugMessages.ok();

    } catch (JMSException e) {
        DebugMessages.println(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(), e.getMessage());
    } catch (NamingException e) {
        DebugMessages.println(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(), e.getMessage());
    }
}

From source file:com.cognifide.aet.runner.distribution.dispatch.CollectionResultsRouter.java

@Override
public void onMessage(Message message) {
    if (message instanceof ObjectMessage) {
        timeoutWatch.update();/*from   w  w  w.jav  a2s . c  o m*/
        try {
            CollectorResultData collectorResultData = (CollectorResultData) ((ObjectMessage) message)
                    .getObject();

            collectorJobScheduler.messageReceived(collectorResultData.getRequestMessageId(),
                    message.getJMSCorrelationID());
            String testName = collectorResultData.getTestName();

            updateCounters(collectorResultData.getStatus());

            LOGGER.info(
                    "Reseived message {} - url {} in test `{}` collected with status {}. Results received "
                            + "successful {} / failed {} of {} total. CorrelationId: {}.",
                    message.getJMSMessageID(), collectorResultData.getUrl(), testName,
                    collectorResultData.getStatus(), messagesReceivedSuccess.get(),
                    messagesReceivedFailed.get(), getTotalTasksCount(), correlationId);

            if (collectorResultData.getStatus() == JobStatus.SUCCESS) {
                onSuccess(collectorResultData, testName);
            } else {
                final Url failedUrl = collectorResultData.getUrl();
                failedUrl.setErrorMessage(collectorResultData.getProcessingError().getDescription());
                updateSuiteUrl(testName, failedUrl);
                onError(collectorResultData.getProcessingError());
            }

            if (isFinished()) {
                LOGGER.info("CollectionResultsRouter task finished.");
                finishTask();
            }
        } catch (JMSException e) {
            LOGGER.error("Error while collecting results in CollectionResultsRouter", e);
            onError(ProcessingError.collectingError(e.getMessage()));
        }
    }
}