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

NPE in ApplyMisfire #35

Open
agnibha92 opened this issue Sep 7, 2018 · 5 comments
Open

NPE in ApplyMisfire #35

agnibha92 opened this issue Sep 7, 2018 · 5 comments

Comments

@agnibha92
Copy link

Hi I am Getting This issue.

Caused by: java.lang.NullPointerException
	at net.joelinn.quartz.jobstore.AbstractRedisStorage.applyMisfire(AbstractRedisStorage.java:565)
	at net.joelinn.quartz.jobstore.AbstractRedisStorage.acquireNextTriggers(AbstractRedisStorage.java:819)
	at net.joelinn.quartz.jobstore.RedisJobStore$39.doWithLock(RedisJobStore.java:1041)
	at net.joelinn.quartz.jobstore.RedisJobStore$39.doWithLock(RedisJobStore.java:1037)
	at net.joelinn.quartz.jobstore.RedisJobStore.doWithLock(RedisJobStore.java:1154)
	... 2 more

Code that I am Executing

public class TestQuartzWithRedis {
    public static void main (String[] args) throws SchedulerException, InterruptedException {
        Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
        scheduler.start();

        Date startTime = DateBuilder.futureDate(5000, DateBuilder.IntervalUnit.MILLISECOND);

        JobDetail job = JobBuilder
                .newJob(SampleJob.class)
                .withIdentity(UUID.randomUUID().toString(), "messageGroup")
                .requestRecovery()
                .build();

        SimpleTrigger trigger = (SimpleTrigger) newTrigger()
                .forJob(job)
                .withIdentity("trigger:" + UUID.randomUUID().toString(), "messageGroup")
                .startAt(startTime)
                .build();
        scheduler.scheduleJob(job, trigger);

    }
}
@agnibha92
Copy link
Author

This specifically happens if you have symbols in your trigger and job name...

@jlinn
Copy link
Owner

jlinn commented Sep 10, 2018

Ah, I see. You've got a : in your trigger name. : is the default delimiter for the Redis keys used by the jobstore. If you intend to use those in your trigger names, you should configure a different delimiter ($$, for example):

org.quartz.jobStore.keyDelimeter = $$

@agnibha92
Copy link
Author

Yes but it fails for other special characters too... Like +

@agnibha92
Copy link
Author

@jlinn I am Getting this issue again if I set org.quartz.scheduler.instanceId to AUTO and My InetAddress.getLocalHost().getHostName() contains special characters.

@agnibha92
Copy link
Author

 public static String getUniqueIdentifier(String schedName,
            String schedInstId) {
        return schedName + "_$_" + schedInstId;
}

This is the method in quartz that generates unique identifier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants