java.lang.IllegalAccessException:与类的公共/私有属性有关吗? [英] java.lang.IllegalAccessException: is related to public / private attribute for classes?
本文介绍了java.lang.IllegalAccessException:与类的公共/私有属性有关吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的Java代码中出现以下错误:
I get the following error in my Java code:
java.lang.IllegalAccessException: Class org.apache.commons.digester.ObjectCreateRule can not access a member of class Response with modifiers ""
访问类Response的成员,也许是因为类Response是不是公共课?
如果是这样,我如何使其可访问并将类Response与主类保留在同一文件中?
Is it maybe because class Response is not public class ? If so, how can I make it accessible and keep the class Response in the same file with the main class ?
谢谢
推荐答案
据我所知,您的类Response应该遵循bean约定:应该是公共的,应该是具有公共默认构造函数,并且应该对从xml引用的所有字段都具有setter和getter。
As far as I remember your class Response should follow the bean convention: should be public, should have public default constructor and should have setters and getters for all fields that you refer from your xml.
这篇关于java.lang.IllegalAccessException:与类的公共/私有属性有关吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文