<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
JBPM process sends corrupted JMS Messages
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/fmagdy">Fady Magdy</a> in <i>jBPM Development</i> - <a href="https://community.jboss.org/message/721323#721323">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p style="margin-bottom: .0001pt;"><span style="font-size: 10pt; font-family: Arial, sans-serif;">Hi,</span></p><p style="margin-bottom: 0.0001pt;"><span style="font-size: 10pt; font-family: Arial, sans-serif;"> </span></p><p style="margin-bottom: 0.0001pt;"><span style="font-size: 10pt; font-family: Arial, sans-serif;">We are using jboss SOA Platform, we are trying to use a bpmn process to read some data from a database and send a JMS message containing some text to a queue in the ESB, but the ESB randomly fails to  de-sterilize some messages, by debugging we found that some messages arrive at the queue corrupted, this happens only when we publish the workflows at the bpmn server (it works perfectly fine with the process running from in the jboss development studio)<br/> <br/> this happens randomly to some messages even if these messages were transmitted correctly before. Any idea what could be the cause of this? </span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>This is the code we use to send the messages</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="font-size: 10.0pt; font-family: 'Courier New';"> </span> </p><p><strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">public</strong> <strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">class</strong><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> SendJMSMessage {</span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> QueueConnection </span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">conn</span>;</p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> QueueSession </span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">session</span>;</p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> Queue </span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">que</span>;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p> <strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">public</strong> <strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">void</strong><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> setupConnection() </span><strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">throws</strong><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> JMSException, NamingException</span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> {</span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> Properties properties1 = </span><strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">new</strong><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> Properties();</span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> properties1.put(Context.</span><em style="color: #0000c0; font-size: 10.0pt; font-family: 'Courier New';">INITIAL_CONTEXT_FACTORY</em><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">,</span></p><p> <span style="font-size: 10.0pt; font-family: 'Courier New'; color: #2a00ff;">"org.jnp.interfaces.NamingContextFactory"</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">);</span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> properties1.put(Context.</span><em style="color: #0000c0; font-size: 10.0pt; font-family: 'Courier New';">URL_PKG_PREFIXES</em><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">,</span></p><p> <span style="font-size: 10.0pt; font-family: 'Courier New'; color: #2a00ff;">"org.jboss.naming:org.jnp.interfaces"</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">);</span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> properties1.put(Context.</span><em style="color: #0000c0; font-size: 10.0pt; font-family: 'Courier New';">PROVIDER_URL</em><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">, </span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: #2a00ff;">"jnp://127.0.0.1:1099"</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">);</span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> InitialContext iniCtx = </span><strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">new</strong><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> InitialContext(properties1);</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="font-size: 10.0pt; font-family: 'Courier New';"> </span> </p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> Object tmp = iniCtx.lookup(</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: #2a00ff;">"ConnectionFactory"</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">);</span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;</span></p><p> <span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">conn</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> = qcf.createQueueConnection();</span></p><p>  <span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">que</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> = (Queue) iniCtx.lookup(</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: #2a00ff;">"queue/ourqueue"</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">);</span></p><p> <span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">session</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> = </span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">conn</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">.createQueueSession(</span><strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">false</strong><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">, QueueSession.</span><em style="color: #0000c0; font-size: 10.0pt; font-family: 'Courier New';">AUTO_ACKNOWLEDGE</em><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">);</span></p><p> <span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">conn</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">.start();</span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> System.</span><em style="color: #0000c0; font-size: 10.0pt; font-family: 'Courier New';">out</em><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">.println(</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: #2a00ff;">"Connection Started"</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">);</span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> }</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p> <strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">public</strong> <strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">void</strong><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> stop() </span><strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">throws</strong><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> JMSException </span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> { </span></p><p> <span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">conn</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">.stop();</span></p><p> <span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">session</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">.close();</span></p><p> <span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">conn</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">.close();</span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> }</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p> <strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">public</strong> <strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">void</strong><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> sendAMessage(String msg) </span><strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">throws</strong><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> JMSException {</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> QueueSender send = </span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">session</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">.createSender(</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">que</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">);        </span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> ObjectMessage tm = </span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000c0;">session</span><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;">.createObjectMessage(msg);</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> send.send(tm);        </span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> send.close();</span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> }</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p> <strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">public</strong> <strong style="color: #7f0055; font-size: 10.0pt; font-family: 'Courier New';">void</strong><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> Send(String msg)</span></p><p><span style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"> {                    </span></p><p>      </p><p><span style="font-size: 10.0pt; font-family: 'Courier New';">       SendJMSMessage <span style="text-decoration: underline;">sm</span> = new SendJMSMessage();</span></p><p><strong style="font-size: 10.0pt; font-family: 'Courier New';">       sm.setupConnection();   sm.sendAMessage(msg); </strong></p><p><strong style="font-size: 10.0pt; font-family: 'Courier New';">       sm.stop();</strong></p><p><strong style="font-size: 10.0pt; font-family: 'Courier New';">       </strong></p><p><strong style="font-size: 10.0pt; font-family: 'Courier New';">}</strong></p><p><strong style="font-size: 10.0pt; font-family: 'Courier New';">}</strong></p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/721323#721323">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM Development at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2035">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>