Problem Description:
You may be getting the following NPE when scheduling a job on v7.9.0 using REST_V2 API with XML body. This job used to work on v6.4.2
PUT http://<host>:<port>/jasperserver[-pro]/rest_v2/jobs/
<?xml version="1.0" encoding="UTF-8" ?>
<job>
<baseOutputFilename>ABC</baseOutputFilename>
<repositoryDestination>
<folderURI>/public</folderURI>
<outputDescription>abc</outputDescription>
<overwriteFiles>true</overwriteFiles>
<sequentialFilenames>true</sequentialFilenames>
<saveToRepository>true</saveToRepository>
<usingDefaultReportOutputFolderURI>true</usingDefaultReportOutputFolderURI>
<outputLocalFolder>/public</outputLocalFolder>
</repositoryDestination>
<description>aaa</description>
<label>TEST REPORT</label>
<outputFormats>
<outputFormat>PDF</outputFormat>
</outputFormats>
<source>
<parameters>
<parameterValues>
<entry>
<key>user_id</key>
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">123</value>
</entry>
<entry>
<key>report_home</key>
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">home001</value>
</entry>
<entry>
<key>reportdate</key>
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:date">2021-09-11</value>
</entry>
</parameterValues>
</parameters>
<reportUnitURI>/public/abc</reportUnitURI>
</source>
<simpleTrigger>
<startType>1</startType>
<occurrenceCount>5</occurrenceCount>
<version>0</version>
<recurrenceInterval>1</recurrenceInterval>
<recurrenceIntervalUnit>MINUTE</recurrenceIntervalUnit>
</simpleTrigger>
<version>1</version>
</job>
Solution:
Note the xsi:type of date.
<entry>
<key>reportdate</key>
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:date">2021-09-11</value>
</entry>
For v7.9.0, always use collection/string for any parameter datatype. For example,
<?xml version="1.0" encoding="UTF-8" ?> <job> <baseOutputFilename>RPT001_257023_41531_2008-09-30</baseOutputFilename> <repositoryDestination> <folderURI>/public</folderURI> <outputDescription>abc</outputDescription> <overwriteFiles>true</overwriteFiles> <sequentialFilenames>true</sequentialFilenames> <saveToRepository>true</saveToRepository> <usingDefaultReportOutputFolderURI>true</usingDefaultReportOutputFolderURI> <outputLocalFolder>/public</outputLocalFolder> </repositoryDestination> <description>aaa</description> <label>RPT001_257023_41531_2022-09-30</label> <outputFormats> <outputFormat>PDF</outputFormat> </outputFormats> <source> <parameters> <parameterValues> <entry> <key>rp_user_id</key> <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="collection"> <item xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">123</item> </value> </entry> <entry> <key>report_home</key> <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="collection"> <item xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">xxxhomexxx</item> </value> </entry> <entry> <key>rp_reportdate</key> <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="collection"> <item xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">2021-09-11</item> </value> </entry> </parameterValues> </parameters> <reportUnitURI>/public/RPT001</reportUnitURI> </source> <simpleTrigger> <startType>1</startType> <occurrenceCount>5</occurrenceCount> <version>0</version> <recurrenceInterval>1</recurrenceInterval> <recurrenceIntervalUnit>MINUTE</recurrenceIntervalUnit> </simpleTrigger> <version>1</version> </job> | |||
UPDATE: 10/4/2021 Unfortunately, this method does not work if you are calling reports that do not have input controls. Talk to your support representative to get the latest update regarding JS-63480. | |||
UPDATE: 1/19/2022 | |||
Solution: You can use the original v6.4.2 xml body and just do the following. That is, no need to change to xsi:type="collection" and xsi:type="string" as described above. a) Apply the following patch or later versions:
b) When executing the PUT call, set both Content Type and Accept to application/job.v1+xml. | |||
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now