2

I am trying to use ObjectBox as a server database with Spring Boot and Tomcat When i use the embedded tomcat server of Spring Boot, it works fine (running directly from IntelliJ IDEA),

But when i deploy the WAR file / exploded API to Tomcat, i get the error "no objectbox-jni-windows-x64 in java.library.path"

I do have Microsoft Visual C++ 2017 installed

Can you please help me to deploy it successfully?

The following is my build.gradle file:

buildscript {
    ext {
        kotlinVersion = '1.3.10'
        springBootVersion = '2.1.1.RELEASE'
        objectboxVersion = '2.2.0'
    }
    repositories {
        mavenCentral()
        maven { url "https://plugins.gradle.org/m2/" }
        jcenter()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
        classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
        classpath "io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
        classpath "net.ltgt.gradle:gradle-apt-plugin:0.15"

    }
}
plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version '1.3.10'
}

apply plugin: 'application'
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'eclipse-wtp'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'io.objectbox'
apply plugin: 'kotlin-kapt'
apply plugin: 'net.ltgt.apt-idea'

group = 'com.techontouch'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
mainClassName = "ScoresOnTouchApplicationKt"
compileKotlin {
    kotlinOptions {
        freeCompilerArgs = ["-Xjsr305=strict"]
        jvmTarget = "1.8"
    }
}
compileTestKotlin {
    kotlinOptions {
        freeCompilerArgs = ["-Xjsr305=strict"]
        jvmTarget = "1.8"
    }
}

repositories {
    mavenCentral()
    jcenter()
}

configurations {
    providedRuntime
}

dependencies {
    implementation('org.springframework.boot:spring-boot-starter-actuator')
    implementation('org.springframework.boot:spring-boot-starter-data-rest')
    implementation('org.springframework.boot:spring-boot-starter-web')
    implementation('com.fasterxml.jackson.module:jackson-module-kotlin')
    providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
    testImplementation('org.springframework.boot:spring-boot-starter-test')
    implementation "io.objectbox:objectbox-java:$objectboxVersion"
    implementation "io.objectbox:objectbox-kotlin:$objectboxVersion"
    kapt "io.objectbox:objectbox-processor:$objectboxVersion"
    implementation "io.objectbox:objectbox-linux:$objectboxVersion"
    implementation "io.objectbox:objectbox-macos:$objectboxVersion"
    implementation "io.objectbox:objectbox-windows:$objectboxVersion"
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    compile('org.json:json:20180813')
    compile('com.google.code.gson:gson:2.8.5')
    compile('javax.xml.bind:jaxb-api:2.2.8')
    compile('io.springfox:springfox-swagger2:2.9.2')
    compile('io.springfox:springfox-swagger-ui:2.9.2')
    compile('org.antlr:antlr-complete:3.5.2')
}
// enable debug output for plugin
objectbox {
    debug = true
}
// enable debug output for annotation processor
tasks.withType(JavaCompile) {
    options.compilerArgs += ["-Aobjectbox.debug=true"]
}

GitHub Link: https://github.com/objectbox/objectbox-java/issues/170#issuecomment-444075662

  • Please check if there is more error info that "no objectbox-jni-windows-x64 in java.library.path"? Do you have this: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads ? – Markus Junginger Dec 04 '18 at 13:21
  • 1. The log shows only "no objectbox-jni-windows-x64 in java.library.path" as relevant error 2. Yes i do have the Visual C++ Package Installed: 2017 - x86 and x64 along with Visual Studio Build Tools 2017 – Shripal Jain Dec 05 '18 at 14:15
  • For a temporary fix: I ran the project from IntelliJ IDEA itself as stated above, copied the DLL generated in the Project Folder to my ObjectBox Database Folder – Shripal Jain Dec 10 '18 at 14:34
  • Speaking of DLLs; might be that Tomcat might require a special setup for them: e.g. 2nd answer here: https://stackoverflow.com/questions/14018817/how-to-add-a-native-library-in-tomcat – Markus Junginger Dec 10 '18 at 15:13
  • I saw that post, can you help me out to set it up for ObjectBox? – Shripal Jain Dec 11 '18 at 16:04
  • You already have the DLL, no? Try to make it available to Tomcat (haven't touched it for a long time...). – Markus Junginger Dec 11 '18 at 17:29

0 Answers0