简体   繁体   English

如何修复java.lang.NoSuchMethodError

[英]How to fix java.lang.NoSuchMethodError

One of my test cases is getting NoSuchMethodError . 我的测试用例之一是获取NoSuchMethodError I've removed getExceptionHandler() method from the project so this method shouldn't be detected at all. 我已经从项目中删除了getExceptionHandler()方法,因此完全不应检测到此方法。 This is the only test case with this error. 这是唯一出现此错误的测试案例。

Here is the stack trace 这是堆栈跟踪

java.lang.NoSuchMethodError: mig.eis.common.service.impl.iso.ISOPPCServiceHelper.getExceptionHandler()Lmig/eis/framework/exception/IExceptionHandler;
at mig.eis.common.service.impl.iso.ISOPPCServiceHelper.mergePPCInputTemplate(ISOPPCServiceHelper.java:62)
at mig.eis.common.service.impl.iso.ISOServiceDelegate.retrieveData(ISOServiceDelegate.java:36)
at mig.eis.provider.thirdparty.ISOPPCLookupProvider.retrieveData(ISOPPCLookupProvider.java:40)
at test.mig.eis.provider.thirdparty.TestISOPPCLookupProvider.test(TestISOPPCLookupProvider.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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.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:254)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
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.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.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

I don't know how to tell the compiler that getExceptionHandler() doesn't exist any more. 我不知道如何告诉编译器getExceptionHandler()不再存在。

Thanks 谢谢

The problem is not in your test! 问题不在您的测试中! The test calls ISOPPCServiceHelper which still uses the method getExceptionHandler() . 该测试调用ISOPPCServiceHelper ,该方法仍使用getExceptionHandler()方法。 You have to recompile that class. 您必须重新编译该类。 Always use clean test of your build system after refactorings to make sure everything is compiled right (hopefully you have one, otherwise rebuild project of your IDE should do the job). 重构后,请始终对构建系统使用干净的测试,以确保正确编译了所有内容(希望您已经进行了正确的编译,否则IDE的重建项目应能完成此工作)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复 java.lang.NoSuchMethodError? - How to fix a java.lang.NoSuchMethodError? 线程“ main”中的异常java.lang.NoSuchMethodError:main-如何解决? - Exception in thread “main” java.lang.NoSuchMethodError: main - how to fix it? java.lang.NoSuchMethodError: - java.lang.NoSuchMethodError: java.lang.NoSuchMethodError - java.lang.NoSuchMethodError 如何获取 java.lang.NoSuchMethodError - How to get java.lang.NoSuchMethodError 如何修复 java.lang.NoSuchMethodError: sun.security.ssl.Handshaker.setApplicationProtocols([Ljava/lang/String;) - How to fix java.lang.NoSuchMethodError: sun.security.ssl.Handshaker.setApplicationProtocols([Ljava/lang/String;) 如何修复在Hive下运行的geoip2 java的“java.lang.NoSuchMethodError” - How to fix “java.lang.NoSuchMethodError” for geoip2 java running under Hive 如何修复此错误:java.lang.NoSuchMethodError: 'java.lang.AutoCloseable org.mockito.MockitoAnnotations.openMocks(java.lang.Object)' - How to fix this error: java.lang.NoSuchMethodError: 'java.lang.AutoCloseable org.mockito.MockitoAnnotations.openMocks(java.lang.Object)' 即使存在这样的方法,也如何修复java.lang.NoSuchMethodError,并且在本地服务器中不会​​发生错误 - How to fix java.lang.NoSuchMethodError even if such a method exist, and error do not occur in local server 知道如何解决这个问题吗? 线程“WindowsNativeRunloopThread”中的异常 java.lang.NoSuchMethodError - Any idea how to fix this? Exception in thread "WindowsNativeRunloopThread" java.lang.NoSuchMethodError
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM