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 Martin Wunderlich <ma...@gmx.net> on 2006/05/08 09:58:40 UTC

AxisFault: java.lang.reflect.InvocationTargetException when passing complex type to service

Dear all,

Having resolved one problem, I am now stuck with a new one.
I have an Axis 1.3 web service deployed to Tomcat 5.5.4 running on Windows XP Pro. The web service offers several methods. One of these is returning a simple String and it works fine. Another method, which takes as input a complex type, will give me the following error when I invoke the call from the client:


AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: java.lang.reflect.InvocationTargetException
 faultActor: 
 faultNode: 
 faultDetail: 
        {http://xml.apache.org/axis/}hostname:Hermes
 
java.lang.reflect.InvocationTargetException
        at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
        at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
        at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:379)
        at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
        at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
        at org.apache.axis.client.Call.invoke(Call.java:2748)
        at org.apache.axis.client.Call.invoke(Call.java:2424)
        at org.apache.axis.client.Call.invoke(Call.java:2347)
        at org.apache.axis.client.Call.invoke(Call.java:1804)
        at mypackage.webservices.TermShareHandlerSoapBindingStub.register(TermShareHandlerSoapBindingStub.java:271)
        at mypackage.webservices.TermShareClient.register(TermShareClient.java:76)
        at mypackage.webservices.TermShareClientGUI.doRegister(TermShareClientGUI.java:619)
        at mypackage.webservices.TermShareClientGUI.actionPerformed(TermShareClientGUI.java:600)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
        at java.awt.Component.processMouseEvent(Component.java:5488)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
        at java.awt.Component.processEvent(Component.java:5253)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3955)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
        at java.awt.Container.dispatchEventImpl(Container.java:2010)
        at java.awt.Window.dispatchEventImpl(Window.java:1774)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)



The method "register" should take a User object and write it to a database. The relevant section of the WSDL is pasted below. I have also included the bit about the method "sayHello", which works perfectly fine. 
I am pretty lost here as to what the reason could be and I'd appreciate any help. 
Thanks a lot!

Cheers, 

Martin




<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:mypackage.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="urn:mypackage.com" xmlns:intf="urn:mypackage.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://dataObjects.database.mypackage.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2.1
Built on Jun 14, 2005 (09:15:57 EDT)-->
 <wsdl:types>
  <schema targetNamespace="urn:mypackage.com" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://dataObjects.database.mypackage.com"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="ArrayOf_xsd_anyType">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]"/>
     </restriction>
    </complexContent>
   </complexType>
   <complexType name="TermShareException">
    <sequence/>
   </complexType>
  </schema>
  <schema targetNamespace="http://dataObjects.database.mypackage.com" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="urn:mypackage.com"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType abstract="true" name="AbstractUser">
    <sequence>
     <element name="contactsForUser1" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
     <element name="contactsForUser2" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
     <element name="email" nillable="true" type="soapenc:string"/>
     <element name="firstName" nillable="true" type="soapenc:string"/>
     <element name="id" nillable="true" type="soapenc:int"/>
     <element name="invitationsForInvitedUser" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
     <element name="invitationsForInvitingUser" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
     <element name="lastName" nillable="true" type="soapenc:string"/>
     <element name="password" nillable="true" type="soapenc:string"/>
     <element name="projects" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
     <element name="sourcelanguages" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
     <element name="targetlanguages" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
     <element name="targetteams" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
    </sequence>
   </complexType>
   <complexType name="User">
    <complexContent>
     <extension base="tns1:AbstractUser">
      <sequence/>
     </extension>
    </complexContent>
   </complexType>
 
   [...snip...]
   
   </schema>
 </wsdl:types>
   <wsdl:message name="registerRequest">
   
       <wsdl:part name="in0" type="tns1:User"/>
   
   </wsdl:message>
   
   <wsdl:message name="sayHelloRequest">
 
      <wsdl:part name="in0" type="soapenc:string"/>
 
   </wsdl:message>
 
   <wsdl:message name="registerResponse">
 
      <wsdl:part name="registerReturn" type="soapenc:int"/>
 
   </wsdl:message>
 
   <wsdl:message name="sayHelloResponse">
 
      <wsdl:part name="sayHelloReturn" type="soapenc:string"/>
 
   </wsdl:message>
 
   <wsdl:message name="TermShareException">
 
      <wsdl:part name="fault" type="impl:TermShareException"/>
 
   </wsdl:message>
   
   [...snip...]
 
   <wsdl:portType name="ITermShareHandler">
 
      <wsdl:operation name="register" parameterOrder="in0">
 
         <wsdl:input message="impl:registerRequest" name="registerRequest"/>
 
         <wsdl:output message="impl:registerResponse" name="registerResponse"/>
 
         <wsdl:fault message="impl:TermShareException" name="TermShareException"/>
 
      </wsdl:operation>
 
      [...snip...]
 
      <wsdl:operation name="sayHello" parameterOrder="in0">
 
         <wsdl:input message="impl:sayHelloRequest" name="sayHelloRequest"/>
 
         <wsdl:output message="impl:sayHelloResponse" name="sayHelloResponse"/>
 
      </wsdl:operation>
 
   </wsdl:portType>
 
   <wsdl:binding name="TermShareHandlerSoapBinding" type="impl:ITermShareHandler">
 
      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
 
      <wsdl:operation name="register">
 
         <wsdlsoap:operation soapAction=""/>
 
         <wsdl:input name="registerRequest">
 
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:mypackage.com" use="encoded"/>
 
         </wsdl:input>
 
         <wsdl:output name="registerResponse">
 
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:mypackage.com" use="encoded"/>
 
         </wsdl:output>
 
         <wsdl:fault name="TermShareException">
 
            <wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="TermShareException" namespace="urn:mypackage.com" use="encoded"/>
 
         </wsdl:fault>
 
      </wsdl:operation>
 
      [...snip...]
 
      <wsdl:operation name="sayHello">
 
         <wsdlsoap:operation soapAction=""/>
 
         <wsdl:input name="sayHelloRequest">
 
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:mypackage.com" use="encoded"/>
 
         </wsdl:input>
 
         <wsdl:output name="sayHelloResponse">
 
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:mypackage.com" use="encoded"/>
 
         </wsdl:output>
 
      </wsdl:operation>
 
   </wsdl:binding>
 
   <wsdl:service name="ITermShareHandlerService">
 
      <wsdl:port binding="impl:TermShareHandlerSoapBinding" name="TermShareHandler">
 
         <wsdlsoap:address location="http://localhost/TermShare3/services/TermShareHandler"/>
 
      </wsdl:port>
 
   </wsdl:service>
 
