首页 > 解决方案 > 无法将类型 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 中工作?如何解决这个问题?我两天以来一直在研究这个问题,但没有任何结果。有人请帮我解决这个问题。

标签: javaazuregradleyamldropwizard

解决方案


推荐阅读