我在AZURE中创建了一个新的VM实例,并尝试部署我的java web -application(已成功部署在aws服务器中)。 gradle构建成功。通过我的类路径运行应用程序时,出现以下错误。
无法在以下位置解析配置:server.applicationConnectors。[0];无法将类型ID'http'解析为[简单类型,类io.dropwizard.jetty.ConnectorFactory]的子类型:已知类型ID = [ConnectorFactory] 在[来源:N / A;行:-1,列:-1](通过参考链:com.voicemonk.config.DialogServiceConfiguration [“ server”]-> io.dropwizard.server.DefaultServerFactory [“ applicationConnectors”]-> java.util.ArrayList [0 ])
我尝试添加影子依赖项,但机器人也无法正常工作。
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中运行?如何解决此问题?我已经进行了两天的工作,但没有任何解决方法。请有人帮我解决这个问题。