论坛首页 Java企业应用论坛

在tomcat 4.1下测试成功的程序到了tomcat 5.0下就出错了

浏览 5080 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2004-08-17  
在tomcat4.1 下hibernate 2.1.2 数据库MySQL4.0
在tomcat4.1 下一切正常
程序如下:
essionFactory sessionFactory=null;
Configuration  conf = null;
Session ses;
conf = new Configuration();

conf=conf.configure();

sessionFactory = conf.buildSessionFactory();
ses = sessionFactory.openSession();
Transaction tran = ses.beginTransaction();
String sql = "from Person as person ";
Query query = ses.createQuery(sql);
Iterator it= query.iterate();


while(it.hasNext())
{
Person per = (Person)it.next();

out.println(per.getAddress());
}

tran.commit();
ses.close();


但到了tomcat 5.0下
出现的以下的错误:
description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Could not find datasource: Name jdbc is not bound in this Context
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.test_jsp._jspService(test_jsp.java:152)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

net.sf.hibernate.HibernateException: Could not find datasource: Name jdbc is not bound in this Context
net.sf.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:48)
net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:75)
net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:146)
net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:594)
org.apache.jsp.test_jsp._jspService(test_jsp.java:60)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

请各位指教
谢谢!
   发表时间:2004-08-17  
你是不是XX阿?

javax.servlet.ServletException: Could not find datasource: Name jdbc is not bound in this Context

Name jdbc is not bound in this Context
0 请登录后投票
   发表时间:2004-08-17  
楼上的 我数据源配置了 并测试了可以连接
但是用hibernate 之后就不行了
0 请登录后投票
   发表时间:2004-08-17  
好好差差,肯定是少加了一些包。在webapp中。
0 请登录后投票
   发表时间:2004-08-17  
tomcat4.0和tomcat5.0以上版本配置数量源的方法不同了,重配一下吧。
0 请登录后投票
   发表时间:2004-08-17  
谢谢大家的关注,是因为hibernate包的问题,现已经解决
0 请登录后投票
   发表时间:2004-08-19  
数据原配置乐吗?
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics