Discussions

EJB programming & troubleshooting: BES Session-MDB Sample?

  1. BES Session-MDB Sample? (4 messages)

    Hi there!

    Does anybody know a working example (with source code and descriptors) of a session bean calling a message driven bean running in borland enterprise server 5.2? I didn't manage to make that fly...

    ThanX in advance,
    Ganzbaf

    Threaded Messages (4)

  2. BES Session-MDB Sample?[ Go to top ]

    I'd be interested in any sample code that can call an MDB.

    Message Driven Beans are asynchronous and driven by queues or topics. They do not have client interfaces and so cannot be called.
  3. Ganzbaf,

    An MDB is triggered only by receipt of a message (either via a topic or a queue).

    And of course any java code (either a standalone Java application/Web App/EJBs) can publish a message to a queue/topic. This would trigger the onMessage() of an MDB subscribed to this queue/topic.

    -krish
    Borland
  4. ThanX for your replies, Aaron and Krishnan!

    But in principle I know, how MDBs can be invoked. So I think I have to go more into the details of my problem:

    What I tried to do is to take the (working) MDB example comming with the BES 5.2 and adding a stateless session bean that should call the MDB insted the client (I used exactly the same code). Furthermore I modified the client to call the one and only parameterless void function of the session bean.

    The problem I didn't solve is, that the QueueSender.send() methode raises an Exception:

    java.lang.UnsupportedOperationException: Most probably XA and non-XA connection factories have been mixed in the same transaction
    at com.inprise.visitransact.jms.LocalTxResource.isSameRM(LocalTxResource.java:19)
    at com.inprise.visitransact.jta.TransactionState.computeXid(TransactionState.java:154)
    at com.inprise.visitransact.jta.TransactionState.startAssociation(TransactionState.java:197)
    ...

    I tried lots of things (using the XA and non-XA factory queues, changing the session beans transaction setting to "bean managed", using JNDI names in the form "serial://jms/tcf" (like the sample does) and "serial://resources/tcf" (like the developers guide describes)...), but nothing worked.

    Be aware, that the MDBs can be called everytime by a client and the connection between client and session bean is good too. So my guess is, that there is something wrong in my descriptor files, but, sorry, I have no idea what...

    Do you have any ideas?

    bye4now,
    Ganzbaf
  5. Hi!

    The original Borland sample writes first to a queue and then to a topic. What I tried now was to remove the queue stuff and see whats happening when the session bean only attempts to usa a topic. The result was: nada. But the server side exception is a completely different one:

    javax.jms.IllegalStateException: The session is closed.
      at progress.message.jimpl.Session.pOB_(:2324)
      at progress.message.jimpl.Session.commit(:849)
      ...

    Strange, isn't it?

    BTW: Today I did the same with JBoss and it worked the first time I tried. But there are no mysterious vendor specific descriptor files...

    bye4now,
    Ganzbaf