The following is the API that would be needed to access the data in the queue
- select the column where the message is store in serialized form.
- Use the following
TO Deserialize (Fetching serialized data from queue):
Message msg = Util.deserialize((Serializable) Encoding.decodeToObject(result.getString("MSG")));
This would return object of type JBOSS Message.
Hope this helps. Let me know if you still need more details.
The way the Message object gets stored in both the tables is quite similar, hence the method of retrieval would also be similar. I am not sure as to why you would be getting a null pointer exception. I had an entire redelivery model designed based on the retrieval and storage of data. It works like charm. Could you describe the way you are trying to retrieve it. meanwhile I will also try the same and will confirm you as early as possible.
this is how I tried -
I have a prepared statement for getting the payload out from DLQ
"select PAYLOAD from JBM_MSG msg where MESSAGE_ID in (Select message_ID from JBM_MSG_REF where channel_id = (select channel_id from JBM_POSTOFFICE where queue_name=?))";
Gives me a resultset back - the payload is BLOB...like below
Blob blob = rs.getBlob(1);
byte bytes = null;
bytes = blob.getBytes(0L, (int)blob.length());
bytes = rs.getBytes(1);
String s = new String( bytes, "UTF-8" );
Message msg = Util.deserialize((Serializable) Encoding.decodeToObject(s));
blows up nullpointerex here in Encoding class
public static Serializable decodeToObject (String param) throws IOException, ClassNotFoundException
if (param == null)
throw new IllegalArgumentException();
ContextObjectInputStream ois = null;
ByteArrayInputStream bs = new ByteArrayInputStream(Base64.decodeBase64(param.getBytes()));
ois = new ContextObjectInputStream(bs);
return (Serializable) ois.readObject();
ois.close(); // NullPointerException
must be something wrong with Encoding I pass.