[jboss-user] [JBossWS] - Re: ClassCastException in HandlerResolverImpl.addHandler

rishabh2u do-not-reply at jboss.com
Mon Oct 27 00:11:13 EDT 2008


I am getting this problem as well when implementing jaxws on jboss421 and 423. 
As per the java spec the handler class should either implement the javax.xml.ws.handler.LogicalHandler OR javax.xml.ws.handler.SOAPHandler.
 
I have a handler class that does this.
  | 
  | package handlertest.server;
  | 
  | import java.util.Set;
  | 
  | import javax.xml.namespace.QName;
  | import javax.xml.ws.handler.MessageContext;
  | import javax.xml.ws.handler.soap.SOAPHandler;
  | import javax.xml.ws.handler.soap.SOAPMessageContext;
  | 
  | public class ServerSOAPHandler implements SOAPHandler<SOAPMessageContext> {
  | 	private final String HANDLERNAME = "ServerSOAPHandler";
  | 
  | 	public ServerSOAPHandler() {
  | 		super();
  | 		System.out.println(HANDLERNAME + " ServerSOAPHandler():");
  | 	}
  | 
  | 	public Set<QName> getHeaders() {
  | 		System.out.println(HANDLERNAME + " getHeaders():");
  | 		return null;
  | 	}
  | 
  | 	public boolean handleFault(SOAPMessageContext arg0) {
  | 		System.out.println(HANDLERNAME + " handleFault():");
  | 		return false;
  | 	}
  | 
  | 	public boolean handleMessage(SOAPMessageContext arg0) {
  | 		System.out.println(HANDLERNAME + " handleMessage():");
  | 		return false;
  | 	}
  | 
  | 	public void close(MessageContext arg0) {
  | 		System.out.println(HANDLERNAME + " close():");
  | 	}
  | }
  | 

I get the same exception when this handler is loaded. This is the stacktrace.


  | java.lang.ClassCastException: handlertest.server.ServerSOAPHandler
  |         at org.jboss.ws.core.jaxws.handler.HandlerResolverImpl.addHandler(HandlerResolverImpl.java:148)
  |         at org.jboss.ws.core.jaxws.handler.HandlerResolverImpl.initHandlerChain(HandlerResolverImpl.java:134)
  |         at org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS.callRequestHandlerChain(HandlerDelegateJAXWS.java:80)
  |         at org.jboss.ws.core.server.AbstractServiceEndpointInvoker.callRequestHandlerChain(AbstractServiceEndpointInvok
  |         at org.jboss.ws.core.server.AbstractServiceEndpointInvoker.invoke(AbstractServiceEndpointInvoker.java:162)
  |         at org.jboss.ws.core.server.ServiceEndpoint.processRequest(ServiceEndpoint.java:212)
  |         at org.jboss.ws.core.server.ServiceEndpointManager.processRequest(ServiceEndpointManager.java:448)
  |         at org.jboss.ws.core.server.AbstractServiceEndpointServlet.doPost(AbstractServiceEndpointServlet.java:114)
  |         at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
  |         at org.jboss.ws.core.server.AbstractServiceEndpointServlet.service(AbstractServiceEndpointServlet.java:75)
  |         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)
  | 

The proposed solution of using Generic handler from Jboss works but this is not a proper solution. To be able to work with JAXws 2 spec I need to implement the javax.xml.ws.handler.LogicalHandler. Can you please suggest what can i do here ???

Also below are some links to jaxws 2 tutorials
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.wsfep.multiplatform.doc/info/ae/ae/twbs_jaxwshandler.html

http://java.sun.com/mailers/techtips/enterprise/2006/TechTips_June06.html#1
http://blogs.sun.com/sdimilla/entry/implementing_handlers_using_jaxws_2

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4184718#4184718

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4184718



More information about the jboss-user mailing list