Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There must be exactly one bean that matches the skip predicate #411

Closed
snowdrop-bot opened this issue Sep 3, 2021 · 0 comments
Closed
Assignees
Labels
7 - Community development upstream/closed The issue has been closed in the upstream repository

Comments

@snowdrop-bot
Copy link
Collaborator

Describe the bug

@Slf4j
@ApplicationScoped
public class TestJob {
    @Scheduled(every="10s", skipExecutionIf = TestPredicate.class)
    void test() {
        log.info("Scheduled job execute");
    }
}
@Singleton
public class TestPredicate implements Scheduled.SkipPredicate {
    @Override
    public boolean test(ScheduledExecution execution) {
        return false;
    }
}

I am going to test the skip function of quarkus-scheduler, when I start Quarkus, the following error is printed

2021-09-03 19:08:53.617[ERROR]-[main]-[i.q.d.d.IsolatedDevModeMain(-1)]: Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.arc.deployment.ArcProcessor#generateResources threw an exception: javax.enterprise.inject.spi.DeploymentException: java.lang.IllegalStateException: There must be exactly one bean that matches the skip predicate: "cn.ecpark.service.sample.quarkus.TestPredicate" on: @Scheduled(every = "10s",skipExecutionIf = cn.ecpark.service.sample.quarkus.TestPredicate)
	at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1094)
	at io.quarkus.arc.processor.BeanProcessor.processValidationErrors(BeanProcessor.java:142)
	at io.quarkus.arc.deployment.ArcProcessor.generateResources(ArcProcessor.java:447)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.lang.IllegalStateException: There must be exactly one bean that matches the skip predicate: "cn.ecpark.service.sample.quarkus.TestPredicate" on: @Scheduled(every = "10s",skipExecutionIf = cn.ecpark.service.sample.quarkus.TestPredicate)
	at io.quarkus.scheduler.deployment.SchedulerProcessor.validateScheduled(SchedulerProcessor.java:412)
	at io.quarkus.scheduler.deployment.SchedulerProcessor.validateScheduledBusinessMethods(SchedulerProcessor.java:189)
	... 11 more

Expected behavior

The log prints "Scheduled job execute" every 10 seconds

Actual behavior

exception log

How to Reproduce?

No response

Output of uname -a or ver

Microsoft Windows [Version 10.0.22000.168]

Output of java -version

java version "11.0.10" 2021-01-19

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.1.4.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.1

Additional information

No response


quarkusio#19900


$upstream:19900$

@snowdrop-bot snowdrop-bot added the upstream/closed The issue has been closed in the upstream repository label Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7 - Community development upstream/closed The issue has been closed in the upstream repository
Projects
None yet
Development

No branches or pull requests

2 participants