samedi 30 janvier 2016

Java org.sqlite.jdbc not found exception

I have a problem with executing my maven-java program outside of NetBeans. The program uses a SQLite database, so I added the maven-dependency for it

    <dependency>
        <groupId>org.xerial</groupId>
        <artifactId>sqlite-jdbc</artifactId>
        <version>3.8.11.2</version>
    </dependency>

Now, if I execute the program inside of NetBeans, everything works fine. But as soon as I export the jar-file and execute it, I get this error:

C:\Users\benes\Desktop>java -jar DataConverter-1.0.jar
JΣn 30, 2016 7:23:02 PM repository.DbController initDBConnection
SEVERE: null
java.lang.ClassNotFoundException: org.sqlite.JDBC
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at repository.DbController.initDBConnection(DbController.java:50)
    at repository.DbController.<init>(DbController.java:36)
    at repository.DbController.getInstance(DbController.java:44)
    at repository.Repository.initialize(Repository.java:55)
    at repository.Repository.<init>(Repository.java:45)
    at repository.Repository.getInstance(Repository.java:50)
    at rs232emulator.RS232Emulator.main(RS232Emulator.java:19)



Exception in thread "main"java.lang.RuntimeException:
java.sql.SQLException:The url cannot be null
    at repository.DbController.initDBConnection(DbController.java:63)
    at repository.DbController.<init>(DbController.java:36)
    at repository.DbController.getInstance(DbController.java:44)
    at repository.Repository.initialize(Repository.java:55)
    at repository.Repository.<init>(Repository.java:45)
    at repository.Repository.getInstance(Repository.java:50)
    at rs232emulator.RS232Emulator.main(RS232Emulator.java:19)
Caused by: java.sql.SQLException: The url cannot be null
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at repository.DbController.initDBConnection(DbController.java:58)
    ... 6 more

Thanks in advance, Benedikt

Aucun commentaire:

Enregistrer un commentaire