java .lang.NoClassDefFoundError: feign / Request $ HttpMethod - PullRequest
1 голос
/ 04 февраля 2020

Я пытаюсь проверить мой сценарий, но он появляется со следующей ошибкой. мы используем openfeign: feign-okhttp , который работал ранее, но теперь мы видим, что мы видим эту проблему

java.lang.NoClassDefFoundError: feign/Request$HttpMethod

    at feign.okhttp.OkHttpClient.toOkHttpRequest(OkHttpClient.java:75)
    at feign.okhttp.OkHttpClient.execute(OkHttpClient.java:168)
    at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:98)
    at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:77)
    at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:102)
    at com.sun.proxy.$Proxy146.getEmailById(Unknown Source)
    at com.eventhub.subscribe.service.impl.Service.processOrder(Service.java:93)
    at com.eventhub.subscribe.service.impl.Service.checkAndProcessOrder(Service.java:74)
    at com.eventhub.subscribe.service.impl.Service.processOrder(Service.java:63)
    at com.eventhub.subscribe.service.impl.Service.processEvent(Service.java:158)
    at com.eventhub.subscribe.service.impl.Service$$FastClassBySpringCGLIB$$81dbf3f2.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.retry.interceptor.RetryOperationsInterceptor$1.doWithRetry(RetryOperationsInterceptor.java:91)
    at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287)
    at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:164)
    at org.springframework.retry.interceptor.RetryOperationsInterceptor.invoke(RetryOperationsInterceptor.java:118)
    at org.springframework.retry.annotation.AnnotationAwareRetryOperationsInterceptor.invoke(AnnotationAwareRetryOperationsInterceptor.java:153)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
    at com.eventhub.subscribe.service.impl.Service$$EnhancerBySpringCGLIB$$9d8a6481.processEvent(<generated>)
    at com.eventhub.subscribe.Consumer.processEvent(Consumer.java:111)
    at com.eventhub.subscribe.Consumer.processEvent(Consumer.java:78)
    at com.eventhub.subscribe.Consumer.onEvents(Consumer.java:62)
    at com.eventhub.subscribe.ConsumerEndToEndTest.onOrderCreateEventTest(ConsumerEndToEndTest.java:128)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
    at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
    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)
Caused by: java.lang.ClassNotFoundException: feign.Request$HttpMethod
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 60 more

Сервисный вызов

@FeignClient(name = "client", url = "${service.url}",
        configuration = CustomFeignConfiguration.class)
public interface LookupClient {

    @GetMapping(path = "${service.lookup.path}",
            headers = {"Accept-Language=en-US"},
            consumes = APPLICATION_JSON_UTF8_VALUE, produces = APPLICATION_JSON_UTF8_VALUE)
    LookupResponse getEmailById(
            @PathVariable("id") String id);
}

Feign конфигурации


public class CustomFeignConfiguration extends FeignConfiguration {

    @Value("${service.lookup.readTimeout}")
    private int readTimeout;

    @Value("${service.lookup.connectTimeout}")
    private int connectTimeout;

    @Bean
    public Request.Options options() {
        return new Request.Options(connectTimeout, readTimeout);
    }

}

@Configuration
public class FeignConfiguration {

    @Value("${logging.type}")
    private String logLevel;

    @Bean
    public Logger.Level feignLogLevel() {
        return Logger.Level.valueOf(logLevel);
    }

    @Bean
    public ErrorDecoder feignErrorDecoder() {
        return new FeignErrorDecoder();
    }

}

Я пробовал с версией feign-form-spring 3.4.1

compile(group: 'io.github.openfeign.form', name: 'feign-form-spring', version: '3.4.1')

, и она отлично работает, но я хочу понять, почему она не работает и как это исправить сейчас и есть ли другой способ исправить это? Есть идеи на этот счет?

...