I have created an application using hibernate... It works fine with database when I run it through Netbeans. But when I build application (using Clean and Build tool) it does not work with database.
Error:
WARNING: SQL Error: 40000, SQLState: 08001 May 21, 2010 4:25:11 PM org.hibernate.util.JDBCExceptionReporter logExceptions SEVERE: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect. Exception in thread "AWT-EventQueue-0" org.hibernate.exception.JDBCConnectionException: **Cannot open connection** at org.hibernate.exception.SQLStateConverter.convert( SQLStateConverter.java:74) at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelper.java:43) at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelper.java:29) at org.hibernate.jdbc.ConnectionManager.openConnectio n(ConnectionManager.java:426) at org.hibernate.jdbc.ConnectionManager.getConnection (ConnectionManager.java:144) at org.hibernate.jdbc.AbstractBatcher.prepareQuerySta tement(AbstractBatcher.java:139) at org.hibernate.loader.Loader.prepareQueryStatement( Loader.java:1547) at org.hibernate.loader.Loader.doQuery(Loader.java:67 3) at org.hibernate.loader.Loader.doQueryAndInitializeNo nLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.doList(Loader.java:222 0) at org.hibernate.loader.Loader.listIgnoreQueryCache(L oader.java:2104) at org.hibernate.loader.Loader.list(Loader.java:2099) at org.hibernate.loader.hql.QueryLoader.list(QueryLoa der.java:378) at org.hibernate.hql.ast.QueryTranslatorImpl.list(Que ryTranslatorImpl.java:338) at org.hibernate.engine.query.HQLQueryPlan.performLis t(HQLQueryPlan.java:172) at org.hibernate.impl.SessionImpl.list(SessionImpl.ja va:1121) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:7 9) at ajmalispatientdatamanager.StartPage.searchMethod(S tartPage.java:852) at ajmalispatientdatamanager.StartPage.SearchBtnActio nPerformed(StartPage.java:599) at ajmalispatientdatamanager.StartPage.access$900(Sta rtPage.java:33) at ajmalispatientdatamanager.StartPage$8.actionPerfor med(StartPage.java:382) at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source) at javax.swing.AbstractButton$Handler.actionPerformed (Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect. at org.apache.derby.client.am.SQLExceptionFactory40.g etSQLException(Unknown Source) at org.apache.derby.client.am.SqlException.getSQLExce ption(Unknown Source) at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at org.hibernate.connection.DriverManagerConnectionPr ovider.getConnection(DriverManagerConnectionProvid er.java:110) at org.hibernate.jdbc.ConnectionManager.openConnectio n(ConnectionManager.java:423) ... 42 more Caused by: org.apache.derby.client.am.DisconnectException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect. at org.apache.derby.client.net.NetAgent.<init>(Unknow n Source) at org.apache.derby.client.net.NetConnection.newAgent _(Unknown Source) at org.apache.derby.client.am.Connection.<init>(Unkno wn Source) at org.apache.derby.client.net.NetConnection.<init>(U nknown Source) at org.apache.derby.client.net.NetConnection40.<init> (Unknown Source) at org.apache.derby.client.net.ClientJDBCObjectFactor yImpl40.newNetConnection(Unknown Source) ... 47 more Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.<init>(Unknown Source) at java.net.Socket.<init>(Unknown Source) at javax.net.DefaultSocketFactory.createSocket(Unknow n Source) at org.apache.derby.client.net.OpenSocketAction.run(U nknown Source) at java.security.AccessController.doPrivileged(Native Method) ... 53 more
Please Help Me. Please Help Me.