users@glassfish.java.net

_at_Schedule not working in Glassfish 3

From: <glassfish_at_javadesktop.org>
Date: Tue, 20 Jul 2010 03:34:20 PDT

Hi!

I've written a simple bean in Netbeans 6.8 as a part of an EAR:

@Stateless
public class SchedulerBean implements SchedulerBeanLocal {

    @Schedule(minute = "*")
    public void run() throws IOException {
        Logger.getLogger("").info("SchedulerBean.run()");
        File f = new File("d:\\schedule.txt");
        try {
            f.createNewFile();
            BufferedWriter bw = new BufferedWriter(new FileWriter(f));
            String s = "test";
            bw.write(s, 0, s.length());
            bw.close();
        } catch (IOException ex) {
            throw ex;
        }
    }
}

I want the method "run()" to run every minute but nothing happens after deployment of the EAR. Server log says everything is OK:

[#|2010-07-20T12:11:31.421+0200|WARNING|glassfishv3.0|org.apache.catalina.connector.Request|_ThreadID=19;_ThreadName=Thread-1;|PWC4011: Unable to set request character encoding to UTF-8 from context , because request parameters have already been read, or ServletRequest.getReader() has already been called|#]

[#|2010-07-20T12:11:31.781+0200|INFO|glassfishv3.0|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=19;_ThreadName=Thread-1;|Portable JNDI names for EJB SchedulerBean : [java:global/Scheduler/Scheduler-ejb/SchedulerBean!scheduler.ejb.stateless.SchedulerBeanLocal, java:global/Scheduler/Scheduler-ejb/SchedulerBean]|#]

[#|2010-07-20T12:11:31.890+0200|INFO|glassfishv3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=19;_ThreadName=http-thread-pool-4848-(2);|Loading application Scheduler#Scheduler-war.war at Scheduler-war|#]

[#|2010-07-20T12:11:31.890+0200|INFO|glassfishv3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=19;_ThreadName=Thread-1;|Loading application Scheduler#Scheduler-war.war at Scheduler-war|#]

[#|2010-07-20T12:11:31.890+0200|INFO|glassfishv3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=19;_ThreadName=http-thread-pool-4848-(2);|Loading application Scheduler#Scheduler-war.war at Scheduler-war|#]

[#|2010-07-20T12:11:32.500+0200|INFO|glassfishv3.0|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=19;_ThreadName=Thread-1;|Scheduler was successfully deployed in 954 milliseconds.|#]

What's wrong?
[Message sent by forum member 'dziku']

http://forums.java.net/jive/thread.jspa?messageID=478064