java.lang.NullPointerException

Spring JIRA | Wim Deblauwe | 8 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I saw a NullPointerException in the logs of my tomcat (started using maven cargo): {noformat} [INFO] [talledLocalContainer] java.lang.NullPointerException [INFO] [talledLocalContainer] at java.lang.String.indexOf(String.java:1734) [INFO] [talledLocalContainer] at java.lang.String.indexOf(String.java:1716) [INFO] [talledLocalContainer] at org.springframework.jms.JmsException.getMessage(JmsException.java:87) [INFO] [talledLocalContainer] at java.lang.Throwable.getLocalizedMessage(Throwable.java:267) [INFO] [talledLocalContainer] at java.lang.Throwable.toString(Throwable.java:343) [INFO] [talledLocalContainer] at java.lang.String.valueOf(String.java:2827) [INFO] [talledLocalContainer] at java.io.PrintWriter.println(PrintWriter.java:710) [INFO] [talledLocalContainer] at java.lang.Throwable.printStackTrace(Throwable.java:509) [INFO] [talledLocalContainer] at org.apache.log4j.spi.ThrowableInformation.getThrowableStrRep(ThrowableInformation.java:76) [INFO] [talledLocalContainer] at org.apache.log4j.spi.LoggingEvent.getThrowableStrRep(LoggingEvent.java:407) [INFO] [talledLocalContainer] at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:305) [INFO] [talledLocalContainer] at org.apache.log4j.WriterAppender.append(WriterAppender.java:160) [INFO] [talledLocalContainer] at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251) [INFO] [talledLocalContainer] at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66) [INFO] [talledLocalContainer] at org.apache.log4j.Category.callAppenders(Category.java:206) [INFO] [talledLocalContainer] at org.apache.log4j.Category.forcedLog(Category.java:391) [INFO] [talledLocalContainer] at org.apache.log4j.Category.error(Category.java:322) {noformat} The problem can be seen by looking at the code of JmsMessage.java: {code} public String getMessage() { String message = super.getMessage(); Throwable cause = getCause(); if (cause instanceof JMSException) { Exception linkedEx = ((JMSException) cause).getLinkedException(); if (linkedEx != null && cause.getMessage().indexOf(linkedEx.getMessage()) == -1) { message = message + "; nested exception is " + linkedEx; } } return message; } {code} The line that does the {{indexOf()}} can give a NPE if {{linkedEx.getMessage()}} returns {{null}}

    Spring JIRA | 8 years ago | Wim Deblauwe
    java.lang.NullPointerException
  2. 0

    I saw a NullPointerException in the logs of my tomcat (started using maven cargo): {noformat} [INFO] [talledLocalContainer] java.lang.NullPointerException [INFO] [talledLocalContainer] at java.lang.String.indexOf(String.java:1734) [INFO] [talledLocalContainer] at java.lang.String.indexOf(String.java:1716) [INFO] [talledLocalContainer] at org.springframework.jms.JmsException.getMessage(JmsException.java:87) [INFO] [talledLocalContainer] at java.lang.Throwable.getLocalizedMessage(Throwable.java:267) [INFO] [talledLocalContainer] at java.lang.Throwable.toString(Throwable.java:343) [INFO] [talledLocalContainer] at java.lang.String.valueOf(String.java:2827) [INFO] [talledLocalContainer] at java.io.PrintWriter.println(PrintWriter.java:710) [INFO] [talledLocalContainer] at java.lang.Throwable.printStackTrace(Throwable.java:509) [INFO] [talledLocalContainer] at org.apache.log4j.spi.ThrowableInformation.getThrowableStrRep(ThrowableInformation.java:76) [INFO] [talledLocalContainer] at org.apache.log4j.spi.LoggingEvent.getThrowableStrRep(LoggingEvent.java:407) [INFO] [talledLocalContainer] at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:305) [INFO] [talledLocalContainer] at org.apache.log4j.WriterAppender.append(WriterAppender.java:160) [INFO] [talledLocalContainer] at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251) [INFO] [talledLocalContainer] at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66) [INFO] [talledLocalContainer] at org.apache.log4j.Category.callAppenders(Category.java:206) [INFO] [talledLocalContainer] at org.apache.log4j.Category.forcedLog(Category.java:391) [INFO] [talledLocalContainer] at org.apache.log4j.Category.error(Category.java:322) {noformat} The problem can be seen by looking at the code of JmsMessage.java: {code} public String getMessage() { String message = super.getMessage(); Throwable cause = getCause(); if (cause instanceof JMSException) { Exception linkedEx = ((JMSException) cause).getLinkedException(); if (linkedEx != null && cause.getMessage().indexOf(linkedEx.getMessage()) == -1) { message = message + "; nested exception is " + linkedEx; } } return message; } {code} The line that does the {{indexOf()}} can give a NPE if {{linkedEx.getMessage()}} returns {{null}}

    Spring JIRA | 8 years ago | Wim Deblauwe
    java.lang.NullPointerException
  3. 0

    Please help: Nullpointerexception when using Camel sample code

    activemq-dev | 8 years ago | Ceriac
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    db:: 3.14::How to shutdown JMS client threads safely? 91

    hivmr.com | 1 year ago
    java.lang.NullPointerException

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at java.lang.String.indexOf()
    2. Java RT
      String.indexOf
      1. java.lang.String.indexOf(String.java:1734)
      2. java.lang.String.indexOf(String.java:1716)
      2 frames
    3. Spring Framework
      JmsException.getMessage
      1. org.springframework.jms.JmsException.getMessage(JmsException.java:87)
      1 frame
    4. Java RT
      Throwable.printStackTrace
      1. java.lang.Throwable.getLocalizedMessage(Throwable.java:267)
      2. java.lang.Throwable.toString(Throwable.java:343)
      3. java.lang.String.valueOf(String.java:2827)
      4. java.io.PrintWriter.println(PrintWriter.java:710)
      5. java.lang.Throwable.printStackTrace(Throwable.java:509)
      5 frames
    5. Apache Log4j
      Category.error
      1. org.apache.log4j.spi.ThrowableInformation.getThrowableStrRep(ThrowableInformation.java:76)
      2. org.apache.log4j.spi.LoggingEvent.getThrowableStrRep(LoggingEvent.java:407)
      3. org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:305)
      4. org.apache.log4j.WriterAppender.append(WriterAppender.java:160)
      5. org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
      6. org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
      7. org.apache.log4j.Category.callAppenders(Category.java:206)
      8. org.apache.log4j.Category.forcedLog(Category.java:391)
      9. org.apache.log4j.Category.error(Category.java:322)
      9 frames