是不是代码中多次buildSessionFactory了?一般只在第一次使用一个SessionFactory之前build一次,然后保存该实例,以后直接使用。buildSessionFactory比较耗时。