当前位置: 代码迷 >> J2EE >> Exception in thread "main" java.lang.IllegalAccessError:
  详细解决方案

Exception in thread "main" java.lang.IllegalAccessError:

热度:649   发布时间:2016-04-22 02:25:20.0
eclipse初次做hibernate实验
执行测试文件的时候报错
信息: Reading mappings from resource: com/bjsxt/hibernate/model/Student.hbm.xml
Exception in thread "main" java.lang.IllegalAccessError: tried to access field org.hibernate.cfg.Configuration.xmlHelper from class org.hibernate.cfg.AnnotationConfiguration
测试文件:
public class StudentTest {
public static void main(String[] args) {
Student s = new Student();
s.setId(1);
s.setName("wang");
s.setAge(22);
Configuration cfg = new AnnotationConfiguration();
SessionFactory sf = cfg.configure().buildSessionFactory();
Session session = sf.openSession();
session.beginTransaction();
session.save(s);
session.getTransaction().commit();
session.close();

sf.close();
}
}

------解决方案--------------------
  相关解决方案