AEM 6.3 upgrade issue: WCmUse / WCMUsePojo mocking in Junit

Avatar

Avatar

ravitejakolla

Avatar

ravitejakolla

ravitejakolla

14-05-2018

Seeing the below java.lang.VerifyError after upgrading from 6.2 to 6.3

Java versions used:

1.8.0_151 and 1.8.0_77

Tried using uber jar dependency as below as apis and later as obfuscated-apis:

<groupId>com.adobe.aem</groupId>

  <artifactId>uber-jar</artifactId>

  <version>6.3.0</version>

  <classifier>obfuscated-apis</classifier>

  <scope>provided</scope>

<groupId>com.adobe.aem</groupId>

  <artifactId>uber-jar</artifactId>

  <version>6.3.0</version>

  <classifier>apis</classifier>

Error Log:

Running com.page.comp.ComponentTest

Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.66 sec <<< FAILURE! - in com.amex.page.comp.ComponentTest

com.amex.page.comp.ComponentTest  Time elapsed: 0.193 sec  <<< ERROR!

java.lang.VerifyError: Constructor must call super() or this() before return

Exception Details:

  Location:

    com/adobe/cq/sightly/WCMUsePojo.<init>()V @1: return

  Reason:

    Error exists in the bytecode

  Bytecode:

    0x0000000: 2ab1                                  

  at java.lang.Class.getDeclaredConstructors0(Native Method)

  at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)

  at java.lang.Class.getDeclaredConstructors(Class.java:2020)

  at org.mockito.internal.util.reflection.FieldInitializer$ParameterizedConstructorInstantiator.biggestConstructor(FieldInitializer.java:265)

  at org.mockito.internal.util.reflection.FieldInitializer$ParameterizedConstructorInstantiator.instantiate(FieldInitializer.java:235)

  at org.mockito.internal.util.reflection.FieldInitializer.acquireFieldInstance(FieldInitializer.java:123)

  at org.mockito.internal.util.reflection.FieldInitializer.initialize(FieldInitializer.java:85)

  at org.mockito.internal.configuration.injection.ConstructorInjection.processInjection(ConstructorInjection.java:52)

  at org.mockito.internal.configuration.injection.MockInjectionStrategy.process(MockInjectionStrategy.java:68)

  at org.mockito.internal.configuration.injection.MockInjectionStrategy.relayProcessToNextStrategy(MockInjectionStrategy.java:89)

  at org.mockito.internal.configuration.injection.MockInjectionStrategy.process(MockInjectionStrategy.java:71)

  at org.mockito.internal.configuration.injection.MockInjection$OngoingMockInjection.apply(MockInjection.java:92)

  at org.mockito.internal.configuration.DefaultInjectionEngine.injectMocksOnFields(DefaultInjectionEngine.java:20)

  at org.mockito.internal.configuration.InjectingAnnotationEngine.injectMocks(InjectingAnnotationEngine.java:100)

  at org.powermock.api.mockito.internal.configuration.PowerMockitoInjectingAnnotationEngine.process(PowerMockitoInjectingAnnotationEngine.java:35)

  at org.powermock.api.extension.listener.AnnotationEnabler.injectSpiesAndInjectToSetters(AnnotationEnabler.java:60)

  at org.powermock.api.extension.listener.AnnotationEnabler.beforeTestMethod(AnnotationEnabler.java:55)

  at org.powermock.tests.utils.impl.PowerMockTestNotifierImpl.notifyBeforeTestMethod(PowerMockTestNotifierImpl.java:90)

  at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:292)

  at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTestInSuper(PowerMockJUnit47RunnerDelegateImpl.java:127)

  at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTest(PowerMockJUnit47RunnerDelegateImpl.java:82)

  at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:282)

  at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:86)

  at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)

  at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:207)

  at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:146)

  at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:120)

  at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:33)

  at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:45)

  at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:122)

  at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:104)

  at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)

  at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:53)

  at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)

  at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)

  at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)

​Thanks for your help in advance!

Replies

Highlighted

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

916

Correct Answer

1.0K

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

916

Correct Answer

1.0K
Jörg_Hoh
Employee

17-05-2018

If see this issue when building on multiple machines I would conclude that it's not an hardware issue. If only happened on a single machine, I would assume that you have an hardware issue with the RAM; if you have it on multiple machines, it's very likely something else (hardware issues on memory most often go unnoticed, and it's rather unrealistic that the problem turns out at the same time on multiple machines).

Please validate the the exact java version you are using across the machines you are building one, and see if there is a pattern.

Jörg

Highlighted

Avatar

Avatar

rushikesavaredd

Avatar

rushikesavaredd

rushikesavaredd

20-12-2018

Upgrade issue.Getting below error's when we have upgraded from AEM 6.2 to 6.4. Can you help me understand this issue.

<h1>Constructor must call super() or this() before return

Exception Details:

  Location:

    com/fasterxml/jackson/core/TreeCodec.&lt;init&gt;()V @1: return

  Reason:

    Error exists in the bytecode

  Bytecode:

    0x0000000: 2ab1                                  

</h1>

        <p>Cannot serve request to /bin/newsfeed.news.json in com.core.newsfeed.NewsfeedServlet</p>

       

        <h3>Exception:</h3>

<pre>

java.lang.VerifyError: Constructor must call super() or this() before return

Exception Details:

  Location:

    com/fasterxml/jackson/core/TreeCodec.&lt;init&gt;()V @1: return

  Reason:

    Error exists in the bytecode

  Bytecode:

    0x0000000: 2ab1 

----------------------------------------------------------

at com.newsfeed.NewsfeedServlet.doGet(NewsfeedServlet.java:48)

at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:266)

at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:342)

at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:374)

at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:552)

at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)

at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:138)

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

21-12-2018

This too can be an upgrade bug. You should report this to customer support. You may need a hotfix.