java.lang.NoSuchMethodException: class.get$jacocoData()

1,198 views
Skip to first unread message

yajvane

unread,
Nov 17, 2016, 8:20:58 AM11/17/16
to JaCoCo and EclEmma Users

Hi Team,
While running tests ., I am seeing this exception. Please let me know in which scenario this exception was thrown ?

###############################
java.lang.NoSuchMethodException: com.cisco.cpm.policy.PolicyAttributeType.get$jacocoData()
	at java.lang.Class.getMethod(Class.java:1778)
	at com.cisco.cpm.policy.cache.proxy.ProxyUtil.compareModels(ProxyUtil.java:247)
	at com.cisco.cpm.policy.cache.proxy.PolicyAttributeTypeProxyTest.testBuildModelObject(PolicyAttributeTypeProxyTest.java:79)
	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:483)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
	at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:200)
	at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:155)
	at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:212)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:689)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:882)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1189)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
	at org.testng.TestRunner.privateRun(TestRunner.java:767)
	at org.testng.TestRunner.run(TestRunner.java:617)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
	at org.testng.SuiteRunner.run(SuiteRunner.java:254)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
	at org.testng.TestNG.run(TestNG.java:1057)
	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:70)
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:157)
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:97)
	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)
	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:483)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:172)
	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:104)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:70)
####################################


-Regards,
Kesav.

Marc Hoffmann

unread,
Nov 17, 2016, 8:27:37 AM11/17/16
to jac...@googlegroups.com
Hi Kesav,

please see our FAQ: http://www.eclemma.org/jacoco/trunk/doc/faq.html


Q: My code uses reflection. Why does it fail when I execute it with
JaCoCo?

To collect execution data JaCoCo instruments the classes under test
which adds two members to the classes: A private static field
$jacocoData and a private static method $jacocoInit(). Both members are
marked as synthetic.

Please change your code to ignore synthetic members. This is a good
practice anyways as also the Java compiler creates synthetic members in
certain situation.



Regards,
-marc
> --
> You received this message because you are subscribed to the Google
> Groups "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jacoco+un...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jacoco/dc83e23d-06b8-42b0-819e-7cb2428da0a5%40googlegroups.com
> [1].
> For more options, visit https://groups.google.com/d/optout.
>
>
> Links:
> ------
> [1]
> https://groups.google.com/d/msgid/jacoco/dc83e23d-06b8-42b0-819e-7cb2428da0a5%40googlegroups.com?utm_medium=email&utm_source=footer
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages