1 Reply Latest reply on Apr 15, 2008 10:19 AM by 666705

    Access to TimeManager from Startup

    666705
      Hello,

      I'm trying to start a commonj.timers.TimerManager from a startup class in Weblogic 10, in a way like this:
      InitialContext ic = new InitialContext();
         TimerManager tm = (TimerManager)ic.lookup("java:comp/env/tm/TimerManager");
      I've added the jar file where my class is included to the CLASSPATH.

      The problem is that all the samples that I see for this matter need a resource-ref that is only available in WAR or EJB apps (not JAR):
      <resource-ref>
         <res-ref-name>tm/TimerManager</res-ref-name>
         <res-type>commonj.timers.TimerManager</res-type>
         <res-auth>Container</res-auth>
         <res-sharing-scope>Unshareable</res-sharing-scope>
      </resource-ref>
      The error that I got from it is that the startup does not finds the object through the JNDI tree...

      So my question is: is it possible to execute any timer from a Startup class? Is there any way or I have to put it in a WAR or EJB app, because there's no other way to access to it through JNDI?

      Thanx.
        • 1. Re: Access to TimeManager from Startup
          666705
          Hello,

          I solved this matter creating a Timer Service MBean in the startup class:

          http://edocs.bea.com/wls/docs100/jmxinst/timer.html

          Now I've a listener that receives notifications every X seconds since the server starts up: I don't need commonj package at all.

          Regards.

          --
          Edited by vicente.tarrazona@consors.es at 04/15/2008 3:19 AM