No query executed factory registered for 'sql' language

0

In my project there are some reports and graphs, using DynamicReports that work correctly on IDE Netbeans without any error. However, through the command line running the java -jar MinhaAplicação.jar jar this Exception : No query executer factory registered for the 'sql' language.

Exception in thread "AWT-EventQueue-0" net.sf.jasperreports.engine.JRRuntimeException: No query executer factory registered for the 'sql' language.
        at net.sf.jasperreports.engine.util.JRQueryExecuterUtils.getExecuterFactory(JRQueryExecuterUtils.java:114)
        at net.sf.jasperreports.engine.design.JRDesignDataset.queryLanguageChanged(JRDesignDataset.java:1163)
        at net.sf.jasperreports.engine.design.JRDesignDataset.setQuery(JRDesignDataset.java:630)
        at net.sf.jasperreports.engine.design.JasperDesign.setQuery(JasperDesign.java:791)
        at net.sf.dynamicreports.jasper.transformation.ReportTransform.transform(ReportTransform.java:90)
        at net.sf.dynamicreports.jasper.base.JasperReportDesign.transform(JasperReportDesign.java:98)
        at net.sf.dynamicreports.jasper.base.JasperReportDesign.<init>(JasperReportDesign.java:77)
        at net.sf.dynamicreports.jasper.base.JasperReportDesign.<init>(JasperReportDesign.java:69)
        at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toJasperReportDesign(JasperReportBuilder.java:260)
        at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.getJasperParameters(JasperReportBuilder.java:287)
        at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toJasperPrint(JasperReportBuilder.java:298)
        at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.show(JasperReportBuilder.java:332)
        at view.GraficosView1.jButtonValorPerActionPerformed(GraficosView1.java:2513)
        at view.GraficosView1.access$2900(GraficosView1.java:89)
        at view.GraficosView1$42.actionPerformed(GraficosView1.java:1134)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$500(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

Code snippet for graph generation where Exception occurs:

try {
            JasperReportBuilder report = DynamicReports.report();
            configReportPortrait(report);
            Properties properties = new Properties();
            properties.put(
                    "net.sf.jasperreports.query.executer.factory.sql",
                    "net.sf.jasperreports.engine.query.JRJdbcQueryExecuterFactory");
            report.setProperties(properties);
            report.pageHeader(cmp.horizontalList()
                    .add(cmp.text("Período:").setFixedDimension(40, 10)).add(cmp.text(jTDataInicial.getText()).setFixedDimension(50, 10)).add(cmp.text("-").setFixedDimension(10, 10)).add(cmp.text(jTDataFinal.getText()).setFixedDimension(50, 10))
                    .newRow()
                    .add(cmp.filler().setStyle(stl.style().setTopBorder(stl.pen2Point())).setFixedHeight(10)));
            report.columns(infracao, soma, count, per)
                    .title(Template.createTitleComponent("Valores e Quantidade"))
                    .summary(cmp.multiPageList()
                            .add(cmp.verticalGap(25), chart1.setDataSource(queryFinal, con), cmp.verticalGap(25), chart2.setDataSource(queryFinal, con),
                                    cmp.verticalGap(25), chart3.setDataSource(queryFinal, con)))
                    .summaryWithPageHeaderAndFooter();
            addPageFooterPortrait(report)
                    .setDataSource(queryFinal, con)
                    .show(false);

        } catch (DRException ex) {
            Logger.getLogger(GraficosView1.class.getName()).log(Level.SEVERE, null, ex);
        }

Dependencies:

Excerptfrompomtogeneratejarwithdependencies:

<?xmlversion="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.rodrigo</groupId>
    <artifactId>SGInf</artifactId>
    <version>1.0.-SNAPSHOT</version>
    <packaging>jar</packaging>
    <build>
        <plugins>
         <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>view.Principal</mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id> <!-- this is used for inheritance merges -->
                    <phase>package</phase> <!-- bind to the packaging phase -->
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        </plugins>
    </build>

Thanks for any help to resolve this issue by being able to generate the graphics through the jar project file.

I found this post, but I can not comment to see if the author has been able to resolve it. link

    
asked by anonymous 30.05.2016 / 19:01

1 answer

0

I was able to resolve using the information contained here: link . More specifically, instead of using Apache Maven Assembly Plugin I used Spring Boot Maven plugin , adding this code snippet to my pom and then through the command line: mvn install .

<plugin>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-maven-plugin</artifactId>
    <version>1.3.5.RELEASE</version>
  <executions>
    <execution>
      <goals>
        <goal>repackage</goal>
      </goals>
      <configuration>
        <classifier>spring-boot</classifier>
        <mainClass>view.Principal</mainClass>
      </configuration>
    </execution>
  </executions>
</plugin>

In this way I was able to generate graphs and reports without errors through the file jar .

    
01.06.2016 / 08:12