我具有以下休眠配置。
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration SYSTEM
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="hibernate.connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
<property name="hibernate.connection.url">jdbc:derby://localhost:1527/testdatabase3</property>
<property name="hibernate.hbm2ddl.auto">update</property>
</session-factory>
</hibernate-configuration>
但失败,并显示错误消息:
java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.
at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source) ~[time-event-recognition-0.0.8.jar:na]
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source) ~[time-event-recognition-0.0.8.jar:na]
at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source) ~[time-event-recognition-0.0.8.jar:na]
at java.sql.DriverManager.getConnection(Unknown Source) ~[na:1.8.0_151]
at java.sql.DriverManager.getConnection(Unknown Source) ~[na:1.8.0_151]
at com.zuora.gs.db.DatabaseManager.getDatabaseConnection(DatabaseManager.java:58) ~[time-event-recognition-0.0.8.jar:na]
at com.zuora.gs.db.DatabaseManager.<init>(DatabaseManager.java:47) ~[time-event-recognition-0.0.8.jar:na]
at com.zuora.gs.app.main.time.RecogniseEventFile.doMain(RecogniseEventFile.java:147) ~[time-event-recognition-0.0.8.jar:na]
at com.zuora.gs.app.main.time.RecogniseEventFile.main(RecogniseEventFile.java:57) ~[time-event-recognition-0.0.8.jar:na]
at com.zuora.gs.app.main.time.RecogniseEventPoller.main(RecogniseEventPoller.java:86) [time-event-recognition-0.0.8.jar:na]
Caused by: org.apache.derby.client.am.DisconnectException: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.
请帮助我,根本原因是什么?谢谢!