开发者

Getting java.lang.NoSuchMethodError exception when using GWT + JasperReports

I have integrated JasperReports on my NetBeans platform and I am able to generate reports using the following code:

Map<String, Object> params = new HashMap<String, Object>();
Connection conn = DriverManager.getConnection("databaseUrl", "userid", "password");
JasperReport jasperReport = JasperCompileManager.compileReport(reportSource);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, conn);
JasperExportManager.exportReportToHtmlFile(jasperPrint, reportDest);
JasperViewer.viewReport(jasperPrint);

This stuff works perfect.

But not I'm trying to integrate JasperReports with GWT. I have my server as GlassFish server.

I am getting the Connection object using the followind code:

public static Connection getConnection() {
    try {
        String JNDI = "JNDI name";
        InitialContext initCtx = new InitialContext();
        javax.sql.DataSource ds = (javax.sql.DataSource) initCtx.lookup(JNDI);
        Connection conn = (Connection) ds.getConnection();
        return conn;
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return null;
}

and then

Map<String, Object> params = new HashMap<String, Object>();
JasperReport jasperReport = JasperCompileManager.compileReport(reportSource);
JasperPrint jasperPrint = JasperFillManager.fil开发者_C百科lReport(jasperReport, params, getConnection());
JasperExportManager.exportReportToHtmlFile(jasperPrint, reportDest);
JasperViewer.viewReport(jasperPrint);

but i always get an Error. Here is a stacktrace:

com.google.gwt.user.server.rpc.UnexpectedException: 
Service method 'public abstract java.lang.Boolean com.client.service.GenerateReport()'
threw an unexpected exception: java.lang.NoSuchMethodError: 
net.sf.jasperreports.engine.fonts.SimpleFontFamily.setExportFonts(Ljava/util/Map‌​);

I am implementing this on Server. I am having RPC calls to get this method to work when a button is clicked.

Can you please help me how to work on this. (That is to integrate JasperReports with GWT).

I would highly appreciate any explanation with some code as i am just a beginner.

Thanks


Without the aid of error messages, I would say that you have Google App Engine enabled in your eclipse project preferences. GAE does NOT allow you to write to the file system, or make calls to a database.

Try disabling GAE, and things should work fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