How to use i-net Clear-Reports as library in an application server?

There are two modes how you can use i-net Clear-Reports:

  • The plugin mode (default)
  • The library mode

The default mode is the plugin mode. Any features can be added using plugins (https://docs.inetsoftware.de/reporting/help/platform-programming-guide-plugins). The plugin mode provides all features of i-net Clear Reports including the web interface. With this mode you can use the API and the web interface with the same i-net Clear Reports servlet.
To use the API in the plugin mode it will be necessary to implement your own plugin. The SDK (https://download.inetsoftware.de/clear-reports-sdk-latest.zip) includes samples plugins.

For historical reasons, you can use i-net Clear-Reports also as a simple library (library mode). In this library mode you can use the reporting API directly from your application server logic. But you can not use the web interface of the i-net Clear Reports servlet.
For new developments we recommended to use the plugin mode. But there is currently no plan to stop the support the library mode in the future.

How it works?

Both modes can works with plugins. But the library mode can also initialize the reporting plugin from an extracted plugin which was added directly to the classpath. The difference is the different start point.
For the library mode the start point must be com.inet.report.Engine.
For the plugin mode the start point is com.inet.http.PluginDispatcherServlet.

Steps to use the library mode:

  • The start point is the referenced WAR file which you can download from our website (https://download.inetsoftware.de/clear-reports-war-latest.zip)
  • Open the reporting.zip plugin and extract the file reporting.jar. Also extract jcommon.jar and jfreechartCC.jar if you want to use charts in your rerports
  • Remove the reporting.zip from the plugins directory. It will be fatal if the are two instances of the same API
  • Remove all not needed plugins. The most plugins add a web GUI component which not work in the library mode. Removing unused plugins can improve the performance
  • Remove all from the web.xml. If you want render reports via HTTP then you can add com.inet.report.servlets.ReportPluginServlet to the web.xml
  • Add the code snippet: new com.inet.report.Engine( EXPORT_PDF ) in your init method to trigger the initializing of i-net Clear-Reports

Errors and causes

  • java.lang.NoClassDefFoundError
    You have two instances of the reporting API. Remove the reporting.zip from the plugins directory

  • Licence for a another application: i-net Clear-Reports
    The reporting.zip plugin was removed but the first initializing occur not via “new com.inet.report.Engine( EXPORT_PDF )”. Check the web.xml. Did you removed any reference to com.inet.http.PluginDispatcherServlet ?