Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java.lang.NoSuchMethodError:io.dropwizard.jersey.setup.JerseyEnvironment.getResourceConfig()Lcom/sun/jersey/api/core/ResourceConfig;_Java_Jersey_Integration Testing_Dropwizard - Fatal编程技术网

java.lang.NoSuchMethodError:io.dropwizard.jersey.setup.JerseyEnvironment.getResourceConfig()Lcom/sun/jersey/api/core/ResourceConfig;

java.lang.NoSuchMethodError:io.dropwizard.jersey.setup.JerseyEnvironment.getResourceConfig()Lcom/sun/jersey/api/core/ResourceConfig;,java,jersey,integration-testing,dropwizard,Java,Jersey,Integration Testing,Dropwizard,我试图访问一个遗留模块,并使用零代码框架编写集成测试。在集成测试模块中,我使用的是dropwizard-1.13.2版本,原始模块是0.7.1版本。使用时,我得到以下错误: java.lang.NoSuchMethodError: io.dropwizard.jersey.setup.JerseyEnvironment.getResourceConfig()Lcom/sun/jersey/api/core/ResourceConfig; at com.xyz.hubsystem.boo

我试图访问一个遗留模块,并使用零代码框架编写集成测试。在集成测试模块中,我使用的是dropwizard-1.13.2版本,原始模块是0.7.1版本。使用时,我得到以下错误:

java.lang.NoSuchMethodError: io.dropwizard.jersey.setup.JerseyEnvironment.getResourceConfig()Lcom/sun/jersey/api/core/ResourceConfig;

    at com.xyz.hubsystem.bootstrap.ResourceConfig.bindResources(ResourceConfig.java:108)
    at com.xyz.hubsystem.HubSystemApplication.run(HubSystemApplication.java:114)
    at com.xyz.hubsystem.HubSystemApplication.run(HubSystemApplication.java:57)
    at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:43)
    at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
    at io.dropwizard.testing.DropwizardTestSupport.startIfRequired(DropwizardTestSupport.java:237)
    at io.dropwizard.testing.DropwizardTestSupport.before(DropwizardTestSupport.java:151)
    at io.dropwizard.testing.junit.DropwizardAppRule.before(DropwizardAppRule.java:159)
    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

答案如下:Dropwizard在
0.8版中迁移到
Jersey 2
。您必须升级模块的代码或降级您正在使用的
dropwizard
版本。stacktrace非常相似: