Configuration conf = new Configuration().configure();为什么抛出Exception in thread "main" java.lang.NoClassDefFoundError: 啊? org/dom4j/DocumentException 找不到这个类 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 hibernate运行的环境没有搭建好也就是说hibernate需要的jar没有得到供应 应该是包的问题吧。确实包(jar文件) a03180204说的没错.检查下的jdk版本,还有你的 环境变量 中的path是否设置正确了?? 我囧 package v;import org.hibernate.Session;import org.hibernate.SessionFactory;import org.hibernate.cfg.AnnotationConfiguration;import org.hibernate.cfg.Configuration;public class SessionManagerService { private static SessionFactory sessionFactory=null;// private static long timeout=0;// private static long lastRestartTime=0; private SessionManagerService() { } private synchronized static void checkSessionFactory() { System.out.println("进入方法"); if(sessionFactory==null||sessionFactory.isClosed()) { Configuration configuration=new AnnotationConfiguration().configure(); sessionFactory = configuration.buildSessionFactory(); } else { try{ sessionFactory.openSession().createSQLQuery("select 1 from dual").list(); }catch(Exception e) { if(sessionFactory!=null&&!sessionFactory.isClosed()) sessionFactory.close(); try{ sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory(); }catch(Exception ex) { throw new RuntimeException("数据库连接异常"); } } } } public synchronized static Session getSession() { System.out.println("调用之前"); checkSessionFactory(); return sessionFactory.openSession(); }} 我的这个为什么不调用 啊!!!! 求高手帮忙啊 谁能给个线程池应用的例子程序 谢谢了 java ServerSocket的问题 我想报复 初用 Hibernate 总是有个WARNING 请教!怎样用post方式发送http报头? struts中页面转向出现IllegalStateException,求教!! 请教问题,关于Ant方面的问题 请问如何配置eclipse呢。因为我完全是个Java的初学者,请朋友们帮忙~ 大家推荐几本关于java的书! java web启动报错 熟悉JFreeChart的请帮忙看看..........非常急............ Spark源代码编译生成全攻略
也就是说hibernate需要的jar没有得到供应
检查下的jdk版本,还有你的 环境变量 中的path是否设置正确了??
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;public class SessionManagerService {
private static SessionFactory sessionFactory=null;
// private static long timeout=0;
// private static long lastRestartTime=0;
private SessionManagerService()
{
}
private synchronized static void checkSessionFactory()
{
System.out.println("进入方法");
if(sessionFactory==null||sessionFactory.isClosed())
{
Configuration configuration=new AnnotationConfiguration().configure();
sessionFactory = configuration.buildSessionFactory();
}
else
{
try{
sessionFactory.openSession().createSQLQuery("select 1 from dual").list();
}catch(Exception e)
{
if(sessionFactory!=null&&!sessionFactory.isClosed())
sessionFactory.close();
try{
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
}catch(Exception ex)
{
throw new RuntimeException("数据库连接异常");
}
}
}
}
public synchronized static Session getSession()
{
System.out.println("调用之前");
checkSessionFactory();
return sessionFactory.openSession();
}
}
我的这个为什么不调用 啊!!!! 求高手帮忙啊