数据库错误连接

nwo49xxi  于 2021-06-27  发布在  Java
关注(0)|答案(0)|浏览(236)

我正在使用mysql数据库(aws)进行javafx项目。当我从intellij启动我的项目时,它工作得很好,但是当我尝试用jpackage和my build.gradle导出、安装和启动我的应用程序时,我得到了一个窗口,出现以下错误:

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.

我不明白问题出在哪里。所有的连接都通过aws授权给我的db,jpackage进程运行没有错误,正如我之前所说,当我从intellij启动时,它可以完美地工作。
这是我的身材

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'

}

事先谢谢你的帮助

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题