jboss7.xdynamic-jasperjboss-modules

How to implement Dynamic Jasper as JBoss AS 7.2 Static Module?


I have successfully implemented Jasper Report as module but I failed several times when implementing DynamicJasper.

I am trying this implementation with JBoss AS 7.2, Linux CentOS kernel 2.6.32-431.el6.x86_64, and Java 1.7

Below is the module.xml I have created

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="other.tool.dynamicJasper">
  <resources>
    <resource-root path="DynamicJasper-5.0.11.jar"/>
  </resources>
  <dependencies>
    <module name="net.sf.jasper.reports"/>
    <module name="org.apache.commons.logging" />
    <module name="org.apache.commons.collections" />
    <module name="org.apache.commons.beanutils" />
    <module name="org.eclipse.jdt" export="true"/>
    <module name="com.lowagie.itext" />
    <module name="org.apache.poi" />
    <module name="org.apache.commons.digester" />
    <module name="org.jfree.chart" />
    <module name="javax.api"/>
    <system export="true">
      <paths>
        <path name="net/sf/jasper/reports"/>
      </paths>
    </system>
  </dependencies>
  <properties>
    <property name="net.sf.jasperreports.compiler.keep.java.file" value="true"/>
    <property name="net.sf.jasperreports.compiler.classpath" value="/usr/share/jboss-as-7-new/modules-agci/net/sf/jasper/reports/main/jasperreports-5.2.0.jar"/>
  </properties>
</module>

This is the module.xml for Jasper Report

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="net.sf.jasper.reports">
  <resources>
    <resource-root path="jasperreports-5.2.0.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="org.apache.commons.logging"/>
    <module name="org.apache.commons.collections"/>
    <module name="org.apache.commons.digester"/>
    <module name="org.apache.commons.beanutils"/>
    <module name="org.eclipse.jdt" export="true"/>
    <module name="net.sf.jasper.reports.fonts" export="true"/>
    <module name="com.lowagie.itext"/>
    <module name="other.fonts.arial"/>
    <module name="other.fonts.times"/>
  </dependencies>
  <properties>
    <property name="net.sf.jasperreports.compiler.keep.java.file" value="true"/>
    <property name="net.sf.jasperreports.compiler.classpath" value="/usr/share/jboss-as-7-new/modules-agci/net/sf/jasper/reports/main/jasperreports-5.2.0.jar"/>
  </properties>
</module>

The error message I always get is

Errors were encountered when compiling report expressions class file:
/usr/share/jboss-as-7-new/DJR_9154_1554455135225_288300.java:4: error: package net.sf.jasperreports.engine does not exist

When I monitored it with top, I saw javac has been executed.


Solution

  • Eventually, I have succeeded finding the answer. The root cause is a conflict created by jasper-compiler-jdt-5.5.15.jar with ecj-3.7.2.jar from module org.jboss.as.web.

    The solution is

    The revision of org.jboss.as.web is

    <resources>
      <resource-root path="jboss-as-web-7.2.0.Final.jar" />        
      <resource-root path="jbossweb-7.2.0.Final.jar" />        
      <resource-root path="eclipse-combined-jdt-1.0.0.jar" />
    </resources>
    

    The revision of net.sf.jasper.reports is

        <dependencies>
          <module name="javax.api"/>
          <module name="org.apache.commons.logging"/>
          <module name="org.apache.commons.collections"/>
          <module name="org.apache.commons.digester"/>
          <module name="org.apache.commons.beanutils"/>
          <module name="net.sf.jasper.reports.fonts" export="true"/>
          <module name="com.lowagie.itext"/>
          <module name="other.fonts.arial"/>
          <module name="other.fonts.times"/>
          <module name="org.jfree.chart"/>
          <module name="org.jboss.as.web">
            <imports>
              <include-set>
                <path name="org/eclipse/jdt/internal/compiler" />
              </include-set>
            </imports>
          </module>
        </dependencies>