• 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

Trying to use XMLEncoder

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings, previous post on same issue was probably to confusing, so I have simplified the code; Sorry if my example is long.









Why do I get this error on the XML version?

java.lang.InstantiationException: Dog
Continuing ...
java.lang.Exception: XMLEncoder: discarding statement XMLEncoder.writeObject(Dog);
Continuing ...
My Dog's name is Tank
Tank has 4 number of legs.
Persisting nativeTank
Persisted nativeTank
Persisting xmlTank
Persisted xmlTank
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I read the documentation for XMLEncoder, it's supposed to be used for serializing JavaBeans. At least, that's what it says. Now, what's a JavaBean? Here's the link to what Wikipedia says it is: http://en.wikipedia.org/wiki/JavaBean.

Now, read what it says a JavaBean class must have. Does your Dog class have all of those features?
 
Kurt Harless
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I figured it out... from this link webpage

I needed a no-arg constructor to satisfy the bean methodology of the factory creating the xml.

Yea....
 
reply
    Bookmark Topic Watch Topic
  • New Topic