[jboss-user] [JBoss Messaging] - problem executing jdbc statement via mdb

Jose Miguel Loor do-not-reply at jboss.com
Mon May 24 03:10:35 EDT 2010


Jose Miguel Loor [http://community.jboss.org/people/jmiguel77] created the discussion

"problem executing jdbc statement via mdb"

To view the discussion, visit: http://community.jboss.org/message/544431#544431

--------------------------------------------------------------
hi

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

@Stateless
 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,
                 Session.AUTO_ACKNOWLEDGE);
         QueueSender queueSender = queueSession
                 .createSender(balanceComprobacionQueue);
         ObjectMessage message = queueSession.createObjectMessage();
         message.setIntProperty(Constantes.PERIODO_MESSAGE_PROPERTY,  periodo);
         queueSender.send(message);
     }
 }

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 {

    @EJB
     private BalanceComprobacionService balanceComprobacionService;

    @Override
     public void onMessage(final Message message) {
         try {
             if (message instanceof ObjectMessage) {
                 ObjectMessage periodoMessage = (ObjectMessage) message;
                 Integer periodo = periodoMessage
                          .getIntProperty(Constantes.PERIODO_MESSAGE_PROPERTY);
                  balanceComprobacionService.ejecutarArbolCuentas(periodo);
             }
         } catch (JMSException e) {
             e.printStackTrace();
         } catch (EjecucionFallidaException e) {
             e.printStackTrace();
         }

    }

}

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


@Stateless
 public class BalanceComprobacionDaoImpl implements  BalanceComprobacionDao {

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

    @Override
     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);
             statement.execute();
         } catch (SQLException e) {
             throw new EjecucionFallidaException(e);
         } finally {
             try {
                 connection.close();
             } 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

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/544431#544431]

Start a new discussion in JBoss Messaging at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100524/854375fb/attachment-0001.html 


More information about the jboss-user mailing list