• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Serialization Error

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am getting an error when i invoke the operation in a webservice.
one of my webservice method is shown below. This method returns Object[]. When i invoke this method i am getting the error as discussed before.
Error --- no serializer is registered for (class org.apache.commons.beanutils.BasicDynaBean, null).

****************************************
// queryValueMap contains{key - type @List , value -type @List}
// This hashmap value is the list object which contains BasicDynaBean objects.

public Object[] getRowValues() {
Object[] a =null;
Iterator keyIter = queryValueMap.keySet().iterator();
while(keyIter.hasNext()){
List list = (List) keyIter.next();
List valueList = (List) queryValueMap.get(list);

a = valueList.toArray();
}

return a;
}
*************************************************************

Any help is appreciable. And if i need to Serialize and deserialize how can i do that.
Hope to get some solution.

Thanks.
 
Pinik Tilli
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And here is the error description.
*************************************************************************
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://dataaccess/types/" xmlns:ns1="http://www.oracle.com/webservices/internal/literal"><env:Body><env:Fault><faultcode>env:Server</faultcode>
<faultstring>Internal Server Error (serialization error: no serializer is registered for (class org.apache.commons.beanutils.BasicDynaBean, null))</faultstring></env:Fault></env:Body></env:Envelope>
****************************************************************************

I am using RowSetDynaClass for representing the results of an SQL query.

Thanks.
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi "Nalini T"
  • Your display name still doesn't quite comply with the JavaRanch official policy on registered names. "with a first and last name" "You can even use initials for the first name if you like." So if you simply want to swap the initial to the front then that would be fine.
  • Please do not post the same message multiple times, either in the same forum or across different JavaRanch forums. You can delete your own messages by "editing" them and checking the "Delete Post? (check box, if yes)" checkbox, should you accidentally create multiple messages.
  • Ease Up (in reference to your original message and the impression that multiple identical messages leave).
  • Respect Your Coranchers Privacy
  • In your original message you stated that the problem was solved.



  • Your code and error message shows that you still haven't addressed the issue: the object hidden away in the object array still has to be serialized. So if that object doesn't have a default serializer/de-serializer pair you will have write one.

    See Java API for XML-Based RPC (JAX-RPC) Specification 1.1 (JSR-101); Section: 19 Appendix: Serialization Framework

    The other alternative is to extract the information from the object into variables with a data type that has default serialization/de-serialization support and send those variables instead.
    Section: 5 Java to XML/WSDL Mapping

    The best alternative is to design your service WSDL-first (possibly defining your data XML Schemas separately) using the supported XSD types as outlined in 18. Appendix: XML Schema Support and then use the WSDL2Java tool to generate the stubs. Then you can unload the data form your original objects and load the data into instances of the classes provided by the stub.
    Section: 4 WSDL/XML to Java Mapping
     
    Greenhorn
    Posts: 4
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I had the same problem recently. I resolved it by returning one of my own objects that extends java.lang.Object. I use Rational App Developer for an IDE, and the Serialize and Deserialize classes were automatically created once I started using my own class instead of Object. Instead of returning Object[] I return an array of my own class like this:

    return (MyClass[])listObj.toArray(new MyClass[0]);

    I hope this helps.
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Welcome back to JavaRanch "John K",

    If I could divert your attention to the JavaRanch official policy on registered names. Please adjust your display name here in accordance with the policy. Why not use the latter part of your publicly visible email address?
    Thank You.
     
    Pinik Tilli
    Greenhorn
    Posts: 19
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Peer and John,

    Thanks for the reply. I have resolved the error by extracting the information from bean object. I have put the property name and its value from bean in to the hashtable. And now webservice is working fine with no exceptions.

    Regards,
    Pinik
     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic