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

@Schedule cause IllegalArgumentException: daysOfMonth: [] #25408

Open
hantsy opened this issue Mar 19, 2025 · 5 comments
Open

@Schedule cause IllegalArgumentException: daysOfMonth: [] #25408

hantsy opened this issue Mar 19, 2025 · 5 comments
Labels
8.0 Issues that happen only on GlassFish 8 and not in version 7
Milestone

Comments

@hantsy
Copy link
Contributor

hantsy commented Mar 19, 2025

This issue is existed in the former 8.0.0-M9 and I tried to verify today and found it is still existed in the new GlassFish 8.0.0-M10.

The server log.

[2025-03-19T17:59:27.882860+08:00] [GF 8.0.0-M10] [WARNING] [] [org.glassfish.jersey.server.ServerRuntime$Responder] [tid: _ThreadID=41 _ThreadName=http-listener-1(1)] [levelValue: 900] [[
  An exception mapping did not successfully produce and processed a response. Logging the exception propagated to the default exception mapper.
java.lang.IllegalArgumentException: daysOfMonth: []
	at jakarta.enterprise.concurrent.CronTrigger.parse(CronTrigger.java:639)
	at jakarta.enterprise.concurrent.CronTrigger.daysOfMonth(CronTrigger.java:242)
	at org.glassfish.concurro.cdi.asynchronous.AsynchronousInterceptor.schedule(AsynchronousInterceptor.java:141)
	at org.glassfish.concurro.cdi.asynchronous.AsynchronousInterceptor.intercept(AsynchronousInterceptor.java:60)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)

The @Schedule annotation is used like this.

@ApplicationScoped
public class StandUpMeeting {

    @Asynchronous(
            executor = "java:comp/MyScheduleExecutor", // can not refer by Qualifier???
            runAt = {
                    @Schedule(
                            daysOfWeek = {
                                    DayOfWeek.MONDAY,
                                    DayOfWeek.TUESDAY,
                                    DayOfWeek.WEDNESDAY,
                                    DayOfWeek.THURSDAY,
                                    DayOfWeek.FRIDAY
                            },
                            hours = 8
                    ), // daily standup
                    @Schedule(daysOfMonth = {1}, hours = {12}), // monthly meeting,
                    @Schedule(cron = "*/5 * * * * *") // every 5 seconds for test purpose
            }
    )
    void inviteToMeeting() {
        LOGGER.log(Level.ALL, "running scheduled tasks....");
        // ...
    }
}

And call this bean in REST resources.

@RequestScoped
@Path("invites")
public class InviteResources {

    @Inject Invite invite;
    @Inject StandUpMeeting meeting;

    @POST
    public Response sendInvites() {
        meeting.inviteToMeeting();
        return Response.ok().build();
    }
   
    // ...
}

The complete project is here, https://github.com/hantsy/jakartaee11-sandbox/tree/master/concurrency/src/main/java/com/example/schedule, the tests is here, https://github.com/hantsy/jakartaee11-sandbox/blob/master/concurrency/src/test/java/com/example/it/ScheduleTest.java

@pzygielo
Copy link
Contributor

Will need to upgrade concurro once this

is released.

@pzygielo

This comment has been minimized.

@hantsy

This comment has been minimized.

@pzygielo pzygielo added this to the 8.0.0 milestone Mar 19, 2025
@pzygielo pzygielo added the 8.0 Issues that happen only on GlassFish 8 and not in version 7 label Mar 19, 2025
@pzygielo
Copy link
Contributor

With

claiming GF8.0.0-M10 with Concurrency TCK is fine, I guess TCK is missing test for this case.

@arjantijms
Copy link
Contributor

claiming GF8.0.0-M10 with Concurrency TCK is fine, I guess TCK is missing test for this case.

May be good to suggest a new test to be added for this in the concurrency tck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.0 Issues that happen only on GlassFish 8 and not in version 7
Projects
None yet
Development

No branches or pull requests

3 participants