@Schedule not working Earlier i have worked with Wildfly 16 and our code looks like :
import java.io.File;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.AccessTimeout;
import javax.ejb.EJB;
import javax.ejb.Schedule;
import javax.ejb.Singleton;
import org.jboss.ejb3.annotation.TransactionTimeout;
@Singleton
@AccessTimeout(value = 4, unit = TimeUnit.HOURS)
@TransactionTimeout(value = 4, unit = TimeUnit.HOURS)
public class BankingSchedulerTest {
private static final Logger LOG = Logger.getLogger(BankingSchedulerTest.class.getName());
@Schedule(hour = "*", minute = "*/2", persistent = false)
public void ServiceNowMscSchedularApplication() {
LOG.info("Hello world !! Banking Scheduler test");
}
}
Project structure contains: \src\main\webapp\META-INF\singleton-deployment.xml
<?xml version="1.0" encoding="UTF-8"?>
<singleton-deployment xmlns="urn:jboss:singleton-deployment:1.0"/>
and pom file contains:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.integrator</groupId>
<artifactId>integrator-parent</artifactId>
<version>1.4-SNAPSHOT</version>
</parent>
<groupId>com.integrator</groupId>
<artifactId>banking-schduler-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Banking test scheduler</name>
<description>Banking test scheduler</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-ext-api</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Issue in Deployment:
When i deploy this code in wildfly 27 then it gives:
2023-08-09 08:13:38,759 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "banking-schduler-test-1.0-SNAPSHOT.war" (runtime-name: "banking-schduler-test-1.0-SNAPSHOT.war")
2023-08-09 08:13:38,790 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 89) WFLYCLINF0002: Started default cache from server container
2023-08-09 08:13:38,872 INFO [org.wildfly.clustering.singleton.server] (LegacyDistributedSingletonService - 1) WFLYCLSN0003: BNKAP08:batch-01 elected as the singleton provider of the jboss.deployment.unit."banking-schduler-test-1.0-SNAPSHOT.war".installer service
2023-08-09 08:13:38,872 INFO [org.wildfly.clustering.singleton.server] (LegacyDistributedSingletonService - 1) WFLYCLSN0001: This node will now operate as the singleton provider of the jboss.deployment.unit."banking-schduler-test-1.0-SNAPSHOT.war".installer service
2023-08-09 08:13:38,996 INFO [org.jboss.as.server] (ServerService Thread Pool -- 90) WFLYSRV0010: Deployed "banking-schduler-test-1.0-SNAPSHOT.war" (runtime-name : "banking-schduler-test-1.0-SNAPSHOT.war")
2023-08-09 08:13:39,083 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 97) WFLYUT0021: Registered web context: '/banking-schduler-test-1.0-SNAPSHOT' for server 'default-server'
When i deploy in my old wildfly 16 then i get following:
2023-08-09 10:25:53,369 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0027: Starting deployment of "banking-schduler-test-1.0-SNAPSHOT.war" (runtime-name: "banking-schduler-test-1.0-SNAPSHOT.war")
2023-08-09 10:25:53,371 INFO [org.wildfly.clustering.server] (LegacyDistributedSingletonService - 1) WFLYCLSV0003: alt-esb-app01:masterdata-batch-01 elected as the singleton provider of the jboss.deployment.unit."banking-schduler-test-1.0-SNAPSHOT.war".installer service
2023-08-09 10:25:53,372 INFO [org.wildfly.clustering.server] (LegacyDistributedSingletonService - 1) WFLYCLSV0001: This node will now operate as the singleton provider of the jboss.deployment.unit."banking-schduler-test-1.0-SNAPSHOT.war".installer service
2023-08-09 10:25:53,421 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) WFLYWELD0003: Processing weld deployment banking-schduler-test-1.0-SNAPSHOT.war
2023-08-09 10:25:53,442 INFO [org.jboss.as.ejb3.deployment] (MSC service thread 1-1) WFLYEJB0473: JNDI bindings for session bean named 'BankingSchedulerTest' in deployment unit 'deployment "banking-schduler-test-1.0-SNAPSHOT.war"' are as follows:
java:global/banking-schduler-test-1.0-SNAPSHOT/BankingSchedulerTest!com.integrator.banking.BankingSchedulerTest
java:app/banking-schduler-test-1.0-SNAPSHOT/BankingSchedulerTest!com.integrator.banking.BankingSchedulerTest
java:module/BankingSchedulerTest!com.integrator.banking.BankingSchedulerTest
ejb:banking-schduler-test-1.0-SNAPSHOT/BankingSchedulerTest!com.integrator.banking.BankingSchedulerTest
java:global/banking-schduler-test-1.0-SNAPSHOT/BankingSchedulerTest
java:app/banking-schduler-test-1.0-SNAPSHOT/BankingSchedulerTest
java:module/BankingSchedulerTest
2023-08-09 10:25:53,668 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 88) WFLYUT0021: Registered web context: '/banking-schduler-test-1.0-SNAPSHOT' for server 'default-server'
2023-08-09 10:25:53,766 INFO [org.jboss.as.server] (ServerService Thread Pool -- 37) WFLYSRV0010: Deployed "banking-schduler-test-1.0-SNAPSHOT.war" (runtime-name : "banking-schduler-test-1.0-SNAPSHOT.war")
2023-08-09 10:26:00,002 INFO [com.integrator.BankingSchedulerTest] (EJB default - 2) Hello world !! Banking Scheduler test
Can anyone suggest what is happening?