Closed seckin206 closed 7 years ago
Afaict, the RI doens't have a built in for it. You could implement com.ibm.jbatch.spi.services.IJobXMLLoaderService
where you load the job from a dir and then add JOBXML_LOADER=your.impl.ClassName
to batch-services.properties
.
Nope, I take that back, it does hava a dir loader. Add JOBXML_LOADER=com.ibm.jbatch.container.services.impl.DirectoryJobXMLLoaderServiceImpl
in META-INF/services/batch-services.properties
and you should be right.
You will also need to set the system property com.ibm.jbatch.jsl.directory=/path/to/your/xmls
.
I should include the line in my batch applications META-INF/services/batch-services.properties file, am i right?
Hmm it looks like you would have to edit the batch-services.properties from the jbatch jar, which seems pretty useless for what you are doing. You can however provide this info using two system properties instead of editing the jar:
com.ibm.jbatch.spi.ServiceRegistry.JOBXML_LOADER=com.ibm.jbatch.container.services.impl.DirectoryJobXMLLoaderServiceImpl
and com.ibm.jbatch.jsl.directory=/path/to/your/xmls
Well, tried but not working. I still get the same error FileNotFound under META-INF/batch-jobs. I guess it indicates that it is not looking for the directory I put.
If you wanna reproduce my setup: Glassfish 4.1 JVM Options -Dcom.ibm.jbatch.jsl.directory="D:/" -Dcom.ibm.jbatch.spi.ServiceRegistry.JOBXML_LOADER=com.ibm.jbatch.container.services.impl.DirectoryJobXMLLoaderServiceImpl
Could you post a stack trace? Also shouldn't that be D:\
?
The property name is just _JOBXML_LOADER_SERVICE_ not the more nicely qualified _com.ibm.jbatch.spi.ServiceRegistry.JOBXML_LOADER_.
Well that's kind of ugly. No one's pushed on this at all in a GF environment so we hadn't thought to make this more nicely configurable.
Also I'm not sure versions of Glassfish this first was integrated with, though I imagine it's been in nightly builds for awhile now.
Please see if that helps.
Oh, yeah I see now. I misread this line as being the literal property: https://github.com/WASdev/standards.jsr352.jbatch/blob/fc09f8dec9826ca56981fba2dbd43c1d6c411077/com.ibm.jbatch.spi/src/main/java/com/ibm/jbatch/spi/ServiceRegistry.java#L160
I changed the line into this : -DJOBXML_LOADER_SERVICE=com.ibm.jbatch.container.services.impl.DirectoryJobXMLLoaderServiceImpl
Still getting the same error.
Hmm... can you collect server logs in GF with:
com.ibm.jbatch.container.level=FINEST
This seems to be the latest hit on how to do that in general: http://docs.oracle.com/cd/E18930_01/html/821-2416/abluk.html
https://gist.github.com/seckin206/2c9dc64c34fc9ec5c37e
Isolated run, rather than JVM Options, I now added the respective options to "System Properties". No changes in behaviour.
BTW, you have mentioned about JSL_DIR here:
http://stackoverflow.com/questions/19904750/jsr-352-dynamic-job-loading
(Edited a 2nd time as I realized the confusion Brent and I each had).
I'm sorry, I was wrong. @BrentDouglas was closer (and I appreciate you answering) but was a bit off as well.
The JVM property should be:
_-Dcom.ibm.jbatch.spi.ServiceRegistry.JOBXML_LOADER_SERVICE=com.ibm.jbatch.container.services.impl.DirectoryJobXMLLoaderServiceImpl_
So @seckin206, can you please go back to that property value and see if it works. If not, collect the same trace? (Hopefully we have enough logging in this code for this to be useful. Let's give it a shot.)
FWIW, I'd gotten confused between the SPI properties and the JVM system properties.
As you see here:
the sequence is to configure with the properties files embedded in the JAR, then override with the SPI, then override again with the JVM props. In the SPI, we use shorter prop names, which has a logic to it.
And BTW, I didn't have any extra information in that SO post. I was just offering to help walk through it like we're doing now.
This issue is no longer valuable for me, I hope discussion so far can help the readers in future.
Hi,
How can I enable loading job XMLs from a directory? I know there are two versions of the XML loader, but I couldn't figure out how to do it using batch-service.properties