####1.问题:学习JDBC,使用BeanUtils的setProperty方法遇到 java.lang.IllegalAccessException 异常。
具体的异常提示:
Exception in thread "main" java.lang.IllegalAccessException: class org.apache.commons.beanutils.PropertyUtilsBean (in module commons.beanutils) cannot access class com.atguigu.jdbc.Student (in module day23) because module day23 does not export com.atguigu.jdbc to module commons.beanutils
####2.具体的代码:
package com.atguigu.jdbc;
import java.lang.reflect.InvocationTargetException;
import org.apache.commons.beanutils.BeanUtils;
public class TestBeanUtils {
public static void main(String[] args) throws IllegalAccessException, InvocationTargetException {
TestBeanUtils tbu = new TestBeanUtils();
tbu.testSetProperty();
}
public void testSetProperty() throws IllegalAccessException, InvocationTargetException {
Object object = new Student();
System.out.println(object);
BeanUtils.setProperty(object, "IDCard", "4412261");
System.out.println(object);
}
}
其中Student是一个类,有 IDCard 属性。
####3.尝试过的解决方式:
1)根据提示翻译成中文,看自己能否解决。
2)看看是不是module问题。
3)百度搜索Exception in thread "main" java.lang.IllegalAccessException的解决办法。没找到解决方案。
4)去百度找学JDBC的常见异常 ,都没有找到这个异常。
####4.搭建好的环境:

####5.剩余的异常提示: