标题:郁闷的数据库异常
只看楼主
dingpin
Rank: 1
等 级:新手上路
帖 子:281
专家分:0
注 册:2007-9-29
 问题点数:0 回复次数:3 
郁闷的数据库异常
MyEclipse + Hibernate 的报如下错误:

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Cannot open connection
    org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

org.hibernate.exception.JDBCConnectionException: Cannot open connection
    org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
    org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
    org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
    org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
    org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:105)
    org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
    org.hibernate.loader.Loader.doQuery(Loader.java:661)
    org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
    org.hibernate.loader.Loader.doList(Loader.java:2145)
    org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
    org.hibernate.loader.Loader.list(Loader.java:2024)
    org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
    org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
    org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
    org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)
    org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
    com.accp.dingpin.server.dao.impl.hb.UserInfoDao.isExistUser(UserInfoDao.java:53)
    com.accp.dingpin.server.action.LoginAction.execute(LoginAction.java:57)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

com.microsoft.sqlserver.jdbc.SQLServerException: 到主机  的 TCP/IP 连接失败。 Connection refused: connect
    com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
    com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source)
    com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)
    com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
    com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
    java.sql.DriverManager.getConnection(Unknown Source)
    java.sql.DriverManager.getConnection(Unknown Source)
    org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
    org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
    org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
    org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:105)
    org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
    org.hibernate.loader.Loader.doQuery(Loader.java:661)
    org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
    org.hibernate.loader.Loader.doList(Loader.java:2145)
    org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
    org.hibernate.loader.Loader.list(Loader.java:2024)
    org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
    org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
    org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
    org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)
    org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
    com.accp.dingpin.server.dao.impl.hb.UserInfoDao.isExistUser(UserInfoDao.java:53)
    com.accp.dingpin.server.action.LoginAction.execute(LoginAction.java:57)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.26 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.26




我的 hibernate.cfg.xml 如下:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.

<!-- Generated by MyEclipse Hibernate Tools.                   -->
<hibernate-configuration>

    <session-factory>
        <property name="connection.username">sa</property>
        <property name="connection.url">jdbc:sqlserver://localhost:1433</property>
        <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
        <property name="myeclipse.connection.profile">SQL2005</property>
        <property name="connection.password">sa</property>
        <property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
        <mapping resource="com/accp/dingpin/pojo/entity/UserT.hbm.xml" />
        <mapping resource="com/accp/dingpin/pojo/entity/Products.hbm.xml" />
        <mapping resource="com/accp/dingpin/pojo/entity/Categories.hbm.xml" />

    </session-factory>

</hibernate-configuration>



请高手给解决一下.另外说明一下,我的电脑装了SQL2000和SQL2005
好像都不能用JDBC连接数据库
搜索更多相关主题的帖子: 数据库 apache action java The 
2008-06-02 23:42
dingpin
Rank: 1
等 级:新手上路
帖 子:281
专家分:0
注 册:2007-9-29
得分:0 
怎么没人回呢?郁闷啊

我的地盘我做主!
2008-06-04 21:22
luyihuaa5201
Rank: 2
等 级:论坛游民
帖 子:254
专家分:10
注 册:2007-3-25
得分:0 
你安装的时候,选择用户是windows验证呀还是sql验证啊 。如果是windows验证就用用户名登不进去。
2008-06-05 15:02
dingpin
Rank: 1
等 级:新手上路
帖 子:281
专家分:0
注 册:2007-9-29
得分:0 
好像是windows

我的地盘我做主!
2008-06-05 20:52



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-217291-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.633846 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved