Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7547085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:21:47+00:00 2026-05-30T09:21:47+00:00

So here is my source code : import com.jaspersoft.mongodb.MongoDbConnection; import com.jaspersoft.mongodb.MongoDbDataSource; import java.io.File; import

  • 0

So here is my source code :

import com.jaspersoft.mongodb.MongoDbConnection;
import com.jaspersoft.mongodb.MongoDbDataSource;
import java.io.File;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;

public class Generate {

    public static void main(String[] args) throws UnknownHostException {
        try {
            // - Connexion à la base
            String mongoURI = "mongodb://localhost/test";
            MongoDbConnection connection = null;

            Map<String, Object> parameters = new HashMap<String, Object>();
            try {
                connection = new MongoDbConnection(mongoURI,null,null);
                parameters.put(MongoDbDataSource.CONNECTION, connection);
                JasperDesign jasperDesign = JRXmlLoader.load("/home/test/gocoffee.jrxml");
                JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
                File jasperFile;
                jasperFile = new File("/home/test/MongoDbReport.jasper");
                JasperCompileManager.compileReportToFile("/home/test/gocoffee.jrxml", "/home/test/MongoDbReport.jasper");
                JasperFillManager.fillReportToFile("/home/test/MongoDbReport.jasper", parameters);               
                JasperExportManager.exportReportToPdfFile("/home/test/MongoDbReport.jrprint");
            } catch(Exception e) {
            }
        } catch (Exception e) {
            e.printStackTrace();
        } 
    }
}

Mongo is running.
I have gocoffee.jrxml in my folder named “test” and when I compile I get BUILD SUCCESSFUL but no pdf file appears in my “test” folder.

Interesting fact : if i do a

System.out.print("123");

after this line :

JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);

It doesn’t work.

(I just fixed this error before this one. Maybe its related)

Thanks !

Ps: mdahlman you are awesome

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:21:49+00:00Added an answer on May 30, 2026 at 9:21 am

    A report working in iReport but failing in your application that uses JasperReports probably means that you’re missing the query executer. Create jasperreports.properties (or edit your existing one), make sure it’s on the classpath, and add this line:

    net.sf.jasperreports.query.executer.factory.MongoDbQuery=com.jaspersoft.mongodb.MongoDbQueryExecuterFactory
    

    Note1: You should look at the working unit test (which uses this idea) in the source that’s posted to jasperforge. That really ought to have all that you need.

    Note2: We recently figured out that it’s a hassle to have to do this, so we updated the connector to have a copy of jasperreports_extension.properties which performs the same role. But then it’s included in the connector .jar file, so you don’t have to worry about it. That will be posted soon.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

you can view full source code here dpaste.com/hold/167199 Error: delete() takes exactly 2 arguments
I was advised to look here: http://exampledepot.com/egs/javax.crypto/DesFile.html for the source code of encryption/decryption using
Here is source code: @OneToOne(fetch = FetchType.LAZY) @Cascade({SAVE_UPDATE, EVICT, DELETE}) @JoinColumn(name = A_ID, nullable
I have an application I need to analyze. I have the source code here.
I am trying to install MySQLdb package. I found the source code here .
Here's the relevant bit of the source code: class Dice { String name ;
I'm building a python application from some source code I've found Here I've managed
Edit: You can get the full source here: http://pastebin.com/m26693 Edit again: I added some
Here is source code for multithreaed server and client in python. In the code
I've downloaded the android source code for CallLog, Contacts, Dialing from here . But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.