You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by James Brady <jc...@cam.ac.uk> on 2004/12/08 23:16:17 UTC

Deploying a simple handler

Hi,
I'm trying to put a simple handler on the request flow of a service. My
handler extends org.apache.axis.handlers.BasicHandler (implementing
invoke() and nothing else). The AdminClient deploys the service OK, but
when viewing the list of deployed services, I get a ClassCastException:

Exception - org.apache.axis.ConfigurationException:
java.lang.ClassCastException java.lang.ClassCastException
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.makeNewInstance(WSDDDeployableItem.java:338)

(full stacktrace at the end of this message).

The relevant part of the wsdd file:
  <service ... > ...
    <requestFlow>
      <handler type="java:myPkg.MyHandler"/>
    </requestFlow> ...
  </service>

This is all using tomcat 5.5.4-compat and axis 1.1.

Others have had this problem trying to deploy JAX-RPC handlers as
org.apache.axis.handlers.Handlers, and vice versa, but I'm not doing that -
can anyone see where I'm going wrong?

Any help appreciated!
James

(full stacktrace follows) Exception -
org.apache.axis.ConfigurationException: java.lang.ClassCastException
java.lang.ClassCastException
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.makeNewInstance(WSDDDeployableItem.java:338)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:310)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:296)
         at 
org.apache.axis.deployment.wsdd.WSDDChain.makeNewInstance(WSDDChain.java:164)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:310)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:296)
         at 
org.apache.axis.deployment.wsdd.WSDDService.makeNewInstance(WSDDService.java:439)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployment.getDeployedServices(WSDDDeployment.java:559)
         at 
org.apache.axis.configuration.FileProvider.getDeployedServices(FileProvider.java:321)
         at 
org.apache.axis.transport.http.AxisServlet.reportAvailableServices(AxisServlet.java:681)
         at
org.apache.axis.transport.http.AxisServlet.doGet(AxisServlet.java:262)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         at 
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
         at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:526)
         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:825)
         at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:731)
         at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
         at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:534)


Strange ClassCastException from a handler

Posted by James Brady <jc...@cam.ac.uk>.
I'm having trouble deploying a custom handler into the requestFlow of a 
service - I've tried everything I can think of, but got nowhere :(

The WSDD file is processed without error. The problem appears when viewing 
the AxisServlet: Exception - org.apache.axis.ConfigurationException: 
java.lang.ClassCastException java.lang.ClassCastException
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.makeNewInstance(WSDDDeployableItem.java:338)

My handler class:
package gs.psource.handlers;
// imports
public class CDDBHandler extends BasicHandler {
    public void invoke(MessageContext mc) throws AxisFault {
    }
}

Yes, it is empty - it is in a jar file placed in tomcat's shared/lib 
directory. The handler is included in my WSDD file:
    <requestFlow>
      <handler name="CDDBHandler" 
type="java:gs.psource.handlers.CDDBHandler"/>
    </requestFlow>

I know the handler is to blame, because when I comment out this part of the 
WSDD file, AxisServlet works correctly. However, I have also been able to 
deploy other, identical, custom handlers from different packages.

Using:
tomcat-5.54-compat
axis-1.1
j2sdk-1.4.2
(Full WSDD file and stacktrace below)


This has beaten me - has anyone got any ideas?
James

---- deploy.wsdd -----------------------------------------------

<deployment
  xmlns="http://xml.apache.org/axis/wsdd/"
  xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

  <!-- Services from PrimarySourceService WSDL service -->

  <service name="PrimarySource" provider="java:RPC" style="rpc" 
use="literal">
    <parameter name="wsdlTargetNamespace" 
value="http://localhost:8080/axis/services/PrimarySource"/>
    <parameter name="wsdlServiceElement" value="PrimarySourceService"/>
    <parameter name="wsdlServicePort" value="PrimarySource"/>
    <parameter name="className" 
