<!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="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">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;">
    problem executing jdbc statement via mdb
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/jmiguel77">Jose Miguel Loor</a> in <i>JBoss Messaging</i> - <a href="http://community.jboss.org/message/544431#544431">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>hi</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>i have an odd issue trying to execute a callable&#160; statement via a MessageDrivenBean. the scenario is like this:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>i&#160; have @Stateles session bean that produces the message</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>@Stateless<br/> public class MensajesServiceImpl implements MensajesService,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MensajesServiceRemote {</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; @Resource(mappedName = "java:/JmsXA")<br/>&#160;&#160;&#160;&#160; private ConnectionFactory connectionFactory;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; @Resource(mappedName = "queue/balanceComprobacionQueue")<br/>&#160;&#160;&#160;&#160; private Queue balanceComprobacionQueue;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; public void llamarEjecucionArbolCuenta(final Integer periodo)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; throws JMSException {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueConnectionFactory qcf = (QueueConnectionFactory)&#160; connectionFactory;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueConnection queueConnection = qcf.createQueueConnection();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueSession queueSession =&#160; queueConnection.createQueueSession(false,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Session.AUTO_ACKNOWLEDGE);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueSender queueSender = queueSession<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .createSender(balanceComprobacionQueue);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ObjectMessage message = queueSession.createObjectMessage();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; message.setIntProperty(Constantes.PERIODO_MESSAGE_PROPERTY,&#160; periodo);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; queueSender.send(message);<br/>&#160;&#160;&#160;&#160; }<br/> }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>the message is received by the MDB</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>@MessageDriven(activationConfig&#160; = {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; @ActivationConfigProperty(propertyName = "destinationType",&#160; propertyValue = "javax.jms.Queue"),<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; @ActivationConfigProperty(propertyName = "destination",&#160; propertyValue = "queue/balanceComprobacionQueue") })<br/> public class BalanceComprobacionMessageDrivenBean implements&#160; MessageListener {</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; @EJB<br/>&#160;&#160;&#160;&#160; private BalanceComprobacionService balanceComprobacionService;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; @Override<br/>&#160;&#160;&#160;&#160; public void onMessage(final Message message) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (message instanceof ObjectMessage) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ObjectMessage periodoMessage = (ObjectMessage) message;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Integer periodo = periodoMessage<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .getIntProperty(Constantes.PERIODO_MESSAGE_PROPERTY);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; balanceComprobacionService.ejecutarArbolCuentas(periodo);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (JMSException e) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (EjecucionFallidaException e) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>as you can see, in the MDB i am&#160; injecting another stateless session bean (BalanceComprobacionService)&#160; and calling a method registered in that session bean; the method i am&#160; executing is this</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>@Stateless<br/> public class BalanceComprobacionDaoImpl implements&#160; BalanceComprobacionDao {</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; @Resource(mappedName = "java:/myDataSource")<br/>&#160;&#160;&#160;&#160; private DataSource dataSource;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; @Override<br/>&#160;&#160;&#160;&#160; public void ejecutarArbolCuentas(final Integer periodo)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; throws EjecucionFallidaException {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Connection connection = null;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; String sql = "{ call arbol_cuenta(?) }";<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; connection = dataSource.getConnection();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CallableStatement statement = connection.prepareCall(sql);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; statement.setInt(1, periodo);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; statement.execute();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (SQLException e) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; throw new EjecucionFallidaException(e);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } finally {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; connection.close();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (SQLException e) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; throw new EjecucionFallidaException(e);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160;&#160; }<br/> }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>everything works fine, until the&#160; statement.execute(); at this point, the execution just stops; it doesn't&#160; give any error, exception, nor in the jboss server or the database, it&#160; just stops right there</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>i am using jboss 4.2.3.GA with&#160; jdk 1.6_0.15; the database is postgresql 8.3</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>i don't&#160; think the problem is related with the database or the function i am&#160; calling, because if i test the BalanceComprobacionDaoImpl by itself, it&#160; works ok, it's just when i test the whole process that it stops at the&#160; callable statement execution</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>please help, thanks</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/544431#544431">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Messaging at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>