*
The moose likes Other Open Source Projects and the fly likes jsonobject IllegalAccessException can not access member of class java.util.HashMap modifiers private Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "jsonobject IllegalAccessException can not access member of class java.util.HashMap modifiers private" Watch "jsonobject IllegalAccessException can not access member of class java.util.HashMap modifiers private" New topic
Author

jsonobject IllegalAccessException can not access member of class java.util.HashMap modifiers private

Gaurav tyagigaurav
Greenhorn

Joined: Jul 30, 2008
Posts: 15
I am getting the following error while creating a JSONObject:

Caused by: java.lang.IllegalAccessException: Class org.json.JSONObject can not access a member of class java.util.HashMap with modifiers "private"

The DTO has 3 properties:

The error is thrown while creating a JSON object at:

where object is the DTO object.
Not sure what am I doing wrong here or missing something. If i just have the list as the property then it works fine.
I would really appreciate any pointers to the soln.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30758
    
156

That code doesn't compile. list should be uppercase and HashMapMap isn't a class name. While it is obvious what is intended, I wonder if you are somehow pointing to other classes. Or your example is different than the one posted. The following works just fine. Try changing it to your one line at a time to see where the error gets introduced.



[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsonobject IllegalAccessException can not access member of class java.util.HashMap modifiers private