XFire
  1. XFire
  2. XFIRE-831

java.lang.StackOverflowError when passing Object[]

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.4
    • Fix Version/s: None
    • Component/s: Aegis Module
    • Labels:
      None
    • Number of attachments :
      2

      Description

      ========soap request================
      <?xml version="1.0" encoding="UTF-8"?>
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
      <objectArrayTest xmlns="http://abc.com/V1">
      <params>
      <xsd:anyType>1</xsd:anyType>
      <xsd:anyType>2</xsd:anyType>
      </params>
      </objectArrayTest>
      </soapenv:Body>
      </soapenv:Envelope>

      ===========wsdl snippet========
      <xsd:element name="objectArrayTest">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element maxOccurs="1" minOccurs="1" name="params" nillable="true" type="xsd:ArrayOfAnyType"/>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>

      <xsd:complexType name="ArrayOfAnyType">
      <xsd:sequence>
      <xsd:element maxOccurs="unbounded" minOccurs="0" name="anyType" nillable="true" type="xsd:anyType"/>
      </xsd:sequence>
      </xsd:complexType>

      ==================java.lang.StackOverflowError================
      java.lang.StackOverflowError
      com.ctc.wstx.sr.NsAttributeCollector.getValue(NsAttributeCollector.java:293)
      com.ctc.wstx.sr.WstxStreamReader.getAttributeValue(WstxStreamReader.java:534)
      org.codehaus.xfire.util.stax.DepthXMLStreamReader.getAttributeValue(DepthXMLStreamReader.java:75)
      org.codehaus.xfire.util.stax.DepthXMLStreamReader.getAttributeValue(DepthXMLStreamReader.java:75)
      org.codehaus.xfire.aegis.stax.ElementReader.getAttributeReader(ElementReader.java:251)
      org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:70)
      org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133)
      org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133)
      org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133)
      .......
      org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133)
      org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133)
      org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133)
      =============xfire code=======
      org.codehaus.xfire.aegis.type.basic.ObjectType:
      110: type = tm.getType( typeQName );

      <code>type</code> here always returns the same instance causing the recursion to stackoverflow.

      1. xfire.patch
        1 kB
        wodzu
      2. XFireAegis831Test.java
        2 kB
        Artem Melentyev

        Activity

        Hide
        Klaas Prause added a comment -

        I have the same error (StackOverflow) when I am using a Map<String, Object> where the values can be collections of Map<String, Object>, for transfering something like:
        <name>
        <first>Firstname</first>
        <last>Lastname</last>
        </name>
        <key>akey</key>

        I think this error prevents the embedding of Maps or Collections into any Map or Collection with a value of Object (AnyType). Is there a workaround for this error?

        Show
        Klaas Prause added a comment - I have the same error (StackOverflow) when I am using a Map<String, Object> where the values can be collections of Map<String, Object>, for transfering something like: <name> <first>Firstname</first> <last>Lastname</last> </name> <key>akey</key> I think this error prevents the embedding of Maps or Collections into any Map or Collection with a value of Object (AnyType). Is there a workaround for this error?
        Hide
        Artem Melentyev added a comment -

        I got the same stacktrace then try to create following test service:

        public static class TestRpc implements ITestRpc {
        	public Object call1() { return new myclass(); } // fail
        	public myclass call0() { return new myclass(); } // ok 
        	public Object[] call2() { return new Object[]{new myclass()}; } // fail
        	public Object[] call3() { return new Object[]{"123"}; } // ok
        }
        

        Tested in xfire-1.2.4 and 1.2.3 with registration myclass (without registration in 1.2.3 I got "Type is unknown").

        Attached file XFireAegis831Test.java - junit test of this.

        Show
        Artem Melentyev added a comment - I got the same stacktrace then try to create following test service: public static class TestRpc implements ITestRpc { public Object call1() { return new myclass(); } // fail public myclass call0() { return new myclass(); } // ok public Object [] call2() { return new Object []{ new myclass()}; } // fail public Object [] call3() { return new Object []{ "123" }; } // ok } Tested in xfire-1.2.4 and 1.2.3 with registration myclass (without registration in 1.2.3 I got "Type is unknown"). Attached file XFireAegis831Test.java - junit test of this.
        Hide
        Gilles Delaby added a comment -

        I have the same problem with version 1.2.5.
        Is there something planned for this error ?

        java.lang.StackOverflowError
        at com.ctc.wstx.sr.NsAttributeCollector.getValue(NsAttributeCollector.java:329)
        at com.ctc.wstx.sr.BasicStreamReader.getAttributeValue(BasicStreamReader.java:643)
        at org.codehaus.xfire.util.stax.DepthXMLStreamReader.getAttributeValue(DepthXMLStreamReader.java:75)
        at org.codehaus.xfire.util.stax.DepthXMLStreamReader.getAttributeValue(DepthXMLStreamReader.java:75)
        at org.codehaus.xfire.aegis.stax.ElementReader.getAttributeReader(ElementReader.java:256)
        at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:70)
        at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133)
        at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133)
        at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133)
        at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133)
        at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133)
        at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133)
        at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133)
        ...

        Show
        Gilles Delaby added a comment - I have the same problem with version 1.2.5. Is there something planned for this error ? java.lang.StackOverflowError at com.ctc.wstx.sr.NsAttributeCollector.getValue(NsAttributeCollector.java:329) at com.ctc.wstx.sr.BasicStreamReader.getAttributeValue(BasicStreamReader.java:643) at org.codehaus.xfire.util.stax.DepthXMLStreamReader.getAttributeValue(DepthXMLStreamReader.java:75) at org.codehaus.xfire.util.stax.DepthXMLStreamReader.getAttributeValue(DepthXMLStreamReader.java:75) at org.codehaus.xfire.aegis.stax.ElementReader.getAttributeReader(ElementReader.java:256) at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:70) at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133) at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133) at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133) at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133) at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133) at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133) at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:133) ...
        Hide
        Vitaliy Tymchyshyn added a comment -

        Same problem for enums as Map Keys or Values.
        Tested on 1.2.6

        Show
        Vitaliy Tymchyshyn added a comment - Same problem for enums as Map Keys or Values. Tested on 1.2.6
        Hide
        Alexander Filipchik added a comment -

        I have same problem with:
        <?xml version="1.0" encoding="UTF-8"?>
        <wsdl:definitions targetNamespace="http://transport.ps.lanit.ru"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:impl="http://transport.ps.lanit.ru"
        xmlns:intf="http://transport.ps.lanit.ru"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">

        <wsdl:types>
        <schema elementFormDefault="qualified" targetNamespace="http://transport.ps.lanit.ru"
        xmlns="http://www.w3.org/2001/XMLSchema">
        <xsd:element name="putRequest">
        <xsd:complexType>
        <xsd:sequence>
        <xsd:element name="data" type="xsd:string"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:element>
        <xsd:element name="putResponse">
        <xsd:complexType>
        <xsd:sequence>
        <xsd:element name="data" type="xsd:string"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:element>
        <xsd:element name="getRequest">
        <xsd:complexType>
        <xsd:sequence>
        <xsd:element name="data" type="xsd:string"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:element>
        <xsd:element name="getResponse">
        <xsd:complexType>
        <xsd:sequence>
        <xsd:element name="data" type="xsd:string"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:element>
        </schema>
        </wsdl:types>

        <wsdl:message name="putRequest">
        <wsdl:part name="payload" element="impl:putRequest"/>
        </wsdl:message>

        <wsdl:message name="putResponse">
        <wsdl:part name="payload" element="impl:putResponse"/>
        </wsdl:message>

        <wsdl:message name="getRequest">
        <wsdl:part name="payload" element="impl:getRequest"/>
        </wsdl:message>

        <wsdl:message name="getResponse">
        <wsdl:part name="payload" element="impl:getResponse"/>
        </wsdl:message>

        <wsdl:portType name="TransportService">
        <wsdl:operation name="put">
        <wsdl:input message="impl:putRequest"/>
        <wsdl:output message="impl:putResponse"/>
        </wsdl:operation>
        <wsdl:operation name="get">
        <wsdl:input message="impl:getRequest"/>
        <wsdl:output message="impl:getResponse"/>
        </wsdl:operation>
        </wsdl:portType>

        <wsdl:binding name="TransportServiceSoapBinding" type="impl:TransportService">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="put">
        <wsdl:input name="putRequest">
        <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output name="putResponse">
        <soap:body use="literal"/>
        </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="get">
        <wsdl:input name="getRequest">
        <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output name="getResponse">
        <soap:body use="literal"/>
        </wsdl:output>
        </wsdl:operation>
        </wsdl:binding>

        <wsdl:service name="TransportService">
        <wsdl:port binding="impl:TransportServiceSoapBinding" name="soap">
        <soap:address location="http://localhost:8192/TransportService/"/>
        </wsdl:port>
        </wsdl:service>

        </wsdl:definitions>

        Show
        Alexander Filipchik added a comment - I have same problem with: <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://transport.ps.lanit.ru" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:impl="http://transport.ps.lanit.ru" xmlns:intf="http://transport.ps.lanit.ru" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:types> <schema elementFormDefault="qualified" targetNamespace="http://transport.ps.lanit.ru" xmlns="http://www.w3.org/2001/XMLSchema"> <xsd:element name="putRequest"> <xsd:complexType> <xsd:sequence> <xsd:element name="data" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="putResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="data" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="getRequest"> <xsd:complexType> <xsd:sequence> <xsd:element name="data" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="getResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="data" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> </schema> </wsdl:types> <wsdl:message name="putRequest"> <wsdl:part name="payload" element="impl:putRequest"/> </wsdl:message> <wsdl:message name="putResponse"> <wsdl:part name="payload" element="impl:putResponse"/> </wsdl:message> <wsdl:message name="getRequest"> <wsdl:part name="payload" element="impl:getRequest"/> </wsdl:message> <wsdl:message name="getResponse"> <wsdl:part name="payload" element="impl:getResponse"/> </wsdl:message> <wsdl:portType name="TransportService"> <wsdl:operation name="put"> <wsdl:input message="impl:putRequest"/> <wsdl:output message="impl:putResponse"/> </wsdl:operation> <wsdl:operation name="get"> <wsdl:input message="impl:getRequest"/> <wsdl:output message="impl:getResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="TransportServiceSoapBinding" type="impl:TransportService"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="put"> <wsdl:input name="putRequest"> <soap:body use="literal"/> </wsdl:input> <wsdl:output name="putResponse"> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="get"> <wsdl:input name="getRequest"> <soap:body use="literal"/> </wsdl:input> <wsdl:output name="getResponse"> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="TransportService"> <wsdl:port binding="impl:TransportServiceSoapBinding" name="soap"> <soap:address location="http://localhost:8192/TransportService/"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
        Hide
        Duncan Jauncey added a comment -

        I think I had a similar problem - at least, I had a Map<String,Object> where the values were of different types. It worked until there was an instance of a class that I'd defined that happened to be one of the values. I've managed to get round it by defining <a href="http://www.duncanjauncey.com/blog/?p=57">a custom type mapping</a>.

        Show
        Duncan Jauncey added a comment - I think I had a similar problem - at least, I had a Map<String,Object> where the values were of different types. It worked until there was an instance of a class that I'd defined that happened to be one of the values. I've managed to get round it by defining <a href="http://www.duncanjauncey.com/blog/?p=57">a custom type mapping</a>.
        Hide
        Duncan Jauncey added a comment -

        Apologies - apparently you can't post html.

        That link again: http://www.duncanjauncey.com/blog/?p=57

        Show
        Duncan Jauncey added a comment - Apologies - apparently you can't post html. That link again: http://www.duncanjauncey.com/blog/?p=57
        Hide
        wodzu added a comment -

        Attached patch solves the problem. It was generated on the source code taken from svn 2187 release.

        Show
        wodzu added a comment - Attached patch solves the problem. It was generated on the source code taken from svn 2187 release.

          People

          • Assignee:
            Dan Diephouse
            Reporter:
            Karthikeyan M.
          • Votes:
            11 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

            • Created:
              Updated: