0 Replies Latest reply on May 26, 2006 8:22 AM by Michal STACHURSKI

    jboss-4.0.4.CR2 and webservice handler problem

    Michal STACHURSKI Newbie

      I am deploying a simple service on jboss-4.0.4.CR2. Service itself (without handlers) works excellent. However, when I add simple handler:



      package handlers;
       public class LogHandler extends GenericHandler{
      
       HandlerInfo hi;
      
       public void init(HandlerInfo info){
       this.hi=info;
       }
      
       public boolean handleRequest(MessageContext mc){
       logMessage(mc,System.out);
       return true;
       }
      
       public boolean handleResponse(MessageContext mc){
       logMessage(mc,System.out);
       return true;
       }
      
      
       public void logMessage(MessageContext mc, OutputStream out){
       SOAPMessageContext smc=(SOAPMessageContext)mc;
       SOAPMessage sm=smc.getMessage();
       try{
       sm.writeTo(out);
       out.write(System.getProperty("line.separator").getBytes());
       }catch(IOException e){
       e.printStackTrace(System.out);
       }catch(SOAPException e){
       e.printStackTrace(System.out);
       }
       }
      
       public QName[] getHeaders() {
       return hi.getHeaders();
       }
       }
      
      
      




      in my webservice.xml file

      code:

      <?xml version="1.0" encoding="utf-8"?>
       <webservices xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd" version="1.1">
       <webservice-description>
       <webservice-description-name>Math</webservice-description-name>
       <wsdl-file>WEB-INF/wsdl/Math.wsdl</wsdl-file>
       <jaxrpc-mapping-file>WEB-INF/mapping.xml</jaxrpc-mapping-file>
       <port-component>
       <port-component-name>MathService</port-component-name>
       <wsdl-port>MathServicePort</wsdl-port>
       <service-endpoint-interface>service.MathService</service-endpoint-interface>
       <service-impl-bean>
       <servlet-link>MathServletService</servlet-link>
       </service-impl-bean>
       <handler>
       <handler-name>handlers.LogHandler</handler-name>
       <handler-class>handlers.LogHandler</handler-class>
       </handler>
       </port-component>
       </webservice-description>
       </webservices>
      
      
      


      I am getting this error
      2006-05-26 13:02:13,718 DEBUG [org.jboss.ws.server.ServiceEndpoint] Adding server side handler to service '{http://www.stachurski.com.pl/wsdl}EJBHelloPort': [class=handlers.LogHandler,headers=[],config={}]
      2006-05-26 13:02:13,734 DEBUG [org.jboss.ws.server.ServiceEndpoint] Init handler chain with [1] handlers
      2006-05-26 13:02:13,734 DEBUG [org.jboss.ws.handler.HandlerChainBaseImpl] Create a handler chain for roles: []
      2006-05-26 13:02:13,765 DEBUG [javax.xml.rpc.soap.SOAPFaultException] new SOAPFaultException [code={http://schemas.xmlsoap.org/soap/envelope/}Client,string=javax.xml.rpc.JAXRPCException: Cannot initialize handler chain,actor=null,detail=null]
      2006-05-26 13:02:13,765 ERROR [org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper] SOAP request exception
      javax.xml.rpc.JAXRPCException: Cannot initialize handler chain
       at org.jboss.ws.handler.HandlerChainBaseImpl.addHandlersToChain(HandlerChainBaseImpl.java:135)
       at org.jboss.ws.handler.HandlerChainBaseImpl.<init>(HandlerChainBaseImpl.java:94)
       at org.jboss.ws.handler.ServerHandlerChain.<init>(ServerHandlerChain.java:42)
       at org.jboss.ws.server.ServiceEndpoint.initHandlerChain(ServiceEndpoint.java:363)
       at org.jboss.ws.server.ServiceEndpoint.initHandlerChain(ServiceEndpoint.java:356)
       at org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:211)
       at org.jboss.ws.server.ServiceEndpointServlet.doPost(ServiceEndpointServlet.java:113)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.ClassCastException: handlers.LogHandler
       at org.jboss.ws.handler.HandlerChainBaseImpl.addHandlersToChain(HandlerChainBaseImpl.java:124)
       ... 27 more
      2006-05-26 13:02:13,937 DEBUG [org.jboss.ws.server.ServiceEndpoint] Outgoing SOAPMessage
      <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
       <env:Header/>
       <env:Body>
       <env:Fault>
       <faultcode>env:Client</faultcode>
       <faultstring>javax.xml.rpc.JAXRPCException: Cannot initialize handler chain</faultstring>
       </env:Fault>
       </env:Body>
      </env:Envelope>
      2006-05-26 13:02:13,937 DEBUG [org.jboss.ws.server.ServiceEndpoint] END handleRequest: jboss.ws:di=sessionhello.war,service=HelloEJB,port=EJBHelloPort
      2006-05-26 13:02:13,953 DEBUG [org.jboss.ws.soap.MessageContextAssociation] popMessageContext: org.jboss.ws.soap.SOAPMessageContextImpl@a8198c
      


      I am really despered to sort it out. Have you got any idea ??
      If more info needed, please let me know.


      Michal