How to run a report using Rest_v2 and java


I'm new in the JasperReport community.

I've been using this solution for 3 weeks. I first used iReport to creat my reports and JasperReport Server to run and schedule them but my compagny want to use this solution in their own application.

So I tried to developped a solution using java and rest. I can run a report and it works.

But we need to use rest_v2 in our application because we need to be able to get the statut of a report (when scheduling) and I can't make it run.

It works when I just put the URL in FireFox but when I use a little programm in java to run it, I get a 403 forbidden error even if the programm (almost the same one) works with Rest (v1).


Here is an example of my really little programm to run with Rest_v2 a report :


public class Get_Rapport {
    public static void main(String[] args) throws Exception {
        CredentialsProvider credsProvider = new BasicCredentialsProvider();
                new AuthScope("localhost", 8080),
                new UsernamePasswordCredentials("jasperadmin", "jasperadmin"));
        CloseableHttpClient httpclient = HttpClients.custom()
        try {
            HttpGet httpget = new HttpGet("http://localhost:8080/jasperserver/rest_v2/reports/reports/samples/Essai...");
            System.out.println("executing request" + httpget.getRequestLine());
            CloseableHttpResponse response = httpclient.execute(httpget);

  } finally {



It would be really nice to explain me what's wrong, cause I really don't get it :(

I'm a student and that's the topic ofmy placement so I have to find a way to do it...



jbgauche57's picture
Joined: May 21 2013 - 12:23am
Last seen: 9 years 5 months ago

2 Answers:

Please ...

Can you help me ?


Do someone has an example of runing a report with Rest_v2 in Java if you don't know the issue i'm facing ?


Thanks :)

jbgauche57's picture
Joined: May 21 2013 - 12:23am
Last seen: 9 years 5 months ago
Thomas Zimmer's picture
Joined: Oct 2 2012 - 1:35am
Last seen: 1 week 1 day ago