0 Replies Latest reply on May 24, 2010 3:10 AM by Jose Miguel Loor

    problem executing jdbc statement via mdb

    Jose Miguel Loor Apprentice



      i have an odd issue trying to execute a callable  statement via a MessageDrivenBean. the scenario is like this:


      i  have @Stateles session bean that produces the message


      public class MensajesServiceImpl implements MensajesService,
               MensajesServiceRemote {


          @Resource(mappedName = "java:/JmsXA")
           private ConnectionFactory connectionFactory;


          @Resource(mappedName = "queue/balanceComprobacionQueue")
           private Queue balanceComprobacionQueue;


          public void llamarEjecucionArbolCuenta(final Integer periodo)
                   throws JMSException {
               QueueConnectionFactory qcf = (QueueConnectionFactory)  connectionFactory;
               QueueConnection queueConnection = qcf.createQueueConnection();
               QueueSession queueSession =  queueConnection.createQueueSession(false,
               QueueSender queueSender = queueSession
               ObjectMessage message = queueSession.createObjectMessage();
               message.setIntProperty(Constantes.PERIODO_MESSAGE_PROPERTY,  periodo);


      the message is received by the MDB


      @MessageDriven(activationConfig  = {
               @ActivationConfigProperty(propertyName = "destinationType",  propertyValue = "javax.jms.Queue"),
               @ActivationConfigProperty(propertyName = "destination",  propertyValue = "queue/balanceComprobacionQueue") })
      public class BalanceComprobacionMessageDrivenBean implements  MessageListener {


           private BalanceComprobacionService balanceComprobacionService;


           public void onMessage(final Message message) {
               try {
                   if (message instanceof ObjectMessage) {
                       ObjectMessage periodoMessage = (ObjectMessage) message;
                       Integer periodo = periodoMessage
               } catch (JMSException e) {
               } catch (EjecucionFallidaException e) {






      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



      public class BalanceComprobacionDaoImpl implements  BalanceComprobacionDao {


          @Resource(mappedName = "java:/myDataSource")
           private DataSource dataSource;


           public void ejecutarArbolCuentas(final Integer periodo)
                   throws EjecucionFallidaException {
               Connection connection = null;
               try {
                   String sql = "{ call arbol_cuenta(?) }";
                   connection = dataSource.getConnection();
                   CallableStatement statement = connection.prepareCall(sql);
                   statement.setInt(1, periodo);
               } catch (SQLException e) {
                   throw new EjecucionFallidaException(e);
               } finally {
                   try {
                   } catch (SQLException e) {
                       throw new EjecucionFallidaException(e);



      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


      i am using jboss 4.2.3.GA with  jdk 1.6_0.15; the database is postgresql 8.3


      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


      please help, thanks