java.lang.IllegalAccessException:与类的公共/私有属性有关吗? [英] java.lang.IllegalAccessException: is related to public / private attribute for classes?

查看:174
本文介绍了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 ?

谢谢

更新,代码: http://www.smipple.net/snippet/aneuryzma/on:%20is%20related%20related%20to%20public%20/%20private%20attribute%20for%20classes%20 %3F

推荐答案

据我所知,您的类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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