Search in sources :

Example 6 with JmsException

use of org.springframework.jms.JmsException in project spring-framework by spring-projects.

the class JmsTemplateTests method testExceptionStackTrace.

@Test
void testExceptionStackTrace() {
    JMSException jmsEx = new JMSException("could not connect");
    Exception innerEx = new Exception("host not found");
    jmsEx.setLinkedException(innerEx);
    JmsException springJmsEx = JmsUtils.convertJmsAccessException(jmsEx);
    StringWriter sw = new StringWriter();
    PrintWriter out = new PrintWriter(sw);
    springJmsEx.printStackTrace(out);
    String trace = sw.toString();
    assertThat(trace.indexOf("host not found") > 0).as("inner jms exception not found").isTrue();
}
Also used : StringWriter(java.io.StringWriter) UncategorizedJmsException(org.springframework.jms.UncategorizedJmsException) JmsException(org.springframework.jms.JmsException) JMSException(jakarta.jms.JMSException) MessageNotReadableException(org.springframework.jms.MessageNotReadableException) UncategorizedJmsException(org.springframework.jms.UncategorizedJmsException) JMSException(jakarta.jms.JMSException) InvalidDestinationException(org.springframework.jms.InvalidDestinationException) ResourceAllocationException(org.springframework.jms.ResourceAllocationException) MessageFormatException(org.springframework.jms.MessageFormatException) MessageEOFException(org.springframework.jms.MessageEOFException) InvalidClientIDException(org.springframework.jms.InvalidClientIDException) JmsException(org.springframework.jms.JmsException) TransactionInProgressException(org.springframework.jms.TransactionInProgressException) MessageNotWriteableException(org.springframework.jms.MessageNotWriteableException) TransactionRolledBackException(org.springframework.jms.TransactionRolledBackException) JmsSecurityException(org.springframework.jms.JmsSecurityException) InvalidSelectorException(org.springframework.jms.InvalidSelectorException) PrintWriter(java.io.PrintWriter) Test(org.junit.jupiter.api.Test)

Aggregations

JmsException (org.springframework.jms.JmsException)6 JMSException (jakarta.jms.JMSException)3 ArrayList (java.util.ArrayList)2 Message (javax.jms.Message)2 Session (javax.jms.Session)2 InvalidClientIDException (org.springframework.jms.InvalidClientIDException)2 InvalidDestinationException (org.springframework.jms.InvalidDestinationException)2 InvalidSelectorException (org.springframework.jms.InvalidSelectorException)2 JmsSecurityException (org.springframework.jms.JmsSecurityException)2 MessageEOFException (org.springframework.jms.MessageEOFException)2 MessageFormatException (org.springframework.jms.MessageFormatException)2 MessageNotReadableException (org.springframework.jms.MessageNotReadableException)2 MessageNotWriteableException (org.springframework.jms.MessageNotWriteableException)2 ResourceAllocationException (org.springframework.jms.ResourceAllocationException)2 TransactionInProgressException (org.springframework.jms.TransactionInProgressException)2 TransactionRolledBackException (org.springframework.jms.TransactionRolledBackException)2 UncategorizedJmsException (org.springframework.jms.UncategorizedJmsException)2 Connection (jakarta.jms.Connection)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1