value="gs.psource.PrimarySourceSoapBindingImpl"/>
    <parameter name="wsdlPortType" value="PrimarySourcePortType"/>
    <operation name="doQuery" qname="doQuery" 
returnQName="retNS:PrimaryResult" 
xmlns:retNS="http://localhost:8080/ns/PrimarySource" 
returnType="rtns:primaryResultType" 
xmlns:rtns="http://localhost:8080/ns/PrimarySource" >
      <parameter qname="pns:PrimaryRequest" 
xmlns:pns="http://localhost:8080/ns/PrimarySource" 
type="tns:primaryRequestType" 
xmlns:tns="http://localhost:8080/ns/PrimarySource"/>
      <fault name="doQueryFault" qname="fns:NotFound" 
xmlns:fns="http://localhost:8080/ns/PrimarySource" 
class="gs.psource.NotFoundType" type="tns:NotFoundType" 
xmlns:tns="http://localhost:8080/ns/PrimarySource"/>
    </operation>
    <parameter name="allowedMethods" value="doQuery"/>

    <requestFlow>
      <handler name="CDDBHandler" 
type="java:gs.psource.handlers.CDDBHandler"/>
      <handler name="TestHandler" type="java:spikes.TestHandler"/>
    </requestFlow>

    <typeMapping
      xmlns:ns="http://localhost:8080/ns/PrimarySource"
      qname="ns:primaryResultType"
      type="java:gs.psource.PrimaryResultType"
      serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
      deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
      encodingStyle=""
      />
    <typeMapping
      xmlns:ns="http://localhost:8080/ns/PrimarySource"
      qname="ns:primaryResultType>metadata"
      type="java:gs.psource.PrimaryResultType_metadata"
      serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
      deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
      encodingStyle=""
      />
    <typeMapping
      xmlns:ns="http://localhost:8080/ns/PrimarySource"
      qname="ns:primaryResultType>primaryResult>track"
      type="java:gs.psource.PrimaryResultType_primaryResult_track"
      serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
      deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
      encodingStyle=""
      />
    <typeMapping
      xmlns:ns="http://localhost:8080/ns/PrimarySource"
      qname="ns:primaryResultType>primaryResult"
      type="java:gs.psource.PrimaryResultType_primaryResult"
      serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
      deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
      encodingStyle=""
      />
    <typeMapping
      xmlns:ns="http://localhost:8080/ns/PrimarySource"
      qname="ns:primaryRequestType"
      type="java:gs.psource.PrimaryRequestType"
      serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
      deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
      encodingStyle=""
      />
    <typeMapping
      xmlns:ns="http://localhost:8080/ns/PrimarySource"
      qname="ns:NotFoundType"
      type="java:gs.psource.NotFoundType"
      serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
      deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
      encodingStyle=""
      />
  </service>
</deployment>

---- stacktrace ------------------------------------------------------ 
2004-12-11 15:47:16,984 [http-8080-Processor24] INFO 
org.apache.axis.EXCEPTIONS - Exception: 
org.apache.axis.ConfigurationException: java.lang.ClassCastException 
java.lang.ClassCastException
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.makeNewInstance(WSDDDeployableItem.java:338)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:310)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:296)
         at 
org.apache.axis.deployment.wsdd.WSDDChain.makeNewInstance(WSDDChain.java:164)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:310)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:296)
         at 
org.apache.axis.deployment.wsdd.WSDDService.makeNewInstance(WSDDService.java:439)
         at 
org.apache.axis.deployment.wsdd.WSDDDeployment.getDeployedServices(WSDDDeployment.java:559)
         at 
org.apache.axis.configuration.FileProvider.getDeployedServices(FileProvider.java:321)
         at 
org.apache.axis.transport.http.AxisServlet.reportAvailableServices(AxisServlet.java:681)
	at org.apache.axis.transport.http.AxisServlet.doGet(AxisServlet.java:262)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         at 
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
         at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         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:825)
         at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:731)
         at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
         at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:534)