Note that there are some explanatory texts on larger screens.

plurals
  1. POMessage Driven Bean swallows java.lang.Error
    text
    copied!<p>This is a very strange behavior: I had a <code>NoSuchMethodException</code> (because the compile and runtime library versions did not match), and the container swallowed it and I did not have the chance to catch. Have a look at this code:</p> <pre><code>@MessageDriven(...) public class NotificationReceiver implements MessageListener { @Override public void onMessage(Message message) { try { String textMessage = ((TextMessage) message).getText(); logger.debug("NOTIFICATION RECEIVED: " + textMessage); ... String string = rootNode.get("id").asText(); logger.debug("ID: " + string); } catch (Throwable e) { logger.debug("ERROR", e); } } </code></pre> <p>This code is inteded to listen to text messages which are in JSON format, but whenever I receive it, I never get to point ID</p> <pre><code>DEBUG [p: thread-pool-1; w: 12] NotificationReceiver - NOTIFICATION RECEIVED: {"name":"X","id":"123"} </code></pre> <p>After this point I didn't receive any log...</p> <p>Later I moved this code into another Stateless EJB inside an <code>@Asynchronous</code> method and called that from the MDB. Then I did receive the exception:</p> <pre><code>DEBUG [Ejb-Async-Thread-10] NotificationReceiverAsync - NOTIFICATION RECEIVED: {"name":"X","id":"123"} DEBUG [Ejb-Async-Thread-10] NotificationReceiverAsync - ERROR java.lang.NoSuchMethodError: org.codehaus.jackson.JsonNode.asText()Ljava/lang/String; </code></pre> <p>How come that I never received the exception while in MDB?</p> <p>Application Server: Glassfish 3.1.1</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload