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 Steve Maring <ba...@yahoo.com> on 2003/08/20 15:45:01 UTC
Re: Unable to create JavaBean of type . Missing default constructor? Error was: java.lang.InstantiationException
You are outside of the scope and capabilities of the
default type mapping as defined in Chapter 4 & 5 of
the JAX-RPC spec.
You will need to plug in your own (de)serializer.
Someone recently asked the same question. Check the
archives.
Cheers.
Steve Maring
--- karol.sibielak@bawag.com wrote:
>
>
> I have a class "DataObjectConcrete" that extends
> from a base abstract class
> "DataObjectAbstract". My Axis-client calls a method
> which returns class
> "DataObjectConcrete". The method is called and
> processed correctly, but during
> the response deserialization Axis tries to
> instantiate the abstract class
> "DataObjectAbstract" instead of the concrete class
> "DataObjectConcrete".
>
> My client receives the following error message :
>
> 0 [main] ERROR client.Call - Exception:
> org.xml.sax.SAXException: Unable to create JavaBean
> of type
> com.xxx.xxx.xxx.DataObjectAbstract. Missing default
> constructor? Error was:
> java.lang.InstantiationException:
> com.xxx.xxx.xxx.DataObjectAbstract.
> at
>
org.apache.axis.encoding.ser.BeanDeserializer.startElement(BeanDeserializer.java:159)
> at
>
org.apache.axis.encoding.DeserializerImpl.onStartElement(DeserializerImpl.java:481)...
>
>
> In the WSDL (generated by java2wsdl) this class is
> defined as
>
> <complexType abstract="true"
> name="DataObjectAbstract">
> <sequence>
> <element name="action" type="xsd:int"/>
> </sequence>
> </complexType>
>
> the concrete class is defined as
>
> <complexType name="DataObjectConcrete">
> <complexContent>
> <extension base="tns3:DataObjectAbstract">
> <sequence>
> <...>
> </sequence>
> </extension>
> </complexContent>
> </complexType>
>
> wsdl2java generates a stub where the abstract class
> is defined as
>
> qName =
> new javax.xml.namespace.QName(
> "http://xxx.xxx.xxx.com",
> "DataObjectAbstract");
> cachedSerQNames.add(qName);
> cls = com.xxx.xxx.xxx.DataObjectAbstract.class;
> cachedSerClasses.add(cls);
> cachedSerFactories.add(beansf);
> cachedDeserFactories.add(beandf);
>
> the concrete class is defined in the same way. We
> are using the default
> serializers and deserializers.
>
> What has to be done in order for Axis to instantiate
> the concrete class during
> deserialization?
>
> Thanks in advance
>
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com