1 Reply Latest reply on Dec 26, 2005 9:30 AM by Alexandre Torres

    Scheduler and UserTransaction

    Alexandre Torres Newbie

      Hi, I'm using the Scheduler service under JBoss 3.2
      I implemented the "org.jboss.varia.scheduler.Schedulable" interface, and created a Mbean inside a sar to configure it.
      The Schedule uses hibernate to do my job once a day. It works very well, and it's fairly easy to implement.
      The problem is that now I want to control the transaction by using the hibernate's Transaction object. It uses the Jboss UserTransaction object, but I just don't know how to configure my MBean to have access to the UserTransaction Object. I'm getting this error:

      Handling a Scheduler call failed
      java.lang.RuntimeException: org.hibernate.TransactionException: Could not find UserTransaction in JNDI:
      at schedule.TWMSchedule.perform(TWMSchedule.java:60)...
      Caused by: javax.naming.NameNotFoundException: UserTransaction not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)

      my mbean is configured in the same sar I use with hibernate:

       <mbean code="org.jboss.varia.scheduler.Scheduler"
       <attribute name="StartAtStartup">true</attribute>
       <attribute name="SchedulableClass">schedule.TWMSchedule</attribute>
       <attribute name="InitialStartDate">22/12/2005 13:12</attribute>
       <attribute name="SchedulePeriod">120000</attribute>
       <attribute name="InitialRepetitions">-1</attribute>

      Any help would be welcome.

        • 1. Re: Scheduler and UserTransaction
          Alexandre Torres Newbie

          I got a hint: the UserTransaction is bound as "UserTransaction" and not as "java:comp/UserTransaction". So I renamed the hibernate service to use UserTransaction and it works.
          I tried to figure out a solution where I don't have to change this name (and use java:comp/UserTransaction inside Schedule) but I can't. I tried to use an alias, but it gives me a problem in my web-app.

          The problem seem to be solved for now.