cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Abstract Type InstantiationException
Date Thu, 07 Feb 2013 17:21:25 GMT

On Feb 6, 2013, at 7:38 AM, "Gormann, Erich" <Erich.Gormann@Atos.net> wrote:

> Dear all,
> 
> I'am just new to this and first I would like to greet you all.
> 
> Since two years I'am working with web services and 2 weeks ago I used Apache CXF the
first time. I generated code using the wsdl2java goal in the cxf-codegen-plugin. My cxf version
is 2.7.3.
> 
> When calling a webservice from outside I faced the following problem (complete stack
at the end of this post):

We'd likely need to see a bit more information.  In particular:

1) The element and sequence that would represent the message that is being sent in the soap:body

2) The soap message being sent.


If the element within the messages sequence looks something like:

<element name="foo" type="XYZID"/>

then the soap message would HAVE to have an xsi:type attribute on the element to specify that
it is a subclass.

If it looks like:
<element name="foo" type="XYZIDSubType"/>

then I believe it should be working fine.   Would need to see the schema and messages though
to double check.

Dan


> 
> Feb 06, 2013 8:55:00 AM com.sun.xml.bind.v2.ClassFactory create
> INFO: failed to create a new instance of class eu.mybankpayments.protocol.messages._20120917.AbstractApplicationID
> java.lang.InstantiationException
>        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
> 
> 
> There is an abstract type an 2 concrete sub classes in my xsd. Here is what cxf has generated
as annotation above the abstract type:
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "XYZID", propOrder = {
>    "value"
> })
> public abstract class XYZID
>    implements Serializable
> { ...}
> 
> This is the annotation above the sub class:
> 
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "XYZIDSubType")
> public class XYZIDSubType
>    extends XYZID
>    implements Serializable
> {
> 
> The XSD looks like following:
> 
> For the abstract class:
>      <xs:complexType name="XYZID" abstract="true" >
>            <xs:simpleContent>
>                  <xs:extension base="protocol:SomeExtensionType"/>
>            </xs:simpleContent>
>      </xs:complexType>
> 
> For the sub class:
>      <xs:complexType name="XYZIDSubType">
>            <xs:simpleContent>
>                  <xs:restriction base="protocol:XYZID">
>                        <xs:pattern value="foobarpattern"/>
>                  </xs:restriction>
>            </xs:simpleContent>
>      </xs:complexType>
> 
> 
> Thank you in advance for any help .
> 
> Regards, Eric
> 
> 
> Feb 06, 2013 8:55:00 AM com.sun.xml.bind.v2.ClassFactory create
> INFO: failed to create a new instance of class eu.mybankpayments.protocol.messages._20120917.AbstractApplicationID
> java.lang.InstantiationException
>        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
>        at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
>        at com.sun.xml.bind.v2.ClassFactory.create0(ClassFactory.java:133)
>        at com.sun.xml.bind.v2.ClassFactory.create(ClassFactory.java:142)
>        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.createInstance(UnmarshallingContext.java:609)
>        at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl$TransducerImpl.parse(RuntimeClassInfoImpl.java:392)
>        at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:247)
>        at com.sun.xml.bind.v2.runtime.unmarshaller.LeafPropertyLoader.text(LeafPropertyLoader.java:65)
>        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.text(UnmarshallingContext.java:514)
>        at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.processText(StAXStreamConnector.java:338)
>        at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleEndElement(StAXStreamConnector.java:216)
>        at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:185)
>        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:370)
>        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:349)
>        at org.apache.cxf.jaxb.JAXBEncoderDecoder.doUnmarshal(JAXBEncoderDecoder.java:769)
>        at org.apache.cxf.jaxb.JAXBEncoderDecoder.access$100(JAXBEncoderDecoder.java:94)
>        at org.apache.cxf.jaxb.JAXBEncoderDecoder$1.run(JAXBEncoderDecoder.java:797)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:795)
>        at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:629)
>        at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:157)
>        at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:198)
>        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
>        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
>        at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)
>        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:218)
>        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:198)
>        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137)
>        at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:158)
>        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:243)
>        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:163)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
>        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:219)
>        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
>        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
>        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
>        at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
>        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
>        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
>        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
>        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
>        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
>        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
>        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>        at java.lang.Thread.run(Thread.java:722)
> 
> Geschäftsführer: Wolf Kunisch
> Aufsichtsratsvorsitzender: Christophe Duquenne
> Sitz der Gesellschaft: Frankfurt/M.
> Handelsregister: Frankfurt/Main HRB 40 417
> 
> * * * * * * * * L E G A L    D I S C L A I M E R * * * * * * * *
> This e-mail and the documents attached are confidential and intended solely for the addressee;
it may also be privileged. If you receive this e-mail by error, please notify the sender immediately
and destroy it. As its integrity cannot be secured on the internet, the Atos group liability
cannot be triggered for the message content. Although the sender endeavors to maintain a computer
virus-free network, the sender does not warrant that this transmission is virus-free and shall
not be liable for any damages resulting from any virus transmitted.
> * * * * * * * * L E G A L    D I S C L A I M E R * * * * * * * *

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Mime
View raw message