问题:
Exception in thread "main" java.lang.IllegalAccessException: Class cn.shengulong.moduledemotwo.classloaderdemo.Demo1 can not access a member of class cn.shengulong.moduledemotwo.classloaderdemo.ClassLoaderTest1 with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
at java.lang.Class.newInstance(Class.java:436)
at cn.shengulong.moduledemotwo.classloaderdemo.Demo1.main(Demo1.java:75)
原因:
如上所示,原因是因为ClassLoaderTest1 定义时不是Public Class,解决的办法就是将SSOValidateModule 定义为Public类。
java.lang.IllegalAccessException;java.lang.Class.newInstance