No query Executer Factory Registered for 'sql' language

Asked

Viewed 174 times

0

In my project there are some reports and graphics, using DynamicReports which function properly in the IDE Netbeans without any mistake. But through the command line running the jar java -jar MinhaAplicação.jar happens 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 the Exception:

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:

inserir a descrição da imagem aqui

Excerpt from pom to generate the jar dependency:

<?xml version="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>

I appreciate any help to resolve this issue can generate the graphics through the file jar of the project.

I found this post, but I can’t comment to see if the author has solved. https://stackoverflow.com/questions/32249910/no-query-executer-factory-registered-for-sql-language

  • I changed the version of JasperReports for 6.2.2 and resolved the Exception : No query executer factory registered for the 'sql' language,but there was another: Exception in thread "AWT-EventQueue-0" Exception in thread "AWT-EventQueue-0".&#xA;Exception: net.sf.jasperreports.engine.JRRuntimeException thrown from the UncaughtExceptionHandler in thread "AWT-EventQueue-0"

1 answer

0

I managed to solve using the information contained here: http://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-maven-plugin.html. More specifically instead of using the Apache Maven Assembly Plugin I used the Spring Boot Maven plugin, adding this snippet of code 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 managed to generate the graphs and reports without errors through the file jar.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.