• 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

converting the json to bean exception

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Following exception is occur while using the json for converting the json to bean..


Exception in thread "main" net.sf.json.JSONException: java.lang.NoSuchMethodException: Property 'name' has no setter method
at net.sf.json.util.PropertySetStrategy$DefaultPropertySetStrategy._setProperty(PropertySetStrategy.java:69)
at net.sf.json.util.PropertySetStrategy$DefaultPropertySetStrategy.setProperty(PropertySetStrategy.java:60)
at net.sf.json.JSONObject.setProperty(JSONObject.java:1547)
at net.sf.json.JSONObject.toBean(JSONObject.java:364)
at net.sf.json.JSONObject.toBean(JSONObject.java:229)
at Json.json2bean(Json.java:53)
at Json.main(Json.java:13)
Caused by: java.lang.NoSuchMethodException: Property 'name' has no setter method
at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1782)
at net.sf.json.util.PropertySetStrategy$DefaultPropertySetStrategy._setProperty(PropertySetStrategy.java:67)
... 6 more
can any one know how to resolve this..
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Create a setter method for "name"?
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Your class should be public

eg

public class xxx
{
}

not

class xxx
{
}
 
A "dutch baby" is not a baby. But this tiny ad is baby sized:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic