Jasperreport dependencies error

Asked

Viewed 267 times

1

I use Netbeans. In my Maven I have this dependency for Jasperreport:

<dependency>
         <groupId>net.sf.jasperreports</groupId>
         <artifactId>jasperreports</artifactId>
         <version>5.0.1</version>
 </dependency>

But it turns out that I build . jar with the included libraries, then when I run the system gives this error message:

Error: a JNI error has occurred please check your installation and try again

It only happens when I include Jasperreport dependencies and only in .jar. Direct error does not occur in Netbeans....

----------------------- EDIT -----------------------

My pom.xml:

<?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.softcom</groupId>
    <artifactId>AtendimentoCliente</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>

    <dependencies>

        <!-- JUnit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <!-- Jaybird -->
        <dependency>
            <groupId>org.firebirdsql.jdbc</groupId>
            <artifactId>jaybird-jdk18</artifactId>
            <version>2.2.9</version>
        </dependency>

        <!-- JasperReport -->
        <dependency>
             <groupId>net.sf.jasperreports</groupId>
             <artifactId>jasperreports</artifactId>
             <version>5.5.2</version>
        </dependency>

    </dependencies>


    <build>
        <finalName>AtendimentoCliente</finalName>
        <plugins>
            <!-- Compiler -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>forms.FormConsultaSac</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>  

        </plugins>
    </build>
</project>

I put this plugin, because if I let it go, Netbeans does not generate . jar with dependencies, even right-clicking on the project and having built with dependencies.

I deleted all the . jar from the Maven repository, then he downloaded it all again. The dependencies that were downloaded for my project are these:

Imagem das dependências

Even by deleting the dependencies and downloading again the error continued. And the error happens only in . jar, direct in Netbeans works...

Can it be this plugin? I tried to delete it, but as I said before, if I delete, Netbeans generates the . jar without the dependencies

  • It looks like the . jar is corrupted, already tried to delete the lib in the Maven folder and download again?

  • I’ve tried, yes, keep up the mistake...

  • Are you sure you don’t have a more detailed exception? Try increasing the log level to DEBUG.

  • One more thing: some plugins allow you to modify classes and packages when generating the Ubber jar. This can also cause this kind of problem. Another factor may be that when assembling the JAR some classes are overwritten by different versions, while in your Netbeans by chance the right version is being loaded. Look for version conflict in the dependency tree. Jasper often has many dependencies and maybe the solution is to delete some of them.

No answers

Browser other questions tagged

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