cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dennis Kieselhorst (JIRA)" <j...@apache.org>
Subject [jira] Updated: (CXF-2056) InstantiationException deserializing an collection with abstract type
Date Sun, 22 Feb 2009 13:47:04 GMT

     [ https://issues.apache.org/jira/browse/CXF-2056?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Dennis Kieselhorst updated CXF-2056:
------------------------------------

    Description: 
I have a CustomerAccount class with a list of CustomerContract. CustomerContract contains
a list of the abstract type CustomerProduct. The concrete types are configured using rootClassNames
in the AegisContext on server side. 

It even fails if the list is empty:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns1:getCustomerAccountResponse xmlns:ns1="http://service.mydomain.tld/">
         <ns1:return>
            <ns2:accountNumber xmlns:ns2="http://container.service.mydomain.tld">12345</ns2:accountNumber>
            <ns2:contracts xmlns:ns2="http://container.service.mydomain.tld">
               <ns2:CustomerContract>
                  <ns2:contractId>15</ns2:contractId>
                  <ns2:contractRef ns3:nil="true" xmlns:ns3="http://www.w3.org/2001/XMLSchema-instance"/>
                  <ns2:packageId>377</ns2:packageId>
                  <ns2:products/><!-- the empty list element -->
               </ns2:CustomerContract>
            </ns2:contracts>
         </ns1:return>
      </ns1:getCustomerAccountResponse>
   </soap:Body>
</soap:Envelope>

Deserialization fails with the following exception:
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now Couldn't instantiate class. null. Nested
exception is java.lang.InstantiationException: null
org.apache.cxf.interceptor.Fault: Couldn't instantiate class. null. Nested exception is java.lang.InstantiationException:
null
        at org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:49)
        at org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:34)
        at org.apache.cxf.interceptor.DocLiteralInInterceptor.getPara(DocLiteralInInterceptor.java:235)
        at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:120)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
        at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:641)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2106)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1984)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1909)
        at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
        at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:170)
        at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
        at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:601)
        at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:469)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
        at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
        at $Proxy27.getCustomerAccount(Unknown Source)
        (...)
Caused by: org.apache.cxf.aegis.DatabindingException: Couldn't instantiate class. null. Nested
exception is java.lang.InstantiationException: null
        at org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:171)
        at org.apache.cxf.aegis.type.basic.ArrayType.readCollection(ArrayType.java:86)
        at org.apache.cxf.aegis.type.collection.CollectionType.readObject(CollectionType.java:52)
        at org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:151)
        at org.apache.cxf.aegis.type.basic.ArrayType.readCollection(ArrayType.java:86)
        at org.apache.cxf.aegis.type.collection.CollectionType.readObject(CollectionType.java:52)
        at org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:151)
        at org.apache.cxf.aegis.AegisXMLStreamDataReader.read(AegisXMLStreamDataReader.java:82)
        at org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:47)
        ... 55 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:121)
        ... 63 more

If I remove the abstract from the CustomerProduct class, everything works fine.

  was:
I have a CustomerAccount class with a list of CustomerContract. CustomerContract contains
a list of the abstract type CustomerProduct. The concrete types are configured using rootClassNames
in the AegisContext on server side. Everything works unless this list is empty.

In this case the soap response look like this:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns1:getCustomerAccountResponse xmlns:ns1="http://service.mydomain.tld/">
         <ns1:return>
            <ns2:accountNumber xmlns:ns2="http://container.service.mydomain.tld">12345</ns2:accountNumber>
            <ns2:contracts xmlns:ns2="http://container.service.mydomain.tld">
               <ns2:CustomerContract>
                  <ns2:contractId>15</ns2:contractId>
                  <ns2:contractRef ns3:nil="true" xmlns:ns3="http://www.w3.org/2001/XMLSchema-instance"/>
                  <ns2:packageId>377</ns2:packageId>
                  <ns2:products/><!-- the empty list element -->
               </ns2:CustomerContract>
            </ns2:contracts>
         </ns1:return>
      </ns1:getCustomerAccountResponse>
   </soap:Body>
</soap:Envelope>

Deserialization fails with the following exception:
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now Couldn't instantiate class. null. Nested
exception is java.lang.InstantiationException: null
org.apache.cxf.interceptor.Fault: Couldn't instantiate class. null. Nested exception is java.lang.InstantiationException:
null
        at org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:49)
        at org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:34)
        at org.apache.cxf.interceptor.DocLiteralInInterceptor.getPara(DocLiteralInInterceptor.java:235)
        at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:120)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
        at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:641)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2106)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1984)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1909)
        at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
        at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:170)
        at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
        at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:601)
        at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:469)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
        at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
        at $Proxy27.getCustomerAccount(Unknown Source)
        (...)
Caused by: org.apache.cxf.aegis.DatabindingException: Couldn't instantiate class. null. Nested
exception is java.lang.InstantiationException: null
        at org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:171)
        at org.apache.cxf.aegis.type.basic.ArrayType.readCollection(ArrayType.java:86)
        at org.apache.cxf.aegis.type.collection.CollectionType.readObject(CollectionType.java:52)
        at org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:151)
        at org.apache.cxf.aegis.type.basic.ArrayType.readCollection(ArrayType.java:86)
        at org.apache.cxf.aegis.type.collection.CollectionType.readObject(CollectionType.java:52)
        at org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:151)
        at org.apache.cxf.aegis.AegisXMLStreamDataReader.read(AegisXMLStreamDataReader.java:82)
        at org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:47)
        ... 55 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:121)
        ... 63 more

If I remove the abstract from the CustomerProduct class, everything works fine.

        Summary: InstantiationException deserializing an collection with abstract type  (was:
InstantiationException deserializing an empty collection with abstract type)

> InstantiationException deserializing an collection with abstract type
> ---------------------------------------------------------------------
>
>                 Key: CXF-2056
>                 URL: https://issues.apache.org/jira/browse/CXF-2056
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.1.3, 2.1.5
>         Environment: Windows XP, Java 1.5
>            Reporter: Dennis Kieselhorst
>
> I have a CustomerAccount class with a list of CustomerContract. CustomerContract contains
a list of the abstract type CustomerProduct. The concrete types are configured using rootClassNames
in the AegisContext on server side. 
> It even fails if the list is empty:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <ns1:getCustomerAccountResponse xmlns:ns1="http://service.mydomain.tld/">
>          <ns1:return>
>             <ns2:accountNumber xmlns:ns2="http://container.service.mydomain.tld">12345</ns2:accountNumber>
>             <ns2:contracts xmlns:ns2="http://container.service.mydomain.tld">
>                <ns2:CustomerContract>
>                   <ns2:contractId>15</ns2:contractId>
>                   <ns2:contractRef ns3:nil="true" xmlns:ns3="http://www.w3.org/2001/XMLSchema-instance"/>
>                   <ns2:packageId>377</ns2:packageId>
>                   <ns2:products/><!-- the empty list element -->
>                </ns2:CustomerContract>
>             </ns2:contracts>
>          </ns1:return>
>       </ns1:getCustomerAccountResponse>
>    </soap:Body>
> </soap:Envelope>
> Deserialization fails with the following exception:
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> INFO: Interceptor has thrown exception, unwinding now Couldn't instantiate class. null.
Nested exception is java.lang.InstantiationException: null
> org.apache.cxf.interceptor.Fault: Couldn't instantiate class. null. Nested exception
is java.lang.InstantiationException: null
>         at org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:49)
>         at org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:34)
>         at org.apache.cxf.interceptor.DocLiteralInInterceptor.getPara(DocLiteralInInterceptor.java:235)
>         at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:120)
>         at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
>         at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:641)
>         at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2106)
>         at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1984)
>         at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1909)
>         at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
>         at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:170)
>         at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
>         at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:601)
>         at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>         at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:469)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
>         at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>         at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
>         at $Proxy27.getCustomerAccount(Unknown Source)
>         (...)
> Caused by: org.apache.cxf.aegis.DatabindingException: Couldn't instantiate class. null.
Nested exception is java.lang.InstantiationException: null
>         at org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:171)
>         at org.apache.cxf.aegis.type.basic.ArrayType.readCollection(ArrayType.java:86)
>         at org.apache.cxf.aegis.type.collection.CollectionType.readObject(CollectionType.java:52)
>         at org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:151)
>         at org.apache.cxf.aegis.type.basic.ArrayType.readCollection(ArrayType.java:86)
>         at org.apache.cxf.aegis.type.collection.CollectionType.readObject(CollectionType.java:52)
>         at org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:151)
>         at org.apache.cxf.aegis.AegisXMLStreamDataReader.read(AegisXMLStreamDataReader.java:82)
>         at org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:47)
>         ... 55 more
> Caused by: java.lang.InstantiationException
>         at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>         at java.lang.Class.newInstance0(Class.java:350)
>         at java.lang.Class.newInstance(Class.java:303)
>         at org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:121)
>         ... 63 more
> If I remove the abstract from the CustomerProduct class, everything works fine.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message