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