Hello,
BeanUtil.deserialize() throws a java.lang.InstantiationException when trying to
deserialize an xml fragment. The java classes were generated using wsdl2java
and jaxbri binding. One of the xml elements is 'notificationInterval' with data
type 'xs:duration' which gets mapped to javax.xml.datatype.Duration by JAXB.
When an xml fragment containing this type is being unmarshalled, BeanUtil fails
because it is trying to instantiate an abstract class (since Duration is
abstract).
Is there a way to get past this problem?
Attached are the generated classes and the xml fragment.
Thanks,
Murali
Note: I was able to get past a similar problem with XMLGregorianCalendar by
using jaxb customization (to create java.util.Calendar)
-------------- Stack Trace ----------------------
org.apache.axis2.AxisFault
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
at
org.apache.axis2.engine.DefaultObjectSupplier.getObject(DefaultObjectSupplier.java:29)
at
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:345)
at
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:385)
at
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:385)
at
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:385)
at
org.apache.axis2.databinding.utils.BeanUtil.processObject(BeanUtil.java:655)
at
org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(BeanUtil.java:603)
at
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:535)
at
org.apache.axis2.rpc.receivers.RPCUtil.processRequest(RPCUtil.java:153)
at
org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:188)
at
org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver.invokeBusinessLogic(RPCInOnlyMessageReceiver.java:62)
at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at
org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:256)
at
org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:259)
at
org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:166)
at
org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:85)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:595)
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.axis2.engine.DefaultObjectSupplier.getObject(DefaultObjectSupplier.java:27)
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs <urn:subscription brief="true">
<urn:subscriptionKey>uddi:b94aeb1b-b6b3-45bf-9368-df17bebe14d6</urn:subscriptionKey>
<subscriptionFilter xmlns="urn:uddi-org:sub_v3"
xmlns:urn="urn:uddi-org:api_v3" xmlns:urn2="urn:uddi-org:sub_v3">
<find_service xmlns="urn:uddi-org:api_v3">
<findQualifiers>
<findQualifier>approximateMatch</findQualifier>
</findQualifiers>
<categoryBag>
<keyedReference keyName=" " keyValue="Web
Service" tModelKey="uddi:infravio.com:ServiceType"/>
</categoryBag>
</find_service>
</subscriptionFilter>
<urn1:bindingKey>uddi:0939b7eb-1c90-44d5-b94b-b70389725c49</urn1:bindingKey>
<urn:notificationInterval>PT1M</urn:notificationInterval>
<urn:maxEntities>0</urn:maxEntities>
<urn:expiresAfter>2008-05-05T20:08:00.000Z</urn:expiresAfter>
</urn:subscription>
package org.uddi.sub_v3;
import java.util.Calendar;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.datatype.Duration;
import org.w3._2001.xmlschema.Adapter1;
/**
* <p>Java class for subscription complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="subscription">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{urn:uddi-org:sub_v3}subscriptionKey" minOccurs="0"/>
* <element ref="{urn:uddi-org:sub_v3}subscriptionFilter" minOccurs="0"/>
* <element ref="{urn:uddi-org:api_v3}bindingKey" minOccurs="0"/>
* <element ref="{urn:uddi-org:sub_v3}notificationInterval" minOccurs="0"/>
* <element ref="{urn:uddi-org:sub_v3}maxEntities" minOccurs="0"/>
* <element ref="{urn:uddi-org:sub_v3}expiresAfter" minOccurs="0"/>
* </sequence>
* <attribute name="brief" type="{urn:uddi-org:sub_v3}brief" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "subscription", propOrder = {
"subscriptionKey",
"subscriptionFilter",
"bindingKey",
"notificationInterval",
"maxEntities",
"expiresAfter"
})
public class Subscription {
protected String subscriptionKey;
protected SubscriptionFilter subscriptionFilter;
@XmlElement(namespace = "urn:uddi-org:api_v3")
protected String bindingKey;
protected Duration notificationInterval;
protected Integer maxEntities;
@XmlElement(type = String.class)
@XmlJavaTypeAdapter(Adapter1 .class)
protected Calendar expiresAfter;
@XmlAttribute
protected Boolean brief;
/**
* Gets the value of the subscriptionKey property.
*
* @return
* possible object is
* [EMAIL PROTECTED] String }
*
*/
public String getSubscriptionKey() {
return subscriptionKey;
}
/**
* Sets the value of the subscriptionKey property.
*
* @param value
* allowed object is
* [EMAIL PROTECTED] String }
*
*/
public void setSubscriptionKey(String value) {
this.subscriptionKey = value;
}
/**
* Gets the value of the subscriptionFilter property.
*
* @return
* possible object is
* [EMAIL PROTECTED] SubscriptionFilter }
*
*/
public SubscriptionFilter getSubscriptionFilter() {
return subscriptionFilter;
}
/**
* Sets the value of the subscriptionFilter property.
*
* @param value
* allowed object is
* [EMAIL PROTECTED] SubscriptionFilter }
*
*/
public void setSubscriptionFilter(SubscriptionFilter value) {
this.subscriptionFilter = value;
}
/**
* Gets the value of the bindingKey property.
*
* @return
* possible object is
* [EMAIL PROTECTED] String }
*
*/
public String getBindingKey() {
return bindingKey;
}
/**
* Sets the value of the bindingKey property.
*
* @param value
* allowed object is
* [EMAIL PROTECTED] String }
*
*/
public void setBindingKey(String value) {
this.bindingKey = value;
}
/**
* Gets the value of the notificationInterval property.
*
* @return
* possible object is
* [EMAIL PROTECTED] Duration }
*
*/
public Duration getNotificationInterval() {
return notificationInterval;
}
/**
* Sets the value of the notificationInterval property.
*
* @param value
* allowed object is
* [EMAIL PROTECTED] Duration }
*
*/
public void setNotificationInterval(Duration value) {
this.notificationInterval = value;
}
/**
* Gets the value of the maxEntities property.
*
* @return
* possible object is
* [EMAIL PROTECTED] Integer }
*
*/
public Integer getMaxEntities() {
return maxEntities;
}
/**
* Sets the value of the maxEntities property.
*
* @param value
* allowed object is
* [EMAIL PROTECTED] Integer }
*
*/
public void setMaxEntities(Integer value) {
this.maxEntities = value;
}
/**
* Gets the value of the expiresAfter property.
*
* @return
* possible object is
* [EMAIL PROTECTED] String }
*
*/
public Calendar getExpiresAfter() {
return expiresAfter;
}
/**
* Sets the value of the expiresAfter property.
*
* @param value
* allowed object is
* [EMAIL PROTECTED] String }
*
*/
public void setExpiresAfter(Calendar value) {
this.expiresAfter = value;
}
/**
* Gets the value of the brief property.
*
* @return
* possible object is
* [EMAIL PROTECTED] Boolean }
*
*/
public Boolean isBrief() {
return brief;
}
/**
* Sets the value of the brief property.
*
* @param value
* allowed object is
* [EMAIL PROTECTED] Boolean }
*
*/
public void setBrief(Boolean value) {
this.brief = value;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]