1 Reply Latest reply on Dec 12, 2016 12:14 PM by Cheng Fang

    Writer is not able to create path for file

    Richard Moore Master

      The writer on my job is not able to create a new directory path. Part of the directory structure exists. If I create the directory so that the full path exists the file is created. Is there a way to do this on the fly? Below is the error and jsl.

       

      JBERET000007: Failed to run job Jberet_Adhoc_SqlTest, test, org.jberet.job.model.Chunk@23a71052

      javax.batch.operations.BatchRuntimeException: JBERET060000: Invalid reader or writer property value /awg/q1/app/data/tmp/XX/Jberet/Jberet_Adhoc_SqlTest.out for key resource

         at org.jberet.support.io.ItemReaderWriterBase.getOutputStream(ItemReaderWriterBase.java:191) ~[jberet-support-1.3.0.Beta3.jar:1.3.0.Beta3]

         at org.jberet.support.io.JacksonCsvItemWriter.open(JacksonCsvItemWriter.java:121) ~[jberet-support-1.3.0.Beta3.jar:1.3.0.Beta3]

         at org.jberet.runtime.runner.ChunkRunner.run(ChunkRunner.java:192) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

         at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:226) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

         at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:147) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

         at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:164) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

         at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

         at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:60) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

         at org.jberet.spi.JobExecutor$1.run(JobExecutor.java:99) [jberet-core-1.3.0.Beta3.jar:1.3.0.Beta3]

         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]

         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]

         at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]

      Caused by: java.io.FileNotFoundException: /awg/q1/app/data/tmp/XX/Jberet/Jberet_Adhoc_SqlTest.out (No such file or directory)

         at java.io.FileOutputStream.open0(Native Method) ~[?:1.8.0_111]

         at java.io.FileOutputStream.open(FileOutputStream.java:270) ~[?:1.8.0_111]

         at java.io.FileOutputStream.<init>(FileOutputStream.java:213) ~[?:1.8.0_111]

         at java.io.FileOutputStream.<init>(FileOutputStream.java:162) ~[?:1.8.0_111]

         at org.jberet.support.io.ItemReaderWriterBase.getOutputStream(ItemReaderWriterBase.java:181) ~[jberet-support-1.3.0.Beta3.jar:1.3.0.Beta3]

         ... 11 more

       

       

       

            <chunk>

               <reader ref="jdbcItemReader">

                  <properties>

                     <property name="dataSourceLookup" value="jdbc/db2"/>

                     <property name="sql" value="SELECT fclty_cd, fclty_ltr2_cd, fclty_nm, dw_fclty_ltr2_cd, current timestamp as current_ts FROM db2pdba.aim_fclty" />

                     <property name="beanType" value="java.util.Map" />

                  </properties>

               </reader>

               <writer ref="jacksonCsvItemWriter">

                  <properties>

                     <property name="resource" value="#{systemProperties['APP_DATA_TMP_FCLTY_SUBSYS']}/Jberet_Adhoc_SqlTest.out" />

                     <property name="writeMode" value="overwrite" />

                     <property name="columnSeparator" value="|" />

                     <property name="beanType" value="java.util.Map" />

                     <property name="useHeader" value="false" />

                     <property name="csvGeneratorFeatures" value="ALWAYS_QUOTE_STRINGS=false, STRICT_CHECK_FOR_QUOTING=true"/>

                     <property name="columns" value="FCLTY_CD STRING, FCLTY_LTR2_CD STRING, FCLTY_NM STRING, DW_FCLTY_LTR2_CD STRING, CURRENT_TS STRING" />

                  </properties>

               </writer>

            </chunk>