Splunk AppDynamics

NoClassDefFound Could not initialize class org.mockito.internal.creation.jmock.ClassImposterizer$3

AMANPREET_BANS1
Engager

I am trying to configure the url extension and getting the below errors while running the mvn clean install.

I have installed the configured the apache-maven and planning to use windows machine-agent.


[ERROR] com.appdynamics.extensions.urlmonitor.UrlMonitorTest.urlMonitorExceptionOccurredTest  Time elapsed: 0.002 s  <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class org.mockito.internal.creation.jmock.ClassImposterizer$3
        at org.mockito.internal.creation.jmock.ClassImposterizer.createProxyClass(ClassImposterizer.java:68)
        at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:50)
        at org.powermock.api.mockito.internal.mockcreation.MockCreator.createMethodInvocationControl(MockCreator.java:100)
        at org.powermock.api.mockito.internal.mockcreation.MockCreator.mock(MockCreator.java:58)
        at org.powermock.api.mockito.internal.expectation.DefaultConstructorExpectationSetup.createNewSubsituteMock(DefaultConstructorExpectationSetup.java:80)
        at org.powermock.api.mockito.internal.expectation.DefaultConstructorExpectationSetup.withArguments(DefaultConstructorExpectationSetup.java:48)
        at com.appdynamics.extensions.urlmonitor.UrlMonitorTest.init(UrlMonitorTest.java:50)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:316)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:240)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:214)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:155)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
        at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.ExceptionInInitializerError [in thread "main"]
        at org.mockito.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:167)
        at org.mockito.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
        at org.mockito.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:217)
        at org.mockito.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
        at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:117)
        at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:109)
        at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:105)
        at org.mockito.cglib.proxy.Enhancer.<clinit>(Enhancer.java:70)
        at org.mockito.internal.creation.jmock.ClassImposterizer.createProxyClass(ClassImposterizer.java:68)
        at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:50)
        at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:54)
        at org.mockito.internal.MockitoCore.mock(MockitoCore.java:45)
        at org.mockito.Mockito.mock(Mockito.java:921)
        at org.mockito.Mockito.mock(Mockito.java:816)
        at com.appdynamics.extensions.urlmonitor.RequestConfigTest.init(RequestConfigTest.java:50)
        ... 25 more

0 Karma
1 Solution

AMANPREET_BANS1
Engager

The issue is resolved by running  "mvn clean install -Dmaven.test.skip"

Java8 for Apache Maven was already configured successfully. It is pre-requisite. Good reference to configure the same is : https://phoenixnap.com/kb/install-maven-windows

Problem statement

  • While running mvn clean install for url-monitoring extension, receiving an error below:

[ERROR] com.appdynamics.extensions.urlmonitor.UrlMonitorTest.urlMonitorExceptionOccurredTest Time elapsed: 0.002 s <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class org.mockito.internal.creation.jmock.ClassImposterizer$3

 
Next steps

  • It seems the test is failing. Could you please execute mvn clean install -Dmaven.test.skip and confirm if you can build the extension?
  • Please also confirm if you configured Java8 for Apache Maven.

View solution in original post

iamryan
Community Manager
Community Manager

Hi @AMANPREET.BANSAL,

Thank you for sharing the solution!

0 Karma

AMANPREET_BANS1
Engager

The issue is resolved by running  "mvn clean install -Dmaven.test.skip"

Java8 for Apache Maven was already configured successfully. It is pre-requisite. Good reference to configure the same is : https://phoenixnap.com/kb/install-maven-windows

Problem statement

  • While running mvn clean install for url-monitoring extension, receiving an error below:

[ERROR] com.appdynamics.extensions.urlmonitor.UrlMonitorTest.urlMonitorExceptionOccurredTest Time elapsed: 0.002 s <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class org.mockito.internal.creation.jmock.ClassImposterizer$3

 
Next steps

  • It seems the test is failing. Could you please execute mvn clean install -Dmaven.test.skip and confirm if you can build the extension?
  • Please also confirm if you configured Java8 for Apache Maven.

iamryan
Community Manager
Community Manager

Hi @AMANPREET.BANSAL,

Thanks for asking your question on the Community. I see you also created a Support ticket. Can you please share the resolution back as a reply to this thread? Knowledge sharing is a key aspect of this community.

0 Karma
Get Updates on the Splunk Community!

Fall Into Learning with New Splunk Education Courses

Every month, Splunk Education releases new courses to help you branch out, strengthen your data science roots, ...

Super Optimize your Splunk Stats Searches: Unlocking the Power of tstats, TERM, and ...

By Martin Hettervik, Senior Consultant and Team Leader at Accelerate at Iver, Splunk MVPThe stats command is ...

How Splunk Observability Cloud Prevented a Major Payment Crisis in Minutes

Your bank's payment processing system is humming along during a busy afternoon, handling millions in hourly ...