Unite test failing - for com.day.commons.httpclient | Community
Skip to main content
ashishkhadpe
Level 3
February 2, 2021
Question

Unite test failing - for com.day.commons.httpclient

  • February 2, 2021
  • 1 reply
  • 2464 views

Hi All,

 

We have upgraded our AEM version from 6.2 to 6.5.6. While updating our codebase we observed that our unit test cases are failing for com.day.commons.httpclient class showing below error : 

java.lang.NoClassDefFoundError: com/day/commons/httpclient/impl/ProxyWrapper

at org.apache.commons.httpclient.HttpState.<init>(HttpState.java:114)
at org.apache.commons.httpclient.HttpClient.<init>(HttpClient.java:183)
at org.apache.commons.httpclient.HttpClient.<init>(HttpClient.java:97)

 

Unite test code looks like below : 

@Test
public void provideHttpClient_singleton() {

Injector injector = Guice.createInjector(peaberryRssClientModule);

HttpClient httpClientA = injector.getInstance(HttpClient.class);
HttpClient httpClientB = injector.getInstance(HttpClient.class);

assertEquals(httpClientA, httpClientB);

}

 

I assume that Uber 6.5 jar provide httpclient version of 4.5.2 and due to which it it giving error for HttpState(which is deprecated list of AEM 6.5). Any quick solution to fix this?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SureshDhulipudi
Community Advisor
Community Advisor
February 2, 2021

It is better to rewrite http client code to newer version of apache.http(4.x).

How about your regular class functionality?

ashishkhadpe
Level 3
February 4, 2021
Hi Suresh, for now we have added the Ignore annotation only but we would be happy to fix this. Issue is I am not sure why it is only breaking in unit test only. Also we are hesitant to modify any regular code just to fix unit test.
March 9, 2022

Hi Ashish is the issue fixed, please let me know as i am facing similar issue