java - 无法将类型 id 'http' 解析为 [simple type, class io.dropwizard.jetty.ConnectorFactory] 的子类型:已知类型 ids = [ConnectorFactory]
问题描述
我在 AZURE 中创建了一个新的 VM 实例并尝试部署我的 java web 应用程序(已成功部署在 aws 服务器中)。gradle build 成功。通过我的类路径运行应用程序时,我收到以下错误。
解析配置失败:server.applicationConnectors.[0]; 无法将类型 id 'http' 解析为 [simple type, class io.dropwizard.jetty.ConnectorFactory] 的子类型:已知类型 ids = [ConnectorFactory] at [Source: N/A; 行:-1,列:-1](通过引用链:com.voicemonk.config.DialogServiceConfiguration["server"]->io.dropwizard.server.DefaultServerFactory["applicationConnectors"]->java.util.ArrayList[0 ])
我曾尝试添加影子依赖项,但 bot 也没有任何效果。
build.gradle 文件:
apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'application'
apply plugin:'base'
apply plugin: 'com.github.johnrengelman.shadow'
// Use Java 8 by default
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
// UTF-8 should be standard by now. So use it!
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
project.ext {
dropwizardVersion = '0.8.4'
guavaVersion = '19.0'
httpComponentsVersion = '4.3.6'
guiceVersion = '3.0'
}
mainClassName = 'com.voicemonk.service.name'
dependencies {
compile (
'io.dropwizard:dropwizard-core:' + dropwizardVersion,
'io.dropwizard:dropwizard-hibernate:' + dropwizardVersion,
'io.dropwizard:dropwizard-migrations:' + dropwizardVersion,
'io.dropwizard:dropwizard-auth:' + dropwizardVersion,
'io.dropwizard:dropwizard-assets:' + dropwizardVersion,
'io.dropwizard:dropwizard-forms:'+ dropwizardVersion,
'org.apache.httpcomponents:httpclient:' + httpComponentsVersion,
///Other Dependecies///
}
task wrapper(type: Wrapper) {
gradleVersion = '3.3'
}
// Configure the shadow jar task
shadowJar {
mergeServiceFiles()
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
}
jar {
zip64=true
manifest {
attributes 'Main-Class': mainClassName
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
.YAML 文件:
server:
rootPath: '/myrootpath/*'
applicationConnectors:
- type: http
port: 8080
相同的版本在 AWS srever 中工作,那么为什么它不能在 azure 中工作?如何解决这个问题?我两天以来一直在研究这个问题,但没有任何结果。有人请帮我解决这个问题。
解决方案
推荐阅读
- ruby-on-rails - RoR 控制器 - 特定角色的权限
- r - 在 CentOS 上安装 RMariaDB 时遇到问题
- java - 如何将多个日期格式字符串转换为具有时区格式的时间戳
- excel - 如何确定函数执行所在行的行号?(VBA)
- php - PHP:如何打印带有条件的多维数组行
- python - 如何识别最后 N 个唯一单元格?
- python - 如何将度量单位添加到 int/float?
- c# - 将应用程序作为 azure webjob 运行时,C# nuget 包依赖项整合失败
- swift - Swift:枚举名称中包含特殊字符(如 .)
- javascript - vue中如何在数组中显示数组