1. Axis
  2. AXIS-2593

java.lang.IllegalArgumentException: array element type mismatch


    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.4
    • Fix Version/s: None
    • Labels:
    • Environment:
      Server: axis 1.4, tomcat 5.0.30, windows xp
      Client: .net 2.0, windows xp


      BeanPropertyTarget unable to convert an array into it's component type

      in some rare cases client received a java.lang.IllegalArgumentException: array element type mismatch, due to a deserialization problem.

      herein you'll find:
      -part of the wsdl
      -part of the soap message
      -part of the axis stack trace
      -modification to the to fix the problem

      part of the wsdl:
      <!-- ... -->
      <complexType name="ResourceArray">
      <element name="resourceArray" nillable="true" type="impl:ArrayOf_tns4_Resource"/>
      <complexType name="ArrayOf_tns4_Resource">
      <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="tns4:Resource[]"/>
      <!-- ... -->
      <wsdl:message name="sendNotificationRequest">
      <wsdl:part name="recipients" type="tns28:ResourceArray"/>
      <!-- ... -->

      part of the SOAP message:
      <?xml version="1.0" encoding="UTF-8"?>
      <soap:Envelope xmlns:soap="" xmlns:soapenc="" xmlns:tns="" xmlns:types="" xmlns:xsi="" xmlns:xsd="">
      <soap:Body soap:encodingStyle="">
      <sessionID xsi:type="xsd:string">2458669038908702720</sessionID>
      <recipients href="#id3"/>
      <q3:ResourceArray id="id3" xsi:type="q3:ResourceArray" xmlns:q3=" ">
      <resourceArray href="#id10"/>
      <soapenc:Array id="id10" xmlns:q10="" soapenc:arrayType="q10:Resource[1]">
      <Item href="#id21"/>
      <q21:Resource id="id21" xsi:type="q21:Resource" xmlns:q21="">
      <ID xsi:type="xsd:string">530E213D72604A0E8F0DC719C33B4310</ID>

      part of the stack trace:
      Caused by: java.lang.IllegalArgumentException: array element type mismatch
      at java.lang.reflect.Array.set(Native Method)
      at org.apache.axis.utils.BeanPropertyDescriptor.set(
      at org.apache.axis.encoding.ser.BeanPropertyTarget.set(
      at org.apache.axis.encoding.DeserializerImpl.valueComplete (
      at org.apache.axis.encoding.ser.ArrayDeserializer.valueComplete(
      at org.apache.axis.encoding.DeserializerImpl.endElement(
      at org.apache.axis.encoding.DeserializationContext.endElement(
      at org.apache.axis.message.SAX2EventRecorder.replay(
      at org.apache.axis.message.MessageElement.publishToHandler (
      at org.apache.axis.encoding.DeserializerImpl.startElement(
      at org.apache.axis.encoding.DeserializationContext.startElement(
      at org.apache.axis.message.SAX2EventRecorder.replay(
      at org.apache.axis.message.MessageElement.publishToHandler(
      at org.apache.axis.encoding.DeserializerImpl.startElement (
      at org.apache.axis.encoding.ser.BeanDeserializer.startElement(
      at org.apache.axis.encoding.DeserializationContext.startElement( :1048)
      at org.apache.axis.message.SAX2EventRecorder.replay(
      at org.apache.axis.message.MessageElement.publishToHandler(
      at org.apache.axis.message.RPCElement.deserialize (
      at org.apache.axis.message.RPCElement.getParams(
      at (

      modification to the to fix the problem:
      in the set(Object value), in the first caught exception I removed the : Object item = JavaUtils.convert(Array.get(value, i), type); since it was always returning an array which end up throwing an illegal argument exception from the pd.set(...) method. So the "if" clause within the catch block would look like this:
      if (JavaUtils.isConvertable(value, type)
      && !value.getClass().isArray())

      { value = JavaUtils.convert(value, type); if (index < 0) pd.set(object, value); else pd.set(object, index, value); }

      else {
      // It is possible that an indexed
      // format was expected, but the
      // entire array was sent. In such
      // cases traverse the array and
      // call the setter for each item.
      if (index == 0 &&
      ) {
      for (int i = 0; i < Array.getLength(value); i++)

      { Object item = JavaUtils.convert( Array.get(value, i), type.getComponentType()); pd.set(object, i, item); }



        There are no comments yet on this issue.


          • Assignee:
            Christian Gosselin
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: