问题描述
我正在使用 MysqL 数据库 (AWS) 开展 JavaFX 项目。当我从 Intellij 启动我的项目时,它运行良好,但是当我尝试使用 jpackage 和 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 授权到我的数据库,jpackage 进程运行没有错误,正如我之前所说,当我从 IntelliJ 启动时它运行良好。
这是我的 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'
}
预先感谢您的帮助
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)