Pages

Wednesday, February 1, 2012

JBoss 4.2.2 NoSuchMethodError CommonMessageContext cleanupAttachments

Getting error in your JBoss 4.2.2 for Web service: NoSuchMethodError

JBoss 4.2.2 NoSuchMethodError CommonMessageContext cleanupAttachments

I was getting a NoSuchMethodError in my JBoss 4.2.2 while trying to invoke my web service. I did not find any relevant information for this on google search. So decided to add this post once I find the solution. 

There was nothing wrong with my code. It was happening due to mismatch between jbossws jars while we had upgraded our JBoss ESB to 4.7 version.

The complete stack trace is as given below:
------------------------------------------------------------------------------------------------
java.lang.NoSuchMethodError: org.jboss.ws.core.CommonMessageContext.cleanupAttachments(Lorg/jboss/ws/core/CommonMessageContext;)V
   at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:341)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)
    at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:662)
-------------------------------------------------------------------------------------------------------

FIX
To fix this, you will need to get the latest for JBoss 4.2.x (or whatever version you have) of these jars jbossws-client.jar and jbossws-core.jar from the JBoss Website
  • I had to download the complete jboss-4.2.3.GA.zip  from this download link
  • Unpack the jboss-4.2.3.GA.zip to a temp location
  • You will find the jbossws-client.jar in jboss-4.2.3.GA\client\ folder
  • You will find other jbossws specific jars in this above folder too that you could think of using/upgrading to.
  • You will find the jbossws-core.jar in jboss-4.2.3.GA\server\default\deploy\jbossws.sar\ folder
  • copy the "jbossws-client.jar" to this location: {JBOSS_HOME}\client\ folder
  • copy the "jbossws-core.jar" to this location of your esb server: {JBOSS_HOME}\server\{your_server}\deploy\jbossws.sar\ folder 
  • Then restart your JBoss server 
This should fix your issue. Hope it helps someone..