Announcement Announcement Module
No announcement yet.
#{jobParameters[' ']} on AIX Unix Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • #{jobParameters[' ']} on AIX Unix

    I have a job running fine when executed with CommandLineJobRunner on Windows. When I move this same job to an AIX platform and attempt to execute it through the CommandLineJobRunner, the jobParameters are not parsed correctly.

    Below is my step definition. I've printed out the values from within the ConvertRasmToPDF class when executing on AIX and the values for these properties are sent in as text. So parmEvent equals the String #{jobParameters['event']} within the program.

    Do I need to modify this step syntax when moving to AIX to have these parsed into their correct values instead of being taken as Strings??

    <bean id="processTasklet" scope="step"
    <property name="parmEvent" value="#{jobParameters['event']}" />
    <property name="parmFileType" value="#{jobParameters['fileType']}" />
    <property name="parmFileName" value="#{jobParameters['fileName']}" />
    <property name="parmSite" value="#{jobParameters['site']}" />
    <property name="parmComp" value="#{jobParameters['comp']}" />
    <property name="parmFund" value="#{jobParameters['fund']}" />
    <property name="parmReportNbr" value="#{jobParameters['reportNbr']}" />

  • #2
    Java (and Spring Batch) is not going to behave differently on AIX (hopefully). Most likely you are starting the job in a different way? Maybe the shell is different,and you need to escape something. I'm not really sure what you mean by "sent in as text" (all command line arguments are text), and it's not clear what you want it to be, but Spring will convert text to simple primitive types out of the box, so why would that be a problem? Maybe you could share the details of how you launch the job and/or look at the DefaultJobParametersConverter that is used in CommandLineJobRunner (and the javadocs for the runner) to see how the command line args are parsed into JobParameters?


    • #3

      what I meant by sent in as text is that when I specify this in the job xml:


      Then in my program in the setParmEvent() method I get the value


      So for some reason this String in the XML is not replaced by the actual value of the variable. We are executing this job in a korn script.

      I know the parameters are passed correctly because in my Tasklet program I can access the parameters programmatically. So this code provides the actual value I am looking for:

      public class ConvertRasmToPDF implements Tasklet {
      public RepeatStatus execute(StepContribution arg0, ChunkContext context)
      throws Exception {
      // collect job parameters
      this.setParmEventObj(context.getStepContext().getJ obParameters().get("event"));
      . . .

      Unfortunately this is not the ideal situation since I would have to write custom readers for all jobs instead of taking advantage of some of the provided readers such as the FlatFileItemReader.

      I haven't found any documentation discussing how to influence the #{jobParameters[]} syntax though. Perhaps on AIX or in the Korn scripts the # is interfering.


      • #4
        I see what you meant originally about the text value, but it still doesn't make a lot of sense. I don't see how the OS or shell can change your configuration at runtime. Are you sure the classpath is the same in both cases?


        • #5

          Yeah, I've validated and actually hard coded the classpath in the job to ensure it is the same. The only difference is it works running on Windows and does not on AIX.


          • #6
            So the command line must be different. What's in your ksh script?


            • #7
              job log

              I'm including a job log as I think it shows that the parameters are picked up correctly from the initiation of the job. It's just the reference to the #{jobParameters[]} that is failing. In this job I am looking for a parameter named 'fileName'.

              At this point it doesn't seem that the AIX Korn script should have any influence on the issue, since the job has been started and the default job parameter parsing appears to have worked correctly. I think this is proven in this line from the log:

              2010-10-03 16:19:37,014 INFO [ leJobLauncher] - <Job: [FlowJob: [name=rasmIAFConfigLoad]] launched with the following parameters: [{fileName=/home/afsjad/data/CSA.IAF.CONFIG.ACHIBOUND.csv,}]>

              Below is the definition of the reader where I am attempting to use the jobParameter to set the "resource" property:
              <bean id="reader" class="org.springframework.batch.item.file.FlatFil eItemReader" scope="step">
              <property name="lineMapper">
              <bean class="org.springframework.batch.item.file.mapping .DefaultLineMapper">
              <property name="lineTokenizer">
              <bean class="org.springframework.batch.item.file.transfo rm.DelimitedLineTokenizer">
              <property name="delimiter" value=","/>
              <property name="names" value="application,subApplication,fund,reportNumbe r,eventJobName,site,company,category,reportName,fr equency,retention,outputFormat,pageSize,orientatio n,limitAccessByDepartment,applyToChildren,csAuthor izationRegistryName,acl" />
              <property name="fieldSetMapper">
              <bean class="org.springframework.batch.item.file.mapping .BeanWrapperFieldSetMapper">
              <property name="targetType" value="com.aa.ta.iafdb.aadocumentimportconfigurati on.CsvAaDocumentImportConfiguration" />
              <property name="resource" value="file:#{jobParameters[fileName]}" />

              Is there some alternative way of referencing the jobParameters from within the Spring configuration XML?


              • #8
                What versions of Spring and Spring Batch are you using? What happens if you remove the file: prefix (so your value is a straight replacement of the placeholder)? What happens if you use quotes around the parameter key ('fileName')? What can you see in the logs if you switg on DEBUG for org.springframework.batch.core.scope?

                I still don't understand how this can be differen on Windows. That doesn't seem possible.


                • #9

                  file: is required in front of the parameter to get it to run correctly on Windows. without "file:" in front of the parameter then I get an org.springframework.batch.item.ItemStreamException . Removing "file:" makes no difference on AIX (i.e. still have the same issue of the non-parsed jobParameter).

                  I also added the single quotes around the parameter name ('fileName') and it makes no difference.

                  I am using Spring 3.0 and batch 2.1

                  I don't see much with debug turned on, but I've included the log again. NOTE that this run has the "file:" removed and the single quotes around 'fileName'.

                  And I agree, this is a very frustrating and unforeseen issue. I can't find any reason why AIX would be different from Windows in this situation.


                  • #10

                    This issue has been resolved by upgrading to Spring 3.0.4 and Spring Batch 2.1.3.