</wsdl:definitions>




Re[2]: AxisFault: java.lang.reflect.InvocationTargetException when passing complex type to service

Posted by Martin Wunderlich <ma...@gmx.net>.
Hi Annette,

I turned that the problem was totally unrelated to Axis, but rather to
the Hibernate persistence layer that is working in the background of
my app. I had to include the Hibernate jar and its depedent libraries
in the Tomcat shared folder. I think it would be very unlikely that
your problem has the same cause.

Cheers,

Martin

> Hey Martin,

> I just stumbled on the same problem.
> Which jars did you have to include? I thought I had all of them, but then I
> can't be too sure ...

> Thanks,
> Annette




Re: AxisFault: java.lang.reflect.InvocationTargetException when passing complex type to service

Posted by Annette Vetter <an...@gmail.com>.
Hey Martin,

I just stumbled on the same problem.
Which jars did you have to include? I thought I had all of them, but then I
can't be too sure ...

Thanks,
Annette



On 5/8/06, Martin Wunderlich <ma...@gmx.net> wrote:
>
> Just a little update here: After some debugging I finally found the
> root cause for this. I took a while to get to it, because I was
> catching an Exception instead of Throwable and only the latter gave me
> the real cause for my troubles. It turned out that it was some missing
> Jars, which hadn't been copied over to the Tomcat directories from
> Eclipse.
>
> Cheers,
>
> Martin
>
>
> > Dear all,
>
> > Having resolved one problem, I am now stuck with a new one.
> > I have an Axis 1.3 web service deployed to Tomcat 5.5.4 running on
> > Windows XP Pro. The web service offers several methods. One of these
> > is returning a simple String and it works fine. Another method,
> > which takes as input a complex type, will give me the following
> > error when I invoke the call from the client:
>
>
> > AxisFault
> >  faultCode:
> > {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> >  faultSubcode:
> >  faultString: java.lang.reflect.InvocationTargetException
> >  faultActor:
> >  faultNode:
> >  faultDetail:
> >         {http://xml.apache.org/axis/}hostname:Hermes
> >
> > java.lang.reflect.InvocationTargetException
>
>
>

Re: AxisFault: java.lang.reflect.InvocationTargetException when passing complex type to service

Posted by Martin Wunderlich <ma...@gmx.net>.
Just a little update here: After some debugging I finally found the
root cause for this. I took a while to get to it, because I was
catching an Exception instead of Throwable and only the latter gave me
the real cause for my troubles. It turned out that it was some missing
Jars, which hadn't been copied over to the Tomcat directories from
Eclipse.

Cheers,

Martin


> Dear all,

> Having resolved one problem, I am now stuck with a new one.
> I have an Axis 1.3 web service deployed to Tomcat 5.5.4 running on
> Windows XP Pro. The web service offers several methods. One of these
> is returning a simple String and it works fine. Another method,
> which takes as input a complex type, will give me the following
> error when I invoke the call from the client:


> AxisFault
>  faultCode:
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
>  faultSubcode: 
>  faultString: java.lang.reflect.InvocationTargetException
>  faultActor: 
>  faultNode: 
>  faultDetail: 
>         {http://xml.apache.org/axis/}hostname:Hermes
>  
> java.lang.reflect.InvocationTargetException