Jump to content
We've recently updated our Privacy Statement, available here ×

Default properties file not found


VMASTER

Recommended Posts

Hi,

 

when i use this code

Code:

JasperPrint jasperPrint2 = JasperFillManager.fillReport(jasperReport4, reportParam, jdbcConnection);

 

the result is :

Code:
[code]
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:400)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:59)
at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:57)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
at ReportDriver2.runReport(ReportDriver2.java:134)
at ReportDriver2.main(ReportDriver2.java:257)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Error loading the propertiesDefault properties file not found trovato Default
properties file not found
at net.sf.jasperreports.engine.util.JRProperties.initProperties(JRProperties.java:183)
at net.sf.jasperreports.engine.util.JRProperties.<clinit>(JRProperties.java:150)
... 8 more
Caused by: net.sf.jasperreports.engine.JRException: Default properties file not found
at net.sf.jasperreports.engine.util.JRProperties.getDefaults(JRProperties.java:219)
at net.sf.jasperreports.engine.util.JRProperties.initProperties(JRProperties.java:160)
... 9 more
Java Result: 1

 

I placed the files default.jasperreports.properties in the folder src project but can not find

 

I changed the file JRProperties in this way:

Code:
[code]
String curDir = System.getProperty("user.dir"«»);
System.out.println("nIn questo momento ti trovi nella directory:"«»);
System.out.println(" - " + curDir);



String files=curDir+"/default.jasperreports.properties";
System.out.println(" - " + files);
InputStream is = JRProperties.class.getResourceAsStream(files);

 

but not find the file!

 

why?

Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

VMASTER wrote:

I changed the file JRProperties in this way:
...
but not find the file!

 

Why would you change JRProperties? default.jasperreports.properties is placed inside the JasperReports jar, you don't need to change any JR source files for the default properties to be found.

 

Regards,

Lucian

Link to comment
Share on other sites

lucianc wrote:

 

Why would you change JRProperties? default.jasperreports.properties is placed inside the JasperReports jar, you don't need to change any JR source files for the default properties to be found.

 

Regards,

Lucian

 

 

because I downloaded the sources and I am trying to make it work without the jar :P

 

however, the file .properties does not find :(

Link to comment
Share on other sites

VMASTER wrote:

because I downloaded the sources and I am trying to make it work without the jar :P

 

You should just place defaults.jasperreports.properties on your application's classpath.

 

however, the file .properties does not find

 

Since you've changed the JRProperties source code, I'm afraid I can't tell you why it doesn't work.

Link to comment
Share on other sites

You should just place defaults.jasperreports.properties on your application's classpath.

 

ok! done

 

 

Since you've changed the JRProperties source code, I'm afraid I can't tell you why it doesn't work.

 

I reloaded the original file but does not work equally

:(

Link to comment
Share on other sites

lucianc wrote:

VMASTER wrote:
I reloaded the original file but does not work equally

 

As I don't know what exactly you are doing, I'm going to need a detailed test case to reproduce your problem.

 

ok , I executed the following steps :

1) download source from sourceforge

2) insert all files in a netbeans project

3) import all jar that jasper require

4) run this code :

 

Code:

public void runReport(String databaseName, String userName, String password, String reportFile, String empID) {


try {


String report = reportFile;
HashMap reportParam = new HashMap();
reportParam.put("EMPID", empID);



Connection jdbcConnection = connectDB(databaseName, userName, password);


File sourceFile = new File(report);

JasperReport jasperReport4 = (JasperReport) JRLoader.loadObject(sourceFile);



JasperPrint jasperPrint2 = JasperFillManager.fillReport(jasperReport4, reportParam, jdbcConnection);





int lar = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth();
int alt = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();
myJRViewer jrv = new myJRViewer(jasperPrint2);
jrv.setPreferredSize(new Dimension(lar - 50, alt - 50));







JScrollPane reportScroll = new JScrollPane(jrv);


JPanel viewer = new JPanel();
viewer.add(reportScroll);


JFrame finestra = new JFrame();
finestra.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
finestra.setTitle("STAMPA - ASTER SOFTWARE"«»);
finestra.add(viewer);
finestra.pack();
finestra.setVisible(true);
finestra.repaint();
System.out.println("5"«»);



System.exit(0);
} catch (Exception ex) {
String connectMsg = "Could not create the report " + ex.getMessage() + "n " + ex.toString() + "n" + ex.getCause() + "n" + ex.fillInStackTrace();
System.out.println(connectMsg);
}

}

 

5) this is the result

Code:
[code]
Exception in thread "main" java.lang.ExceptionInInitializerError

at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:400)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:59)

at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147)

at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:57)

at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)

at ReportDriver2.runReport(ReportDriver2.java:134)

at ReportDriver2.main(ReportDriver2.java:257)

Caused by: net.sf.jasperreports.engine.JRRuntimeException: Error loading the propertiesDefault properties file not found trovato Default

properties file not found

at net.sf.jasperreports.engine.util.JRProperties.initProperties(JRProperties.java:183)

at net.sf.jasperreports.engine.util.JRProperties.<clinit>(JRProperties.java:150)

... 8 more

Caused by: net.sf.jasperreports.engine.JRException: Default properties file not found

at net.sf.jasperreports.engine.util.JRProperties.getDefaults(JRProperties.java:219)

at net.sf.jasperreports.engine.util.JRProperties.initProperties(JRProperties.java:160)

... 9 more

Java Result: 1
Link to comment
Share on other sites

lucianc wrote:

You said you put default.jasperreports.properties on the application classpath. How exactly did you do that?

 

 

I found the file default.jasperreports.properties inside jar (source) and I inserted in application classpath (c:myprojectsrc) with a simple copy and paste

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...