Uploaded image for project: 'JBoss Enterprise Application Platform 6'
  1. JBoss Enterprise Application Platform 6
  2. JBPAPP6-1355

Exception handling of EJB container for MDB is incorrect

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Migrated to another ITS
    • Affects Version/s: EAP 6.0.0
    • Fix Version/s: TBD EAP 6
    • Component/s: EJB
    • Labels:
    • Environment:

      JBoss EAP 6.0.0

    • Steps to Reproduce:
      Hide

      I have tested with this simple RA:
      https://github.com/nekop/twitter-resource-adapter/

      where you need to add equals,hashcode methods to
      TwitterResourceAdapter. Next thing to make this work is to add
      under <subsystem xmlns="urn:jboss:domain:ejb3:1.3"> in standalone.xml:

      <mdb>
      <resource-adapter-ref
      resource-adapter-name="twitter-ra"/>
      <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
      </mdb>

      So I added to TwitterActivation.run() at the end
      throw new RuntimeException("TESTING RUNTIME EXCEPTION");

      To deploy:
      [standalone@localhost:9999 /]
      deploy /home/adam/gss-devel/twitter-resource-adapter/ra/target/twitter-ra.rar
      --force [standalone@localhost:9999 /]
      deploy /home/adam/gss-devel/twitter-resource-adapter/impl/target/twitter-ra-impl-0.1.jar
      --force [standalone@localhost:9999 /]
      deploy /home/adam/gss-devel/twitter-resource-adapter/example/target/twittermdb.jar
      --force

      After deploying this, log shows:
      11:01:36,941 ERROR [stderr] (Timer-4) Exception in thread "Timer-4"
      java.lang.RuntimeException: TESTING RUNTIME EXCEPTION 11:01:36,941
      ERROR [stderr] (Timer-4) at
      jp.programmers.resource.adapter.twitter.inflow.TwitterActivation.run(TwitterActivation.java:114)
      11:01:36,941 ERROR [stderr] (Timer-4) at
      java.util.TimerThread.mainLoop(Timer.java:512) 11:01:36,941 ERROR
      [stderr] (Timer-4) at java.util.TimerThread.run(Timer.java:462)

      Which seems to confirm that the Exception is not wrapped as
      EJBException.

      Show
      I have tested with this simple RA: https://github.com/nekop/twitter-resource-adapter/ where you need to add equals,hashcode methods to TwitterResourceAdapter. Next thing to make this work is to add under <subsystem xmlns="urn:jboss:domain:ejb3:1.3"> in standalone.xml: <mdb> <resource-adapter-ref resource-adapter-name="twitter-ra"/> <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/> </mdb> So I added to TwitterActivation.run() at the end throw new RuntimeException("TESTING RUNTIME EXCEPTION"); To deploy: [standalone@localhost:9999 /] deploy /home/adam/gss-devel/twitter-resource-adapter/ra/target/twitter-ra.rar --force [standalone@localhost:9999 /] deploy /home/adam/gss-devel/twitter-resource-adapter/impl/target/twitter-ra-impl-0.1.jar --force [standalone@localhost:9999 /] deploy /home/adam/gss-devel/twitter-resource-adapter/example/target/twittermdb.jar --force After deploying this, log shows: 11:01:36,941 ERROR [stderr] (Timer-4) Exception in thread "Timer-4" java.lang.RuntimeException: TESTING RUNTIME EXCEPTION 11:01:36,941 ERROR [stderr] (Timer-4) at jp.programmers.resource.adapter.twitter.inflow.TwitterActivation.run(TwitterActivation.java:114) 11:01:36,941 ERROR [stderr] (Timer-4) at java.util.TimerThread.mainLoop(Timer.java:512) 11:01:36,941 ERROR [stderr] (Timer-4) at java.util.TimerThread.run(Timer.java:462) Which seems to confirm that the Exception is not wrapped as EJBException.
    • Workaround:
      Workaround Exists

      Description

      After deploying a MDB with Container-Managed transaction and
      TransactionAttribute NOT_SUPPORTED, a RuntimeException thrown from
      within the MDB onMessage() is reported to the Adapter as such, with no
      EJBException wrapping. I.e.: the "((javax.jms.MessageListener)
      endPoint).onMessage(message)" call in our adapter fails with the
      exception type originally thrown.

      This does not look compliant with EJB 3.1 spec(JSR 318: Enterprise
      JavaBeansTM, Version 3.1, Table 20 page 392, last cell bottom right):
      "Throw EJBException that wraps the original exception to resource
      adapter".

      Another part of spec I was just made aware of says this:

      p383 of the spec states -

      In the case of a message-driven bean, the container logs the exception and then throws a javax.ejb.EJBException that wraps the original exception to the resource adapter. (See [15]).

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jboss-set JBoss SET
                  Reporter:
                  adam.kovari Adam Kovari
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: