GeneratePDF with JasperReport Library and MongoDB
       
Here is my GeneratePdf.java 

    Import ...

      public class GeneratePdf {
    
            public static void main(String[] args) {
    
            try {
                
                
                JRDataSource ds = getDatasource();
                // - Chargement et compilation du rapport
                JasperDesign jasperDesign = JRXmlLoader.load("/home/gocoffee.jrxml");
                JasperReport jasperReport =           JasperCompileManager.compileReport(jasperDesign);
    
                // - Paramètres à envoyer au rapport
                Map parameters = new HashMap();
                parameters.put("Titre", "Titre");
    
                // - Execution du rapport
                JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
    parameters, ds);
    
                // - Création du rapport au format PDF
                JasperExportManager.exportReportToPdfFile(jasperPrint, "home/test2.pdf");
            } catch (JRException e) {
            }
        }
    
 Mongo connection and get data () :      

    private static JRDataSource getDatasource() {
    
            // Retrieve session
    
      
            try{


                Mongo m = new Mongo("localhost", 27017);
                DB db = m.getDB("test");
                DBCollection t = db.getCollection("test");
                List<DBObject> list = t.getIndexInfo();
                JRDataSource ds = new JRBeanCollectionDataSource(list);
                return ds;
            } catch (UnknownHostException e) {
                System.out.println("Error mongo connection");
            } catch (Exception e) {
                System.out.println("Other Exception");
            }
            
            return null;
            
    
        }
        
    }

I have BUILD SUCCESSFULL but the .pdf file doesnt appear in "home/"
And the gocoffee.jrxml is in "/home/gocoffee.jrxml"

Why ?

Thanks


PS:Oops! Your question couldn't be submitted because:

    Your post does not have much context to explain the code sections; please explain your scenario more clearly.

Oops! Your question couldn't be submitted because:

    Your post does not have much context to explain the code sections; please explain your scenario more clearly.

Oops! Your question couldn't be submitted because:

    Your post does not have much context to explain the code sections; please explain your scenario more clearly.

Oops! Your question couldn't be submitted because:

    Your post does not have much context to explain the code sections; please explain your scenario more clearly.



     


GeneratePDF with JasperReport Library and MongoDB
===

       
Here is my GeneratePdf.java 

    Import ...

      public class GeneratePdf {
    
            public static void main(String[] args) {
    
            try {
                
                
                JRDataSource ds = getDatasource();
                // - Chargement et compilation du rapport
                JasperDesign jasperDesign = JRXmlLoader.load("/home/gocoffee.jrxml");
                JasperReport jasperReport =           JasperCompileManager.compileReport(jasperDesign);
    
                // - Paramètres à envoyer au rapport
                Map parameters = new HashMap();
                parameters.put("Titre", "Titre");
    
                // - Execution du rapport
                JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
    parameters, ds);
    
                // - Création du rapport au format PDF
                JasperExportManager.exportReportToPdfFile(jasperPrint, "home/test2.pdf");
            } catch (JRException e) {
            }
        }
    
 Mongo connection and get data () :      

    private static JRDataSource getDatasource() {
    
            // Retrieve session
    
      
            try{


                Mongo m = new Mongo("localhost", 27017);
                DB db = m.getDB("test");
                DBCollection t = db.getCollection("test");
                List<DBObject> list = t.getIndexInfo();
                JRDataSource ds = new JRBeanCollectionDataSource(list);
                return ds;
            } catch (UnknownHostException e) {
                System.out.println("Error mongo connection");
            } catch (Exception e) {
                System.out.println("Other Exception");
            }
            
            return null;
            
    
        }
        
    }

I have BUILD SUCCESSFULL but the .pdf file doesnt appear in "home/"
And the gocoffee.jrxml is in "/home/gocoffee.jrxml"

Why ?

Thanks


PS:Oops! Your question couldn't be submitted because:

    Your post does not have much context to explain the code sections; please explain your scenario more clearly.

Oops! Your question couldn't be submitted because:

    Your post does not have much context to explain the code sections; please explain your scenario more clearly.

Oops! Your question couldn't be submitted because:

    Your post does not have much context to explain the code sections; please explain your scenario more clearly.

Oops! Your question couldn't be submitted because:

    Your post does not have much context to explain the code sections; please explain your scenario more clearly.



     

