Skip to main content

Starting Batch Jobs (JSR 352) on Glassfish 4.0 Open Source b89

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
4 replies [Last post]
jeremford
Offline
Joined: 2013-12-12

I've created a Batch Job along the lines of the sample provided at (http://www.oracle.com/technetwork/articles/java/batch-1965499.html).

This works ok when initialised by a Servlet call:

JobOperator jobOperator = BatchRuntime.getJobOperator();
Properties props = new Properties();
Long jobId = jobOperator.start("someJobId", props);

However when I try and initialise it (same code as above) from a Quartz Job, the Job starts (I get a JobId) however it remains in a "STARTING" state and never executes the defined PartitionMapper and Reader/Processor/Writer classes.

Has anyone else experienced this?

Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mk111283
Offline
Joined: 2005-03-29

Are there any exceptions in the server.log? Can you post the server.log?

jiggster
Offline
Joined: 2010-05-10

Dear Lord,

After 5 days of the thorough investigating, debugging and what not I have finally found the cause of the problem. It turned out that when you have glassfish-web.xml descriptor in your application (I'm talking about web application) and in that descriptor there is a version-identifier element defined with whatever version number then, well, you have a problem - at least if you want to use the new batch API.

I have no idea how this version-identifier affects running batch jobs (suspecting class loading issues), but it definitely does.

To prove that I'm not making things up, I'm attaching the webserverlog sample from java ee 7 tutorial, but with glassfish-web.xml descriptor added - deploy it, launch it, start batch job and see for yourselves that it hangs in the STARTING status.

I will open a new issue to address this problem, but only after Christmas.

Happy holidays!

jiggster
Offline
Joined: 2010-05-10

Hi,

I've just experienced this when starting the batch job from CDI bean. I'm currently investigating this issue - will let you know if I find something out.

Cheers.

jiggster
Offline
Joined: 2010-05-10

Hi jeremford,

Did You manage to find some solution to this problem? I've spent the whole weekend trying to figure out the cause, but unfortunately with no success. So if you've managed to come up with some solution, I'd be more than grateful if You let me know.

Cheers.