Deserialization problem

My web service returns a custom complex type. I want to know how I can read it in my java client. Right now, I am getting deserialization errors. Do I have to write my own Deserializer? Or can I use the SOAPMappingRegistry and use mapTypes ?
My complex type looks like this:
<complexType name="AddressResult">
- <all>
<element name="status" type="xsd:int" />
<element name="errorCode" type="xsd:string" />
<element name="firstName" type="xsd:string" />
<element name="lastName" type="xsd:string" />
<element name="address" type="xsd:string" />
<element name="address2" type="xsd:string" />
<element name="city" type="xsd:string" />
<element name="state" type="xsd:string" />
<element name="zip" type="xsd:string" />
<element name="zip4" type="xsd:string" />
<element name="phoneAreaCode" type="xsd:string" />
</all>
</complexType>
Thanks,
J

This is the stack trace I am getting. I am not sure how I can print the SOAP message that I received.
deserialization error: unexpected XML reader state. expected: END but found: START: status
deserialization error: unexpected XML reader state. expected: END but found: START: status
at com.sun.xml.rpc.encoding.literal.LiteralResponseSerializer.deserialize(LiteralResponseSerializer.java:242)
at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElement(CallInvokerImpl.java:222)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:158)
at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:61)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:346)
at HelloWorld.validateAddress(HelloWorld.java:216)
at HelloWorld.main(HelloWorld.java:142)
CAUSE:
unexpected XML reader state. expected: END but found: START: status
at com.sun.xml.rpc.streaming.XMLReaderUtil.verifyReaderState(XMLReaderUtil.java:49)
at com.sun.xml.rpc.encoding.literal.LiteralResponseSerializer.internalDeserialize(LiteralResponseSerializer.java:286)
at com.sun.xml.rpc.encoding.literal.LiteralResponseSerializer.deserialize(LiteralResponseSerializer.java:236)
at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElement(CallInvokerImpl.java:222)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:158)
at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:61)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:346)
at HelloWorld.validateAddress(HelloWorld.java:216)
at HelloWorld.main(HelloWorld.java:142)
CAUSE:
unexpected XML reader state. expected: END but found: START: status
at com.sun.xml.rpc.streaming.XMLReaderUtil.verifyReaderState(XMLReaderUtil.java:49)
at com.sun.xml.rpc.encoding.literal.LiteralResponseSerializer.internalDeserialize(LiteralResponseSerializer.java:286)
at com.sun.xml.rpc.encoding.literal.LiteralResponseSerializer.deserialize(LiteralResponseSerializer.java:236)
at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElement(CallInvokerImpl.java:222)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:158)
at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:61)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:346)
at HelloWorld.validateAddress(HelloWorld.java:216)
at HelloWorld.main(HelloWorld.java:142)
Thanks for your help.
J

