“java.lang.ClassCastException: java.util.HashMap cannot be cast to com.sun.xml.ws.transport.Headers” hatası çözümü

“java.lang.ClassCastException: java.util.HashMap cannot be cast to com.sun.xml.ws.transport.Headers” hatası çözümü için bir ihtimal olarak sunucuya yüklenen “Introscope” programı olabilir.
Bunun çözümü için ise yapılandırma ayarlarında değişiklikler yaptıktan sonra uygulamayı yeniden başlatmanız gerekmektedir veya ilgili programı sunucudan kaldırmanız gerek.
Daha farklı bir çözüm olarak ise kullanılan jax-ws classpath değerlerinde sizin farklı bir yol izleyerek, kullanılan paketi değiştirmeniz, web konteyner/uygulama sunucunuzu değiştirmeniz veya farklı sunucu platformunda farklı web konteyner/uygulama sunucunuzu değiştirebilirsiniz.


Happy Black Friday!

We are upgrading our JEE application from Weblogic 11g to 12c. On one of our staging servers, we got this error:

    Java agent causing error: Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to com.sun.xml.ws.transport.Headers

This error, however, doesn’t happen in our development environment. We have scratched our heads for many days for this issue. From googling, this link comes up at the top: http://www.ca.com/us/services-support/ca-support/ca-support-online/knowledge-base-articles.tec1210346.html This apparently indicates there are some jax-ws libraries that are polluting our environment in that staging server. Following this thought, we have tuned and reconfigured many ways to let the application use the jax-ws jar we want it to, in vain.

Eventually, a server admin found out that the Introscope Wily that is installed on the staging server is the culprit that contaminated the Java Classpath for the jax-ws. When we go back to the link above, that’s of course from Wily’s vendor CA! ! The fix is easy just follow the link above to change the introscope properties to what’s described in that link.

It’s ironic that the link is from CA at the first place, and it didn’t ring the bell for me that the issue was caused by Wily in the first place.

Cheers and happy holidays!



Seeing a Hashmap error after enabling the SOA Performance Management Agent Extension.

Document ID:  TEC1210346
Last Modified Date:  06/12/2017 
Hide Technical Document Details


CA Application Performance Management

CA Application Performance Management:Release:9.7
CA Application Performance Management:Release:CA APM 9.7
CA Application Performance Management:Release:10.0

After enabling the SOA Performance Management Agent Extension, we see the below exception in the log:

 Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to com.sun.xml.ws.transport.Headers 
    at com.sun.xml.ws.client.RequestContext.fill(RequestContext.java:363) 
   at com.sun.xml.ws.client.Stub.configureRequestPacket(Stub.java:412) 
   at com.sun.xml.ws.client.Stub.process(Stub.java:375) 
   at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:189) 
   at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119) 
   at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:102) 
   at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:172)

All supported Introscope releases after APM 9.7.
The ClassCastException is due to a SOA Performance compatibility issue with the newer JAX-WS versions that expect to use com.sun.xml.ws.transport.Headers instead of java.util.HashMap. Starting from APM 9.7, the below property is available to allow using com.sun.xml.ws.transport.Headers instead of java.util.HashMap and to mitigate the ClassCastException.  This change does not have any side effect in the Cross Process Transaction Tracing or Cross-JVM.

1. Stop the Appserver/JVM.

2. Open the APM Agent property file : <Agent Home>/core/config/IntroscopeAgent.profile. 

3. Uncomment the below property to prevent the exception

    # SOA property for 2.2.6 or later versions of JAXWS Jar 

    # JAXWS jar has changed some methods in 2.2.6 and later versions 

    # Uncomment this property if JAXWS version is 2.2.6 or higher 


 4. Save and restart the Agent/Appserver,
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on StumbleUpon0Share on Reddit0

Leave a Reply