0

I have added axis2.xml in server and trying to load the configurationContext using java code.But during loading the configuration getting classCastException for class org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender to org.apache.axis2.transport.http.TransportSender

I have confirmed there are no duplicate jars or different version jars. In Axis2.xml we have default setting

HTTP/1.1 chunked Unable to find any resolution for this and looking for quick solution.

Thanks in advance guys.

  • If a Java class cannot be cast to its legitimate supertype or interface, there _always_ are two of the superclass/interface around, through conflicting classloaders. The error message does not contain the classloader that's expected. I'd suggest you check again: There certainly are duplicate jars, or multiple classloaders loading the same jar. If that doesn't help, provide a [mcve] (stressing the "minimal") which will quickly demonstrate that there need to be duplicate jars in order to reproduce. – Olaf Kock Jan 19 '22 at 08:05
  • we had httpclient4.4 and axis2-transport-http-1.8 jar in lib folder which has HTTPClient4TransportSender class, but even after removing httpclient jar we are getting same exception.We tried removing from both deployed package and server lib.When we remove axis2-transport-http jar we get HTTPClient4TransportSender class not found exception.So stuck in between, dont see any duplicate jars as well :( – Manish Shinde Jan 19 '22 at 10:04
  • the culprit is the interface, not the implementing class. The implementing class implements the interface (or superclass) from a different classloader. You may not have found it yet, but you have a duplicate on your classpath. AFAIK newer JREs will give you more information with that error message. Not sure where it started, you might want to try that. – Olaf Kock Jan 19 '22 at 10:08
  • Thanks For the quick response Olaf, will check on that – Manish Shinde Jan 19 '22 at 10:12
  • Hey Olaf found the TransportSender class in apache-osgi and axis2-kernel jar, so we tried removing both at once got noclassfoundexception for this.Then when we tried placing one at time getting same classcastException again – Manish Shinde Jan 19 '22 at 12:13
  • @OlafKock was able to resolve the issue..as you said there were duplicate jars in other location of server, excluding that resolved the issue.Thanks for the help – Manish Shinde Jan 21 '22 at 07:54

0 Answers0