Ошибка в тестировании DynamoDBLocal: com.almworks.sqlite4 java .SQLiteException: [-91] не может загрузить библиотеку: java .lang.UnsatisfiedLinkError - PullRequest
1 голос
/ 13 марта 2020

Я мигрирую из проекта Gradle в проект Maven. Модульные тесты раньше работали в gradle, но теперь я получаю ошибку UnsatisfiedLinkError.

Мой build.gradle имеет -

task copyNativeDeps(type: Copy) {
    from (configurations.compile+configurations.testCompile) {
        include "*.dylib"
        include "*.dll"
        include "*.so"
    }
    into 'build/libs'
}

task unitTest(type: Test) {
    // Set up dependent native libraries (sqllite) for running local DynamoDB
    dependsOn copyNativeDeps
    systemProperty "java.library.path", 'build/libs'

    useJUnit {
        includeCategories 'com.*.platform.identity.test.IUnitTest'
        excludeCategories 'com.*.platform.identity.test.IIntegrationTest'
    }
}

Чтобы получить то же поведение, я добавил следующее в pom. xml -

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>test-compile</phase>
                        <configuration>
                            <includeScope>test</includeScope>
                            <includeTypes>so,dll,dylib</includeTypes>
                            <outputDirectory>${project.basedir}/build/libs</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <includes>
                        <include>**/Test*.java</include>
                        <include>**/*Test.java</include>
                        <include>**/*Tests.java</include>
                        <include>**/*TestCase.java</include>
                    </includes>
                    <useFile>true</useFile>
                    <argLine>${surefireArgLine}</argLine>
                </configuration>
            </plugin>

и это в модульном тесте -

System.setProperty("java.library.path", "build/libs");

Ошибка Stacktrace -

2020-03-13 23:27:33,397 WARN [ ] SQLiteQueue[] [sqlite] cannot open DB[1]: com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64-1.0.392 in java.library.path
2020-03-13 23:27:33.400 ERROR 13542 --- [  SQLiteQueue[]] com.almworks.sqlite4java                 : [sqlite] SQLiteQueue[]: error running job queue

com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64-1.0.392 in java.library.path
    at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:97)
    at com.almworks.sqlite4java.SQLiteConnection.open0(SQLiteConnection.java:1441)
    at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:282)
    at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:293)
    at com.almworks.sqlite4java.SQLiteQueue.openConnection(SQLiteQueue.java:464)
    at com.almworks.sqlite4java.SQLiteQueue.queueFunction(SQLiteQueue.java:641)
    at com.almworks.sqlite4java.SQLiteQueue.runQueue(SQLiteQueue.java:623)
    at com.almworks.sqlite4java.SQLiteQueue.access$000(SQLiteQueue.java:77)
    at com.almworks.sqlite4java.SQLiteQueue$1.run(SQLiteQueue.java:205)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64-1.0.392 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at com.almworks.sqlite4java.Internal.tryLoadFromSystemPath(Internal.java:352)
    at com.almworks.sqlite4java.Internal.loadLibraryX(Internal.java:124)
    at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:95)
    ... 9 common frames omitted

2020-03-13 23:27:33,400 ERROR [ ] SQLiteQueue[] [sqlite] SQLiteQueue[]: error running job queue
com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64-1.0.392 in java.library.path
    at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:97)
    at com.almworks.sqlite4java.SQLiteConnection.open0(SQLiteConnection.java:1441)
    at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:282)
    at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:293)
    at com.almworks.sqlite4java.SQLiteQueue.openConnection(SQLiteQueue.java:464)
    at com.almworks.sqlite4java.SQLiteQueue.queueFunction(SQLiteQueue.java:641)
    at com.almworks.sqlite4java.SQLiteQueue.runQueue(SQLiteQueue.java:623)
    at com.almworks.sqlite4java.SQLiteQueue.access$000(SQLiteQueue.java:77)
    at com.almworks.sqlite4java.SQLiteQueue$1.run(SQLiteQueue.java:205)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64-1.0.392 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at com.almworks.sqlite4java.Internal.tryLoadFromSystemPath(Internal.java:352)
    at com.almworks.sqlite4java.Internal.loadLibraryX(Internal.java:124)
    at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:95)
    ... 9 common frames omitted
2020-03-13 23:27:33.401 ERROR 13542 --- [  SQLiteQueue[]] com.almworks.sqlite4java                 : [sqlite] SQLiteQueue[]: stopped abnormally, reincarnation is not possible for in-memory database
2020-03-13 23:27:33,401 ERROR [ ] SQLiteQueue[] [sqlite] SQLiteQueue[]: stopped abnormally, reincarnation is not possible for in-memory database

Понятия не имею, почему его по-прежнему не удается связать.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...