Similar Messages

  • Apache axis deserialization problem

    Can anybody help?
    We are using Apache's Axis web service framework for consuming web services. One of the web services has "nested" or complex types in the response, and the Axis framework is not processing it properly.
    Is there something that we need to configure to get this to work? Any suggestions are much appreciated.
    It gives the following message:
    org.xml.sax.SAXException: Invalid element in com.chase.egw._GWProfile - Product
    at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:260)
    at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:963)
    at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
    at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
    at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:323)
    at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
    at org.apache.axis.client.Call.invoke(Call.java:2272)
    at org.apache.axis.client.Call.invoke(Call.java:2171)
    at org.apache.axis.client.Call.invoke(Call.java:1691)
    at com.chase.egw.GWProfilePortTypeSoapBindingStub.getProfile(GWProfilePortTypeSoapBindingStub.java:185)
    at com.echase.common.mf.sso.SSOGatewayServiceDelegate.getGWProfile(SSOGatewayServiceDelegate.java:178)

    I am having the same problem as you describe.
    Checkout out this link:
    http://dev-forums.ebay.com/thread.jsp?forum=1002&thread=100000782
    It talks about adding the following to the complex type defintion in the WSDL
    <xsd:any processContents = "lax"/>
    The good news is this solved the exception problem.
    The bad news is that my complex objects are not being deserialed. I've posted to the AXIS users mailing list.
    Here is what I posted:
    Hi,
    I need a little help getting started with AXIS.
    I've done some SOAP web services development a few years back using SUN JAXM, but I will be using AXIS for a webservice project in the near term.
    In order to get familiar with AXIS I did the GOOGLE thing and aquired a sample WDSL to try out.
    I am using 1.2RC3 version of AXIS with Tomcat 5.0.28.
    Here is the WSDL I first used:
    <wsdl:definitions
    name="PhotoCatalogService"
    targetNamespace="http://examples.com/PhotoCatalog"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:types="http://examples.com/PhotoCatalog/types"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:tns="http://examples.com/PhotoCatalog">
    <wsdl:types>
    <xsd:schema targetNamespace="http://examples.com/PhotoCatalog/types"
    xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
    xmlns:types="http://examples.com/PhotoCatalog/types">
    <xsd:import namespace="http://ws-i.org/profiles/basic/1.1/xsd" schemaLocation="WS-ISwA.xsd"/>
    <!-- Status contains the references the old photo available as attachment. -->
    <xsd:element name="Status" type="wsi:swaRef" />
    <!-- passed in as parameter of replacePhoto operation, contains the order. -->
    <xsd:element name="PhotoInfo">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="customerName" type="xsd:string"/>
    <xsd:element name="photoID" type="xsd:int"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    </wsdl:types>
    <wsdl:message name="addPhotoRequest">
    <wsdl:part name="oldPhoto" element="types:PhotoInfo"/>
    <wsdl:part name="photo" type="xsd:hexBinary"/>
    </wsdl:message>
    <wsdl:message name="addPhotoResponse">
    <wsdl:part name="status" type="xsd:string"/>
    </wsdl:message>
    <wsdl:message name="replacePhotoRequest">
    <wsdl:part name="oldPhoto" element="types:PhotoInfo"/>
    <wsdl:part name="newPhoto" type="xsd:hexBinary"/>
    </wsdl:message>
    <wsdl:message name="replacePhotoResponse">
    <wsdl:part name="status" element="types:Status"/>
    </wsdl:message>
    <wsdl:portType name="PhotoCatalog">
    <wsdl:operation name="addPhoto">
    <wsdl:input message="tns:addPhotoRequest"/>
    <wsdl:output message="tns:addPhotoResponse"/>
    </wsdl:operation>
    <wsdl:operation name="replacePhoto">
    <wsdl:input message="tns:replacePhotoRequest"/>
    <wsdl:output message="tns:replacePhotoResponse"/>
    </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="PhotoCatalogBinding" type="tns:PhotoCatalog">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="addPhoto">
    <wsdl:input>
    <mime:multipartRelated>
    <mime:part>
    <soap:body parts="oldPhoto" use="literal"/>
    </mime:part>
    <mime:part>
    <mime:content part="photo" type="image/jpeg"/>
    </mime:part>
    </mime:multipartRelated>
    </wsdl:input>
    <wsdl:output>
    <mime:multipartRelated>
    <mime:part>
    <soap:body use="literal"/>
    </mime:part>
    <mime:part>
    <mime:content part="status" type="text/plain"/>
    <mime:content part="status" type="text/xml"/>
    </mime:part>
    </mime:multipartRelated>
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="replacePhoto">
    <wsdl:input>
    <mime:multipartRelated>
    <mime:part>
    <soap:body parts="oldPhoto" use="literal"/>
    </mime:part>
    <mime:part>
    <mime:content part="newPhoto" type="image/jpeg"/>
    </mime:part>
    </mime:multipartRelated>
    </wsdl:input>
    <wsdl:output>
    <mime:multipartRelated>
    <mime:part>
    <soap:body parts="status" use="literal"/>
    </mime:part>
    </mime:multipartRelated>
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="PhotoCatalogService">
    <wsdl:port name="PhotoCatalogPort" binding="tns:PhotoCatalogBinding">
    <soap:address location="http://localhost:8080/jaxrpc-AttachmentsSample/photocatalog"/>
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>
    When I used the previous WSDL to generate a service and then a client I got the following error on the client side when trying the "addPhoto" service:
    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: org.xml.sax.SAXException: Invalid element in com.examples.PhotoCatalog.types.PhotoInfo - PhotoInfo
    faultActor:
    faultNode:
    faultDetail:
    {http://xml.apache.org/axis/}hostname:tislaptop
    org.xml.sax.SAXException: Invalid element in com.examples.PhotoCatalog.types.PhotoInfo - PhotoInfo
    at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
    at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
    at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
    at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
    at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:745)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:141)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2754)
    at org.apache.axis.client.Call.invoke(Call.java:2737)
    at org.apache.axis.client.Call.invoke(Call.java:2413)
    at org.apache.axis.client.Call.invoke(Call.java:2336)
    at org.apache.axis.client.Call.invoke(Call.java:1793)
    at com.examples.PhotoCatalog.PhotoCatalogBindingStub.addPhoto(PhotoCatalogBindingStub.java:190)
    at com.examples.PhotoCatalog.PhotoCatalogProxy.addPhoto(PhotoCatalogProxy.java:45)
    at com.examples.PhotoCatalog.TestPhotoService.main(TestPhotoService.java:41)
    Here is an abridged network trace of the SOAP request sent from client to server...
    POST /axis/services/PhotoCatalogPort HTTP/ 1.0
    Content-Type: multipart/related;type="text/xml";start="<DBB2B5537065926A4CBC8F8ED8D88F15>";boundary="----=_Part_0_20983130.1113483759295"
    Accept: application/soap+xml, application/dime, multipart/related, text/*
    User-Agent:Axis/1.2RC3
    Host: xxx.xxx.xxx.xxx:8080
    Cache-Control: no-cache
    Pragma: no-cache
    SOAPAction: ""
    Content-Length: 8466
    ------=_Part_0_209831301113483759295
    Content-Type: text/xml; charset=UTF-8
    Content-Transfer-Encoding: binary
    Content-Id: <DBB2B5537065926A4CBC8F8ED8D88F15>
    <?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/XML Schema-instance">
    <soapenv:Body>
    <addPhoto xmlns="">
    <ns1:PhotoInfo xmlns:ns1="http://examples.com/PhotoCatalog/types">
    <customerName>karl</customerName>
    <photoID>100</photoID>
    </ns1:PhotoInfo>
    <photo href="cid:9AD6390B491EF0EE0B0FCEA7AA945655" xsi:type="ns2:Image" xmlns:ns2="http://xml.apache.org/xml-soap"/>
    </addPhoto>
    </soapenv:Body>
    </soapenv:Envelope>
    ------=_ Part_0_20983130.1113483759295
    Content-Type:image/jpeg
    Content -Transfer-Encoding:binary
    Content-Id: <F2369DA809C4B1B0ADBA8538372E6F23>
    ...QE..QE.......
    ------=_Part_0_20983130.1113483759295
    After a little searching I found some info that led me to change the WSDL a little. I redefined the "PhotoInfo" type as follows
    <xsd:element name="PhotoInfo">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="customerName" type="xsd:string"/>
    <xsd:element name="photoID" type="xsd:int"/>
    <xsd:any processContents = "lax"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    Now there is no exception thrown, but the PhotoInfo and photo objects are not deserialized. I get null values passed to the PhotoCatalogBindingImpl class.
    I noticed that an org.apache.axis.message.MessageElement[] object and associated methods was added to the PhotoInfo class, which I assume is due to adding the <xsd:any processContents = "lax"/> line to the WSDL.
    Here is the PhotoInfo and PhotoCatalogBindingImpl class source for reference:
    * PhotoCatalogBindingImpl.java
    * This file was auto-generated from WSDL
    * by the Apache Axis 1.2RC3 Feb 28, 2005 (10:15:14 EST) WSDL2Java emitter.
    package com.examples.PhotoCatalog;
    import javax.xml.transform.Source;
    public class PhotoCatalogBindingImpl implements com.examples.PhotoCatalog.PhotoCatalog{
    public javax.xml.transform.Source
    addPhoto(com.examples.PhotoCatalog.types.PhotoInfo oldPhoto, java.awt.Image photo) throws java.rmi.RemoteException {
    return null;
    public org.apache.axis.types.URI replacePhoto(com.examples.PhotoCatalog.types.PhotoInfo oldPhoto, java.awt.Image newPhoto) throws java.rmi.RemoteException {
    return null;
    * PhotoInfo.java
    * This file was auto-generated from WSDL
    * by the Apache Axis 1.2RC3 Feb 28, 2005 (10:15:14 EST) WSDL2Java emitter.
    package com.examples.PhotoCatalog.types;
    public class PhotoInfo implements java.io.Serializable, org.apache.axis.encoding.AnyContentType {
    private java.lang.String customerName;
    private int photoID;
    private org.apache.axis.message.MessageElement [] _any;
    public PhotoInfo() {
    public PhotoInfo(
    org.apache.axis.message.MessageElement [] _any,
    java.lang.String customerName,
    int photoID) {
    this.customerName = customerName;
    this.photoID = photoID;
    this._any = _any;
    * Gets the customerName value for this PhotoInfo.
    * @return customerName
    public java.lang.String getCustomerName() {
    return customerName;
    * Sets the customerName value for this PhotoInfo.
    * @param customerName
    public void setCustomerName(java.lang.String customerName) {
    this.customerName = customerName;
    * Gets the photoID value for this PhotoInfo.
    * @return photoID
    public int getPhotoID() {
    return photoID;
    * Sets the photoID value for this PhotoInfo.
    * @param photoID
    public void setPhotoID(int photoID) {
    this.photoID = photoID;
    * Gets the _any value for this PhotoInfo.
    * @return _any
    public org.apache.axis.message.MessageElement [] get_any() {
    return _any;
    * Sets the _any value for this PhotoInfo.
    * @param _any
    public void set_any(org.apache.axis.message.MessageElement [] _any) {
    this._any = _any;
    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
    if (!(obj instanceof PhotoInfo)) return false;
    PhotoInfo other = (PhotoInfo) obj;
    if (obj == null) return false;
    if (this == obj) return true;
    if (__equalsCalc != null) {
    return (__equalsCalc == obj);
    __equalsCalc = obj;
    boolean _equals;
    _equals = true &&
    ((this.customerName==null && other.getCustomerName()==null) ||
    (this.customerName!=null &&
    this.customerName.equals(other.getCustomerName()))) &&
    this.photoID == other.getPhotoID() &&
    ((this._any==null && other.get_any()==null) ||
    (this._any!=null &&
    java.util.Arrays.equals(this._any, other.get_any())));
    __equalsCalc = null;
    return _equals;
    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
    if (__hashCodeCalc) {
    return 0;
    __hashCodeCalc = true;
    int _hashCode = 1;
    if (getCustomerName() != null) {
    _hashCode += getCustomerName().hashCode();
    _hashCode += getPhotoID();
    if (get_any() != null) {
    for (int i=0;
    i<java.lang.reflect.Array.getLength(get_any());
    i++) {
    java.lang.Object obj = java.lang.reflect.Array.get(get_any(), i);
    if (obj != null &&
    !obj.getClass().isArray()) {
    _hashCode += obj.hashCode();
    __hashCodeCalc = false;
    return _hashCode;
    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
    new org.apache.axis.description.TypeDesc(PhotoInfo.class, true);
    static {
    typeDesc.setXmlType(new javax.xml.namespace.QName("http://examples.com/PhotoCatalog/types", ">PhotoInfo"));
    org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
    elemField.setFieldName("customerName");
    elemField.setXmlName(new javax.xml.namespace.QName("", "customerName"));
    elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
    typeDesc.addFieldDesc(elemField);
    elemField = new org.apache.axis.description.ElementDesc();
    elemField.setFieldName("photoID");
    elemField.setXmlName(new javax.xml.namespace.QName("", "photoID"));
    elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
    typeDesc.addFieldDesc(elemField);
    * Return type metadata object
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
    return typeDesc;
    * Get Custom Serializer
    public static org.apache.axis.encoding.Serializer getSerializer(
    java.lang.String mechType,
    java.lang.Class _javaType, 
    javax.xml.namespace.QName _xmlType) {
    return
    new org.apache.axis.encoding.ser.BeanSerializer(
    javaType, xmlType, typeDesc);
    * Get Custom Deserializer
    public static org.apache.axis.encoding.Deserializer getDeserializer(
    java.lang.String mechType,
    java.lang.Class _javaType, 
    javax.xml.namespace.QName _xmlType) {
    return
    new org.apache.axis.encoding.ser.BeanDeserializer(
    javaType, xmlType, typeDesc);
    I guess my questions are as follows:
    1. Why is exception thrown in the first scenario? Is there something wrong with the WSDL? I guess there is, but I can't figure it out.
    2. When the change is made to the WDSL(adding <xsd:any processContents = "lax"/>) is there something that I need to add to the PhotoInfo class
    to process the org.apache.axis.message.MessageElement[] object. Do I need to "manually" parse that object in the PhotoCatalogBindingImpl class to get
    the values of customerName and photoID?
    Any other help would be appreciated..
    thanks,
    Karl Schwarz
    System Architect
    Northrop Grumman

  • Webservice Client deserialization problem with Vectors!

    Hello!
    I'm generating a Java Proxy Client with Eclipse WTP.
    The Client works fine with normal datatypes and own Beans. But whe the return type is a Collection with own beans an exception is thrown:
    exception: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
    So whats wrong?
    In teh Webservice Explorer everything seems to be fine, my vector is serialized in item-tags:
    - <getAktionenResponse xmlns="http://commonservice">
    - <getAktionenReturn>
    - <item xmlns="">
    <aktn_nr>a12345</aktn_nr>
    <claim>222</claim>
    <geschaeftsjahr>2005</geschaeftsjahr>
    <son>333</son>
    <special_operation_code>soc12345</special_operation_code>
    <status>ready</status>
    <vin>t123</vin>
    </item>
    - <item xmlns="">
    <aktn_nr>a6789</aktn_nr>
    <claim>567</claim>
    <geschaeftsjahr>2006</geschaeftsjahr>
    <son>555</son>
    <special_operation_code>soc6789</special_operation_code>
    <status>false</status>
    <vin>t123</vin>
    </item>
    </getAktionenReturn>
    </getAktionenResponse>
    how can i solve this problem?
    the background is that I return a vector with Java Objects. I thought apache axis deserielizes automatically the vector and the bean inside??
    I'm pretty new to webservices...
    Pleas help!
    Thanks!

    As per the below link, I assumed its better to avoid collections and go with plain array of objects.
    Please let us know if I am wrong.
    http://www-128.ibm.com/developerworks/webservices/library/ws-tip-coding.html
    Regards,
    Venkat S

  • Deserialization Problem with JDOM Document

    HI,
    I am using weblogic7.0 and i have created my own class which implements serializable. I set the object of this class in the ObjectMessage and send it across. Sometime i have to send some vector,sometimes string and sometime a XML document. So i can set these type of objects in my custom serializable object and send it. For sending XML , either i can send it as a string or as u said as Document object. But i want to do send it as a Document object. So i have created a an object of "org.jdom.Document" which implement serializable and setting this object into my custom object and sending this custom object in the objectmessage. But then weblogic throws some exceptions which has to do with deserialization.I am printing the exception below. (without the object of org.jdom.Document this custom object reaches safely and happily:))........can you or anybody tell me what could be the reason..
    weblogic.jms.common.JMSException: Error deserializing object
    at weblogic.jms.common.ObjectMessageImpl.getObject(ObjectMessageImpl.java:140)
    at com.sds.kb.cm.CMMDBReceiver.onMessage(CMMDBReceiver.java:143)
    at weblogic.ejb20.internal.MDListener.execute(MDListener.java:356)
    at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:290)
    at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:271)
    at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2303)
    at weblogic.jms.client.JMSSession.execute(JMSSession.java:2226)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
    ----------- Linked Exception -----------
    weblogic.jms.common.JMSException: Error deserializing object
    at weblogic.jms.common.ObjectMessageImpl.getObject(ObjectMessageImpl.java:140)
    at com.sds.kb.cm.CMMDBReceiver.onMessage(CMMDBReceiver.java:143)
    at weblogic.ejb20.internal.MDListener.execute(MDListener.java:356)
    at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:290)
    at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:271)
    at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2303)
    at weblogic.jms.client.JMSSession.execute(JMSSession.java:2226)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
    any help would be apprciated..
    Akhil

    Are you sure that your object gets serialized in the first place? You could use the writeObject method (explained in Javadoc for java.io.Serializable) to snoop the process.
    I am actually surprised you can serialize a DOM document.
    /Sebastian

  • Object deserialization problems?

    A bit of a crosspost perhaps but not really sure if new to java or java programming is really the right place..anyway..i have a resultset containing object serializations..in the code below rs is a ResultSet;
    while(rs.next()){
           ObjectInputStream in = new ObjectInputStream(rs.getBinaryStream(1));
           productionRule rule = (productionRule)in.readObject();
           answer.add(rule);
         }this works on the first time round and returns the properly deserialized object in rule..which is then added to the LinkedList answer but on the second iteration the line;
           ObjectInputStream in = new ObjectInputStream(rs.getBinaryStream(1));produces an IOException with a getMessage() of Invalid Stream header
    I have no idea why this is occurring..does any one have any idea?

    The ResultSet.getBinaryStream() says the following
    Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a getXXX method implicitly closes the stream. Also, a stream may return 0 when the method InputStream.available is called whether there is data available or not.
    Maybe, when you leave the first row, it is closing down the inputstream on the second row before you can read it ? Strange... but fits the symptoms.
    Could it be, that the inputstream you receive is valid for the entire resultset ? Ie. you can read multiple objects from one getBinaryStream() call on a resultset, outside of your while loop ???
    regards,
    Owen

  • Deserialization error

    Hello all,
    I have a deserialization problem with a dynamic web service client.The return type that the service returns is a vector object.I am able to see from the soap (using tcpmon) that the service returns the values that i want to be returned by it.The problem is in the client's side that can't deserialize the vector object that the service sends
    This is how i call the service:
    ServiceFactory factory = ServiceFactory.newInstance(); //ServiceFactory object
              Service service = factory.createService(new QName(ServiceName));//service object
              QName port = new QName(PortTypeName);
              Call call = service.createCall(port);
              call.setTargetEndpointAddress(Endpointaddress);
              call.setProperty(Call.SOAPACTION_USE_PROPERTY,new Boolean(true));
              call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
              call.setProperty(Encoding_style_property, Uri_encoding);
              //Specifies the method's return type, name, and input parameters
              QName QNAME_TYPE = new QName(Ns_xsd,OutputType);// return type (THE TYPE IS VECTOR)
              call.setReturnType(QNAME_TYPE);The exception i take is this:
    [java] deserialization error: java.lang.NullPointerException
    [java] at com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(Obj
    ectSerializerBase.java:214)
    [java] at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserial
    ize(ReferenceableSerializerImpl.java:134)
    [java] at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElem
    ent(CallInvokerImpl.java:222)
    [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.
    java:158)
    [java] at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvok
    erImpl.java:61)
    [java] at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:35
    3)
    [java] at nclient.nClient.invoke(Unknown Source)
    [java] at nclient.nClient.main(Unknown Source)
    [java] CAUSE:
    [java] java.lang.NullPointerException
    [java] at com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.doDeseri
    alize(SOAPResponseSerializer.java:149)
    [java] at com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(Obj
    ectSerializerBase.java:167)
    [java] at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserial
    ize(ReferenceableSerializerImpl.java:134)
    [java] at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElem
    ent(CallInvokerImpl.java:222)
    [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.
    java:158)
    [java] at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvok
    erImpl.java:61)
    [java] at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:35
    3)
    [java] at nclient.nClient.invoke(Unknown Source)
    [java] at nclient.nClient.main(Unknown Source)
    [java] CAUSE:
    [java] java.lang.NullPointerException
    [java] at com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.doDeseri
    alize(SOAPResponseSerializer.java:149)
    [java] at com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(Obj
    ectSerializerBase.java:167)
    [java] at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserial
    ize(ReferenceableSerializerImpl.java:134)
    [java] at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElem
    ent(CallInvokerImpl.java:222)
    [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.
    java:158)
    [java] at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvok
    erImpl.java:61)
    [java] at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:35
    Does anyone know how can i solve this problem?Any example code would be very helpful.
    Thanks a lot.

    Hello all,
    I have a deserialization problem with a dynamic web service client.The return type that the service returns is a vector object.I am able to see from the soap (using tcpmon) that the service returns the values that i want to be returned by it.The problem is in the client's side that can't deserialize the vector object that the service sends
    This is how i call the service:
    ServiceFactory factory = ServiceFactory.newInstance(); //ServiceFactory object
              Service service = factory.createService(new QName(ServiceName));//service object
              QName port = new QName(PortTypeName);
              Call call = service.createCall(port);
              call.setTargetEndpointAddress(Endpointaddress);
              call.setProperty(Call.SOAPACTION_USE_PROPERTY,new Boolean(true));
              call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
              call.setProperty(Encoding_style_property, Uri_encoding);
              //Specifies the method's return type, name, and input parameters
              QName QNAME_TYPE = new QName(Ns_xsd,OutputType);// return type (THE TYPE IS VECTOR)
              call.setReturnType(QNAME_TYPE);The exception i take is this:
    [java] deserialization error: java.lang.NullPointerException
    [java] at com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(Obj
    ectSerializerBase.java:214)
    [java] at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserial
    ize(ReferenceableSerializerImpl.java:134)
    [java] at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElem
    ent(CallInvokerImpl.java:222)
    [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.
    java:158)
    [java] at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvok
    erImpl.java:61)
    [java] at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:35
    3)
    [java] at nclient.nClient.invoke(Unknown Source)
    [java] at nclient.nClient.main(Unknown Source)
    [java] CAUSE:
    [java] java.lang.NullPointerException
    [java] at com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.doDeseri
    alize(SOAPResponseSerializer.java:149)
    [java] at com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(Obj
    ectSerializerBase.java:167)
    [java] at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserial
    ize(ReferenceableSerializerImpl.java:134)
    [java] at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElem
    ent(CallInvokerImpl.java:222)
    [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.
    java:158)
    [java] at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvok
    erImpl.java:61)
    [java] at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:35
    3)
    [java] at nclient.nClient.invoke(Unknown Source)
    [java] at nclient.nClient.main(Unknown Source)
    [java] CAUSE:
    [java] java.lang.NullPointerException
    [java] at com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.doDeseri
    alize(SOAPResponseSerializer.java:149)
    [java] at com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(Obj
    ectSerializerBase.java:167)
    [java] at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserial
    ize(ReferenceableSerializerImpl.java:134)
    [java] at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElem
    ent(CallInvokerImpl.java:222)
    [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.
    java:158)
    [java] at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvok
    erImpl.java:61)
    [java] at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:35
    Does anyone know how can i solve this problem?Any example code would be very helpful.
    Thanks a lot.

  • Deserialization Failed error when calling a SAP Webservice

    Hello,
    I'm trying to call an SAP Webservice from a .NET Mobile application, this particular BAPI expects an array of objects and when I make the call I get a deserialization problems.  I have tried make the array size to 0 but no luck, I have couple of other function modules which are working fine but have a problem with this BAPI BAPI_ALM_ORDEROPER_GET_LIST.
    any help is greatly appriciated.
    Thanks
    Vinay

    Dear Vinay,
    Does your other FM are also using arrays.?
    Deserialization problem comes when xml parser is not able to convert XML schema or values to language specific elements.
    And this problem normally comes if you are using complex data types.
    Can you check once again and reply.
    Regards,
    Piyush

  • URGENT: SAP throws the "Deserialization failed" error.

    Hi All,
    I am using ABAP generated WebService in .NET 1.1.
    Steps i took:
    1. Generate Web Service of a BAPI in ABAP and Test it there.
    2. Take its URL and Added Web Reference in my PortalApplication in .NET 1.1
    3. Deployed it successfully, but when i try to run the project i.e "Portal Application" it gives "Deserielization failed" Error.
    its urgent Please Help!
    Help will be highly appreciated.
    Thanks in Advance
    sachin

    Dear Vinay,
    Does your other FM are also using arrays.?
    Deserialization problem comes when xml parser is not able to convert XML schema or values to language specific elements.
    And this problem normally comes if you are using complex data types.
    Can you check once again and reply.
    Regards,
    Piyush

  • Re: ActiveX and Repository Problems

    Hi Jason,
    Following is the Forte flag that I've used to redirect stdout of a
    partition:
    -fl c:\forte\log.txt(*:user1:1-63:255)
    The rule of thumb that I know in case of segmentation violation is:
    'Don't fight it, by-pass it!'
    Hope this help a little.
    Patrick Leveque
    Reply-To: "Jason Carpenter" <[email protected]>
    Our setup:
    Clients: NT 4, Forte 3.0.F.2
    Server: Unix, Forte 3.0.F.2
    Central repository is located on the server, we are using ATTACHED shadows.
    Our clients employ the use of an ActiveX control that is a spreadsheet-like
    grid. As far as we know, it is the only spreadsheet-like grid that is
    compatible with Forte. The ActiveX control is Protoview's Datatable v4.0.
    Some of the time it behaves well in Forte. Many times it does not.
    Situation:
    While in debug mode (or after having pressed the running man) when we
    attempt to interact with the grid, we get a Fatal Error on the task that
    created the ActiveX control. Unfortunately this Fatal Error completely shuts
    down our Forte clients. Usually there is not even time to look at stdout to
    determine what the problem or error is. We have started sending stdout to a
    separate log file, unfortunately the flags for logging are not documented
    well enough for us to pick the right ones to determine what is really
    happening.
    In times past we have seen error messages to stdout that inform us that
    there was a read/write error with the repository. Others mention
    serialization/deserialization problems. All have a System Segmentation
    violation error message. And we are always shut out of our client session.
    >
    We have noticed that sometimes when we integrate the problem will go away
    for an hour or two. Other times integration does not help.
    Question:
    Has anyone else experienced this type of problem with ActiveX controls?
    Does anyone have any suggestions to keep this problem from happening?
    Jason Carpenter
    CSC Consulting & Systems Integration
    [email protected]
    3811 Turtle Creek Blvd.
    20th Floor
    Dallas, TX 75219
    214.520.0555
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    >
    Get Your Private, Free Email at http://www.hotmail.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Hi Jason,
    Following is the Forte flag that I've used to redirect stdout of a
    partition:
    -fl c:\forte\log.txt(*:user1:1-63:255)
    The rule of thumb that I know in case of segmentation violation is:
    'Don't fight it, by-pass it!'
    Hope this help a little.
    Patrick Leveque
    Reply-To: "Jason Carpenter" <[email protected]>
    Our setup:
    Clients: NT 4, Forte 3.0.F.2
    Server: Unix, Forte 3.0.F.2
    Central repository is located on the server, we are using ATTACHED shadows.
    Our clients employ the use of an ActiveX control that is a spreadsheet-like
    grid. As far as we know, it is the only spreadsheet-like grid that is
    compatible with Forte. The ActiveX control is Protoview's Datatable v4.0.
    Some of the time it behaves well in Forte. Many times it does not.
    Situation:
    While in debug mode (or after having pressed the running man) when we
    attempt to interact with the grid, we get a Fatal Error on the task that
    created the ActiveX control. Unfortunately this Fatal Error completely shuts
    down our Forte clients. Usually there is not even time to look at stdout to
    determine what the problem or error is. We have started sending stdout to a
    separate log file, unfortunately the flags for logging are not documented
    well enough for us to pick the right ones to determine what is really
    happening.
    In times past we have seen error messages to stdout that inform us that
    there was a read/write error with the repository. Others mention
    serialization/deserialization problems. All have a System Segmentation
    violation error message. And we are always shut out of our client session.
    >
    We have noticed that sometimes when we integrate the problem will go away
    for an hour or two. Other times integration does not help.
    Question:
    Has anyone else experienced this type of problem with ActiveX controls?
    Does anyone have any suggestions to keep this problem from happening?
    Jason Carpenter
    CSC Consulting & Systems Integration
    [email protected]
    3811 Turtle Creek Blvd.
    20th Floor
    Dallas, TX 75219
    214.520.0555
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    >
    Get Your Private, Free Email at http://www.hotmail.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • JMX version 1.0 & 1.2 conflict.

    I have a JMX client program running in JDK1.5 and the JMX server in 1.4 JDK and weblogic8.1.
    When I am trying to connect it is throwing the exception :
    Exception caught: java.lang.NullPointerException
    at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
    at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:164)
    at weblogic.management.internal.RemoteMBeanServerImpl_815_WLStub.queryNames(Unknown Source)
    at JMXTEST.main(JMXTEST.java:41)
    Caused by: java.lang.NullPointerException
    This I understood, because of JMX version conflict 1.0 and 1.2, I tried setting System.setProperty("jmx.serial.form", "1.0") ;, but It didn�t worked.
    Problem here is, the classes are present in rt.jar and weblogic.jar, but having different versions of JMX. The program is getting the classes from rt.jar is creating the issue. Is there any way to specify in the program, get these classes from weblogic.jar and not from rt.jar
    OR is there any solution to this issue.
    Code :
    MBeanServer mbs = (RemoteMBeanServer) home.getMBeanServer();
    Set mbeans = mbs.queryNames(objName, null);
    Your help is greatly appreciated. Thanks in advance.
    Regards,
    Shyam

    Hmm..
    If the two JMX versions are incompatible,. then a SerializationException is thrown. I had faced a similar problem working with Websphere 5.x and JMX 1.2.. The only way you can go around this is to use a client that is built on JMX 1.0, or change your server side JMX version. Personally i think you should just use a JMX 1.0 client.
    The reason why both are incompatible is that the serviceVersionUIDs that are difined in the JMX 1.0 classes do not match the ones in JMX 1.2. There is not way out of this. :( You see, many JMX Classes such as ObjectName, etc are sent to - from the client and the server so they need to be serialized, deserialzed.
    Your NullPointerException may be due to something else. However i suspect that once you resolve NullPointerException, you will eventually bump into serialization / deserialization problems.

  • EJB method parameters are sent but nulls are received

    My client calls my EJB method passing two serializable objects as parameters.
    Using print statements and a network snoop I have confirmed that:
    - the client is calling the method with valid objects
    - from examining the data it appears that the objects are being serialized and sent across the network
    - the EJB seems to receive null values.
    I have deployed the EJB to both 9iAS and a standalone instance of OC4J with exactly the same results.
    Any ideas?

    Hi Dale and Kamesh,
    No error messages? Nothing in the log files? Have you tried running OC4J in debug mode? In case you haven't already seen it, this "Technical Note" has more details.
    Pardon me if I am stating the obvious, but it seems like there is a deserialization problem. Are the client JVM and server JVM both the same version? Have you implemented custom [de]serialization for the parameter classes? Is the same version of the parameter class files located both at the client and at the server?
    Good Luck,
    Avi.

  • Error calling SAP webservice

    Hi,
    I have created a ZBAPI that is published as webservice via SE37 --> using the wizard, and I have created a flex web that invoke this webservice. When I runs the web in my local the call to webservice works perfect, but when I deploy the web in my Composite Environment and I execute the web I get the following error:
    [RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Unable to load WSDL. If currently online, please verify the URI and/or format of the WSDL (http://xxxxxxxxxxxx:8000/sap/bc/srt/wsdl/bndg_4A02EE1AE83732C2E10000000AA51C62/wsdl11/allinone/standard/document?sap-client=330)"]
    I have been searching the solution and only I have found to deploy in the server (Composite Environmentt) the crossdomain.xml in the root, but it doesn't work.
    the crossdomain.xml content is:
    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM
    "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
         <site-control permitted-cross-domain-policies="all"/>
         <allow-access-from domain="*" secure="false"/>
         <allow-http-request-headers-from domain="" headers="" secure="false"/>
    </cross-domain-policy>
    and the route where is deployed is:
    D:\usr\sap\XXXX\J00\j2ee\cluster\apps\sap.com\com.sap.engine.docs.examples\servlet_jsp\_default\root
    any idea?
    thanks in advance
    Jose Manuel

    Dear Vinay,
    Does your other FM are also using arrays.?
    Deserialization problem comes when xml parser is not able to convert XML schema or values to language specific elements.
    And this problem normally comes if you are using complex data types.
    Can you check once again and reply.
    Regards,
    Piyush

  • Problem in deserialization with different versions of JDK

    I have problem related to serialization, pls suggest the most appropriate solution, the problem is that I have a class AAAA.java which extends AbstractListModel.java class of JDK, and it is serializable. When i saw the serialVersionUID of AbstractListModel.java using the java tool serialver in jdk 1.3.1 from the command line it gives 2622425607724314306 (Unique ID of class) but when i saw it in JDK 1.4.1 then it given -3285184064379168730. As the UID is changed from JDK1.3.1 to 1.4.1, Now the problem is that i serialized a file which uses AAAA.java using the 1.3.1 and now i want to open that file in my project using 1.4.1 it gives exception.
    java.io.InvalidClassException: javax.swing.AbstractListModel; local class incompatible: stream classdesc serialVersionUID = 2622425607724314306, local class serialVersionUID = -3285184064379168730
    at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:459)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)
    Can u suggest me appropriate solution as this file must be desirialized (Compatibility issue) as it is generated from project.
    U may also try using this command in jdk 1.3.1 & 1.4.1
    on command prompt
    serialver javax.swing.AbstractListModel.

    From the API (you already know this, though through experience...)
    Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
    So there seems to be no easy solution (in 1.4 you would use XMLEncoder for persistence with future versions, no possible in 1.3.1). You will probably have to study the serialized code and figure out how to deserialize manually... like find what the header size and format is, how objects' classes and values are labeled etc, then rebuild the object on the receiving end using a datainput stream or something...

  • Deserialization order problem

    Hi,
    For a game i am making i am storing the map as a Serialized Object.
    The problem is when i try to paint an image (which should be loaded in the constructor) it is null and thus causing a nullpointer. This only happens after serializing and deserializing the Map. It appears to me that somehow the constructors are not called anymore.
    I am using the following (simplified) objects:
    public class Map implements java.io.Serializable
         //also included are some protected final static primitives
         protected MapModel model;
         //and some other protected primitives and objects     
         public Map()
              this(null);
         public Map(MapModel model)
              this.model=model;
    public class MapModel implements java.io.Serializable
         protected Terrain[][] data;
         private Size size;//simple serializable class
         public MapModel()
              this(new Size());
         public MapModel(Size s)
              data=new Terrain[s.width][s.height];
              size=s;
    public abstract class Terrain implements java.io.Serializable
         protected transient Image view;     
         //some more protected primitives     
         public Terrain()
              this(Allignment.SOUTHWEST);
         public Terrain(int allignment)
              System.out.println("Terrain constructor: "+getClass().getName());
              view=loadImage();
         protected abstract Image loadImage();
         //some more abstract methods
    public abstract class Tile extends Terrain
         //some public final static ints     
         //some protected ints
         public Tile()
              this(Allignment.SOUTHWEST);
         public Tile(int allignment)
              super(allignment);
              System.out.println("Tile constructor");
         //loadImage() is still not implemented
    public class GreyTile extends Tile
         public GreyTile()
              this(Allignment.SOUTHWEST);
         public GreyTile(int allignment)
              super(allignment);
              System.out.println("GreyTile constructor");
         protected java.awt.Image loadImage()
              System.out.println("GreyTile loadImage()");
              //load and return an image
    }The above object tree is created and serialized and produces the expected output:
    Terrain constructor: heroquest.terrain.tiles.GreyTile
    GreyTile loadImage()
    Tile constructor
    GreyTile constructor
    Deserialization however does not produce any output, so loadImage is never called and Terrain.view is null. Which explains the Nullpointer i am getting when trying to paint the GreyTile.
    However i do not understand why my constructors are never called.
    any thoughts?
    Thanks,
    Mr Mean

    This image is loaded in the constructor. And the
    problem is that after deserialization the constructor
    is never exectued.
    My Question is why.First of all, I apologize for not reading through your code thoroughly. Yes your Image object is transient.
    A Ctor is called only when a new instance is created. When deserializing, we are not creating a new instance , we are only restoring a persisted object.
    The deserialization process does not use the Ctor because it is not needed. The only time it needs a Ctor is when deserializing the state of the first non-serializable superclass of a serializable one (deserialization needs to reconstruct the entire object state, which includes the state of any superclasses. If the superclass is not itself serializable, then deserialization needs to instantiate that superclass from scratch ).That superclass won't be restored from the stream, but by invoking that class' no-argument constructor.
    If the default behavior of this process does not suit your purposes, the solution would be to provide your own writeObject/readObject methods to do what you need to do.

  • XML deserialize and decrypting encoding problem. Please help me

    This is my first topic here, so at first I'd like to say "Hi" everyone and apologise for my bad english ;)
    I have just finished my new application about signing/checking and encrypting/decrypting XML files. I use Apache XML Security packages to do this.
    Everything works fine, instead of one...
    I'm Polish and sometimes I have to encrypt or decrypt XML which includes polish letters like: '&#261;' , '&#281;', '&#322;' and some others... If I encrypt such file, it succeeds. The problem is when I try to decrypt such an encrypted file. I recieve an error like :
    "[Fatal Error] :2:7: An invalid XML character (Unicode: 0x19) was found in the element content o
    f the document.
    gov.mf.common.exceptions.SenderException: E_SENDER_DECRYPTION
    at gov.mf.common.xml.encryption.EncryptTool.decrypt(Unknown Source)
    at gov.mf.CERBER.TestCBR.main(Unknown Source)
    Caused by: org.apache.xml.security.encryption.XMLEncryptionException: An invalid XML character
    (Unicode: 0x19) was found in the element content of the document.
    Original Exception was org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x19)
    was found in the element content of the document.
    at org.apache.xml.security.encryption.XMLCipher$Serializer.deserialize(Unknown Source)
    at org.apache.xml.security.encryption.XMLCipher.decryptElement(Unknown Source)
    at org.apache.xml.security.encryption.XMLCipher.doFinal(Unknown Source)
    ... 2 more
    What's wrong? My XML document is UTF-8 encoded, with or without BOM. I wrote in in Notepad++ or any other editior which has UTF-8 encoding.
    I'm parsing my XML with DOM. There is an interesting line in an error above like: " at org.apache.xml.security.encryption.XMLCipher$Serializer.deserialize(Unknown Source)" , do you know that?
    Everything is fine when I try to encrypt/decrypt '�' or '&#324;', but things go wrong with '&#261;', '&#281;', '&#322;' and others... I also managed to encrypt and decrypt '&#322;' but unfortunately, after decryption '&#322;' turns into 'B'. It obviously an encoding problem, but how to fix it?
    I would be really thankfull if some of You guys would help me.
    Looking forward fo any answers.
    Matthew
    Message was edited by:
    matthew_pl

    Hi once again.
    I still don't havy any solution to my problem. I used Apache XML Security examples to encrypt/decrypt my XML document with Polish charaters but I also recieve the same error. What's wrong?
    Here is some code:
    ----- Parsing XML do Document ------
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         //Bardzo wazna linijka - bless TEK ;)
         factory.setNamespaceAware(true);
         DocumentBuilder builder;
         builder = factory.newDocumentBuilder();
         File f = new File(Const.FILE_IN_PATH + File.separator + Const.FILE_IN);     
         org.w3c.dom.Document doc = builder.parse(f);
    ---------- Encrypting & Decrypting XML document (whole class) -------------
    import java.io.*;
    import java.security.*;
    import javax.crypto.SecretKey;
    import javax.crypto.SecretKeyFactory;
    import javax.crypto.spec.DESedeKeySpec;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.apache.xml.security.keys.KeyInfo;
    import org.apache.xml.security.utils.EncryptionConstants;
    import org.apache.xml.security.encryption.XMLCipher;
    import org.apache.xml.security.encryption.EncryptedData;
    import org.apache.xml.security.encryption.EncryptedKey;
    public class EncryptTool
    private PublicKey publicKey;     
    private PrivateKey privateKey;
    static
    org.apache.xml.security.Init.init();
    public EncryptTool()
         publicKey = KeyStores.getCerberPublicKey();
         privateKey = KeyStores.getCerberPrivateKey();
    public Document encrypt(Document doc, String sufix)
    try
         byte[] passPhrase = "24 Bytes per DESede key!".getBytes("UTF-8");
         DESedeKeySpec keySpec = new DESedeKeySpec(passPhrase);
         SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
         SecretKey secretKey = keyFactory.generateSecret(keySpec);
         XMLCipher keyCipher = XMLCipher.getInstance(XMLCipher.RSA_v1dot5);
         keyCipher.init(XMLCipher.WRAP_MODE, publicKey);
         EncryptedKey encryptedKey = keyCipher.encryptKey(doc, secretKey);
              Element elementToEncrypt = (Element) doc.getDocumentElement();
              System.out.println("Szyrfuj&#281;: " + elementToEncrypt.getTextContent());
              XMLCipher xmlCipher = XMLCipher.getInstance(XMLCipher.TRIPLEDES);
              xmlCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
              EncryptedData encryptedDataElement = xmlCipher.getEncryptedData();
              KeyInfo keyInfo = new KeyInfo(doc);
              keyInfo.add(encryptedKey);
              encryptedDataElement.setKeyInfo(keyInfo);
              boolean encryptContentsOnly = true;
              xmlCipher.doFinal(doc, elementToEncrypt, encryptContentsOnly);
              // output the resulting document
              String [] parts = Const.FILE_IN.split("\\.");
              String saveAs = Const.FILE_OUT_PATH + File.separator + parts[0] + sufix + "." + parts[1];
              OutputStream os = new FileOutputStream(saveAs);
              XMLUtil.sameXMLtoFile(doc, os);
    } catch (Exception ex)
         throw new TestCBRException("E_CERBER_ENCRYPTION", ex);
    return doc;
    public void decrypt(Document doc, String sufix) throws SenderException
    try
              String namespaceURI = EncryptionConstants.EncryptionSpecNS;
         String localName = EncryptionConstants._TAG_ENCRYPTEDDATA;
         int ile = doc.getElementsByTagNameNS(namespaceURI, localName).getLength();
         if (ile == 0) throw new SenderException("E_SENDER_DECRYPTION_NEEDED");
         for(int i=0; i < ile; i++)
         Element encryptedDataElement = (Element) doc.getElementsByTagNameNS(namespaceURI, localName).item(0);
         XMLCipher xmlCipher = XMLCipher.getInstance();
         xmlCipher.init(XMLCipher.DECRYPT_MODE, null);
         xmlCipher.setKEK(privateKey);
         xmlCipher.doFinal(doc, encryptedDataElement);
                   String [] parts = Const.FILE_IN.split("\\.");
                   String saveAs = Const.FILE_OUT_PATH + parts[0] + sufix + "." + parts[1];
                   OutputStream os = new FileOutputStream(saveAs);
                        XMLUtil.saveXMLtoFile(doc, os);
    } catch (SenderException ex) {
         throw ex;
    } catch (Exception ex) {
         throw new SenderException("E_SENDER_DECRYPTION", ex);
    Please help me. I'm going into madness what's wrong with it...

Maybe you are looking for

  • Why doesn't Skype Click-to-call work on Windows 8.1?

    Why doesn't Skype click-to-call work anymore? I upgraded to Windows 8.1, and now when I click on a highlighted phone number it asks "Which app should I use" or some such microsoft text. But no application is listed. Apparently it does not work from w

  • Data manuplation in Hyperion

    Hi Gurus We are facing a very strange issue, i.e. Figures entered in or Hyperion forms are locked after finalization of budget, but one good morning we observed that figures are changed or erased in out forms. We have audit trail enabled in our appli

  • What exactly should disabling data services do ?

    When I disable data services, it completly disconnects my device (BB Curve 9300) from internet - even if WiFi connection is active, no application (Browser, Messages/emails,...) can connect to internet anymore. BIS also stops working (even though it

  • Home theatre connect dts-6

    Does anybody know if the home theatre connect?dts - 60?has better sound compared to analog imputs? I'm thinking of buying it for the sound.

  • "Restoring iPod software" freeze on iTunes?

    When restoring iPod software on iTunes, on my 4th gen iPod, it goes all smoothly until the progressesion bar (at the top) appears to freeze near the end. No amount of time solves it. Any idea why this is? Screenshot of iTunes Screenshot of iPod Touch