This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
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 Head First Android this week in the Android 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: 32305
    
213

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.



[OCA 8 book] [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
 
jQuery in Action, 3rd edition
 
subject: jsonobject IllegalAccessException can not access member of class java.util.HashMap modifiers private
 
jQuery in Action, 3rd edition