Q:

Quartz-scheduled JSR-352 jobs on GlassFish won't start

My goal is starting JSR-352 batch jobs through a Quartz scheduler on a GlassFish server, but there's a big issue. First of all, here's my code.
My JSR-352 job:
<job id="myJob" ...>
    <step id="myBatchlet">
        <batchlet ref="mypackage.MyBatchlet" />
    </step>
</job>

The corresponding Java code:
public class MyBatchlet implements Batchlet {

    @Override
    public String process() throws Exception {
        System.out.println("Hello World!");
        return BatchStatus.COMPLETED.toString();
    }

    @Override
    public void stop() throws Exception {
    }

}

When I start this job on a GlassFish 4.0 b89 server via a servlet, it works perfectly:
public class StartJobServlet extends HttpServlet {

    private void processRequest(...) throws ... {
        long executionId = BatchRuntime.getJobOperator().start("myJob", new Properties());
        System.out.println("myJob started, execution ID = " + executionId);
    }

}

But now I want to use a Quartz 2.2.3 scheduler, so I've written a Quartz job this way:
public class StartMyJob implements Job {

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        long executionId = BatchRuntime.getJobOperator().start("myJob", new Properties());
        System.out.println("myJob started, execution ID = " + executionId);
    }

}

and I've configured Quartz and a trigger for this job.
But when myJob is supposed to be started, it remains in STARTING state and never actually runs.
According to the logs, the com.ibm.jbatch.container.util.BatchWorkUnit::run procedure which actually launches the batch job, is never called whereas it is when using a servlet.
EDIT: I've found someone else's similar issue (same symptoms) there, but the given solution can't fit since I have no glassfish-web.xml file.

A:

Using Quartz in such a way that it executes a job on an unmanaged thread within an EE server will lead to issues using a variety of EE APIs, including Java Batch (JSR 352).
You could use standard EE APIs such as ManagedScheduledExecutorService, @Schedule, etc. to replace Quartz.  (There are plenty of tutorials, examples out there on this).
I'm not enough of an expert on Quartz to list the alternatives involving Quartz.   It would seem that if you could get Quartz threads to run using the ManagedExecutorService, it would solve the problem.  This JIRA suggests this was added to Terracotta Quartz, but I don't claim to be certain.   Perhaps there is a way using open source Quartz as well, either running Quartz outside the server, (and coming in remotely to a managed thread like an EJB?, not sure), or even using a configuration option I'm not aware of.
If anyone can provide a better answer clarifying the Quartz options it would be helpful. 

