Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Jar file does not work with database (Hibernate)

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Jar file does not work with database (Hibernate)

    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.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Jar file does not work with database (Hibernate)

    This thread has been cross posted here:

    http://www.java-forums.org/advanced-java/53186-jar-file-does-not-work-database-hibernate.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting


  3. #3
    Junior Member
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Jar file does not work with database (Hibernate)

    no anybody answer to my question?

Similar Threads

  1. why i can't upload file to database
    By hidden_daisy in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: November 13th, 2011, 01:15 PM
  2. How to make Eclipse work with txt file?
    By Prostak in forum What's Wrong With My Code?
    Replies: 6
    Last Post: November 4th, 2011, 05:43 PM
  3. File Reading code doesn't work
    By koryvandell in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 25th, 2011, 08:40 AM
  4. Replies: 1
    Last Post: March 24th, 2011, 08:22 PM
  5. File IO Compiles, but wont work?
    By StarKannon in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: February 2nd, 2011, 09:05 AM

Tags for this Thread