0

I'm working on a JavaFX Project with a MySQL database (AWS). When I launch my project from Intellij it works perfectly but when I try to export, install and launch my application with jpackage and my build.gradle, I obtain a window with the following error:

com.mysql.cj.jdbc.exceptions.communicationsexception communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The drive has not received any packets from server.

I don't understand from where the problem comes. All the connection are authorized to my DB with AWS, jpackage process runs without error and as I said before it works perfectly when I launch from IntelliJ.

Here is my build.gradle

plugins {
    id 'java'
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.9'
    id 'org.beryx.runtime' version '1.11.3'
}

group 'org.example'
version '0.0.1'

repositories {
    mavenCentral()
}

javafx {
    version = "15.0.1"
    modules = [ 'javafx.controls','javafx.fxml' ]
}
jar {
    manifest {
        attributes 'Main-Class': 'com.github.studeasy.launcher.appMain'
    }
}

application {
    mainClassName= "com.github.studeasy.launcher.appMain"
    applicationName = 'StudEasy'
}


javadoc {
    source = sourceSets.main.allJava
    classpath = sourceSets.main.runtimeClasspath
}

test {
    useJUnitPlatform()
}

runtime {
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    launcher {
        noConsole = false
    }
    jpackage {
        def currentOs = org.gradle.internal.os.OperatingSystem.current()
        def imgType = currentOs.windows ? 'ico' : currentOs.macOsX ? 'icns' : 'png'
        imageOptions += ['--icon', "src/main/resources/images/logo.$imgType"]
        installerOptions += ['--resource-dir', "src/main/resources"]
        installerOptions += ['--vendor', 'Stud Easy']
        if(currentOs.windows) {
            installerOptions += ['--win-per-user-install', '--win-dir-chooser', '--win-menu', '--win-shortcut']
        }
        else if (currentOs.linux) {
            installerOptions += ['--linux-package-name', 'StudEasy','--linux-shortcut']
        }
        else if (currentOs.macOsX) {
            installerOptions += ['--mac-package-name', 'StudEasy']
        }
    }
}
dependencies {

    implementation "mysql:mysql-connector-java:8.0.22"
    runtime "mysql:mysql-connector-java:8.0.22"
    implementation group: 'javax.mail', name: 'mail', version: '1.4'

    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
    testImplementation  group: 'org.mockito', name: 'mockito-core', version: '3.6.28'
    testImplementation  group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.6.28'
    testImplementation group: 'org.springframework', name: 'spring-test', version: '5.3.2'

}
 

Thank you in advance for your help

guiguie34
  • 33
  • 6

0 Answers0