Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduled Jasper Server Job isn't passing parameters #82

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

paawak
Copy link

@paawak paawak commented May 23, 2015

We are using the jrs-rest-java-client, version 5.5.0 (https://github.com/Jaspersoft/jrs-rest-java-client ) to schedule a
Job on the Jasper (Tomcat) Server. The problem is, though the job is created on the server, the report parameters are
all null.

This is the client code:

private Session clientSessionForAsynchronousRequest;

private void scheduleJob(String reportUri, Map parameters) {
Job job = new Job();
job.setLabel("New Job for ISS Report");
job.setDescription("New Job for the report template: " + reportUri);
JobSource jobSource = new JobSource();
jobSource.setReportUnitURI(reportUri);

jobSource.setParameters(new HashMap(parameters));
job.setSource(jobSource);
Set outputFormats = new HashSet();
outputFormats.add(OutputFormat.PDF);
outputFormats.add(OutputFormat.XLSX);
job.setOutputFormats(outputFormats);
RepositoryDestination repositoryDestination = new RepositoryDestination();
repositoryDestination.setSaveToRepository(true);
repositoryDestination.setFolderURI("/scheduled_reports");
job.setRepositoryDestination(repositoryDestination);
SimpleTrigger trigger = new SimpleTrigger();
trigger.setStartType(SimpleTrigger.START_TYPE_NOW);
trigger.setOccurrenceCount(1);
trigger.setRecurrenceInterval(0);
trigger.setRecurrenceIntervalUnit(IntervalUnitType.DAY);
job.setTrigger(trigger);
job.setBaseOutputFilename("portiss_report" + System.currentTimeMillis());

clientSessionForAsynchronousRequest.jobsService().scheduleReport(job);

}

However, we have a bad work-around, by changing the JobsService in jrs-rest-java-client. The above code works if I replace:

long jobId = clientSessionForAsynchronousRequest.jobsService().scheduleReport(job);

With:
long jobId = clientSessionForAsynchronousRequest.jobsService().scheduleReportWithHack(job);
// long jobId = clientSessionForAsynchronousRequest.jobsService().scheduleReport(job);

Also, I have forked the project on git-hub, and you will find my changes here:
https://github.com/paawak/jrs-rest-java-client

Thanks,
Palash.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 78.04% when pulling 3f30927 on paawak:master into 77a1145 on Jaspersoft:master.

@TanyaEf
Copy link
Contributor

TanyaEf commented Nov 10, 2015

The bug can not be reproduced on the latest version of client (6.1.4). Please, try this version and reopen the issue.

@yaroslav-kovalchyk
Copy link
Contributor

Thanks for pointing to the issue. We fixed it in a bit another way. Please try the latest release version and fill free to reopen an issue if something doesn't work.

@paawak
Copy link
Author

paawak commented Feb 17, 2016

Tried with 6.2.2. The issue persists. The job is created with the parameters set to null.

Thanks,
Palash.

@TanyaEf TanyaEf reopened this Feb 19, 2016
@tishabarker
Copy link

This is still an issue in 6.3.1. How do I get around this problem?

@jngps
Copy link

jngps commented Nov 29, 2017

clientSessionForAsynchronousRequest.jobsService().scheduleReportWithHack(job)
Consider above code,
In my application I did find scheduleReportWithHack(job) method.Please tell me how do I pass parameters to the Scheduled Job
Regrads
Satish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants