java.sql.SQLException: The application requester cannot establish the connection.(No route to host: connect)

Hibernate JIRA | Muthu | 1 decade ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I've posted this problem in Hibernate forum on Thu Jul 07, 2005 and viewed almost 2000 times but no reply yet. Please let me know if this is a legitimate bug or is there a better way to detect network failures. When Hibernate builds session factory initially it prints an error message "Could not obtain connection metadata" and prints a SQLException stack trace if the network is not available but doesn't throw an expcetion. When I looked at org.hibernate.cfg.SettingsFactory.buildSettings method it catches the SQLException and logs it but doesn't re-throw it, not even a HibernateExpcetion. So, I couldn't get a handle to exception and stop the process. Is there any other way to detect the network availability before opening a session? Will an Exception be thrown from this method in the next release? Code snippet from org.hibernate.cfg.SettingsFactory --------------------------------------------------- try { Connection conn = connections.getConnection(); try { DatabaseMetaData meta = conn.getMetaData(); metaSupportsScrollable = meta.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE); if ( ( batchSize > 0 ) && !meta.supportsBatchUpdates() ) batchSize = 0; if ( Environment.jvmSupportsGetGeneratedKeys() ) { try { Boolean result = (Boolean) DatabaseMetaData.class.getMethod("supportsGetGeneratedKeys", null).invoke(meta, null); metaSupportsGetGeneratedKeys = result.booleanValue(); } catch (AbstractMethodError ame) { metaSupportsGetGeneratedKeys = false; } catch (Exception e) { metaSupportsGetGeneratedKeys = false; } } } finally { connections.closeConnection(conn); } } catch (SQLException sqle) { log.warn("Could not obtain connection metadata", sqle); } catch (UnsupportedOperationException uoe) { // user supplied JDBC connections } [b]Hibernate version:[/b] 3.0.5 [b]Mapping documents:[/b] [b]Code between sessionFactory.openSession() and session.close():[/b] [b]Full stack trace of any exception that occurs:[/b] 2005-07-07 11:45:21,290 WARN main cfg.SettingsFactory Could not obtain connection metadata java.sql.SQLException: The application requester cannot establish the connection.(No route to host: connect) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:460) at com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnection.java:2673) at com.ibm.as400.access.AS400JDBCDriver.prepareConnection(AS400JDBCDriver.java:878) at com.ibm.as400.access.AS400JDBCDriver.initializeConnection(AS400JDBCDriver.java:769) at com.ibm.as400.access.AS400JDBCDriver.connect(AS400JDBCDriver.java:355) at java.sql.DriverManager.getConnection(DriverManager.java:512) at java.sql.DriverManager.getConnection(DriverManager.java:140) at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:118) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1505) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1053) at com.hfa.jacl.persist.common.HibernateService.initialize(HibernateService.java:493)

    Hibernate JIRA | 1 decade ago | Muthu
    java.sql.SQLException: The application requester cannot establish the connection.(No route to host: connect)
  2. 0

    I've posted this problem in Hibernate forum on Thu Jul 07, 2005 and viewed almost 2000 times but no reply yet. Please let me know if this is a legitimate bug or is there a better way to detect network failures. When Hibernate builds session factory initially it prints an error message "Could not obtain connection metadata" and prints a SQLException stack trace if the network is not available but doesn't throw an expcetion. When I looked at org.hibernate.cfg.SettingsFactory.buildSettings method it catches the SQLException and logs it but doesn't re-throw it, not even a HibernateExpcetion. So, I couldn't get a handle to exception and stop the process. Is there any other way to detect the network availability before opening a session? Will an Exception be thrown from this method in the next release? Code snippet from org.hibernate.cfg.SettingsFactory --------------------------------------------------- try { Connection conn = connections.getConnection(); try { DatabaseMetaData meta = conn.getMetaData(); metaSupportsScrollable = meta.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE); if ( ( batchSize > 0 ) && !meta.supportsBatchUpdates() ) batchSize = 0; if ( Environment.jvmSupportsGetGeneratedKeys() ) { try { Boolean result = (Boolean) DatabaseMetaData.class.getMethod("supportsGetGeneratedKeys", null).invoke(meta, null); metaSupportsGetGeneratedKeys = result.booleanValue(); } catch (AbstractMethodError ame) { metaSupportsGetGeneratedKeys = false; } catch (Exception e) { metaSupportsGetGeneratedKeys = false; } } } finally { connections.closeConnection(conn); } } catch (SQLException sqle) { log.warn("Could not obtain connection metadata", sqle); } catch (UnsupportedOperationException uoe) { // user supplied JDBC connections } [b]Hibernate version:[/b] 3.0.5 [b]Mapping documents:[/b] [b]Code between sessionFactory.openSession() and session.close():[/b] [b]Full stack trace of any exception that occurs:[/b] 2005-07-07 11:45:21,290 WARN main cfg.SettingsFactory Could not obtain connection metadata java.sql.SQLException: The application requester cannot establish the connection.(No route to host: connect) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:460) at com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnection.java:2673) at com.ibm.as400.access.AS400JDBCDriver.prepareConnection(AS400JDBCDriver.java:878) at com.ibm.as400.access.AS400JDBCDriver.initializeConnection(AS400JDBCDriver.java:769) at com.ibm.as400.access.AS400JDBCDriver.connect(AS400JDBCDriver.java:355) at java.sql.DriverManager.getConnection(DriverManager.java:512) at java.sql.DriverManager.getConnection(DriverManager.java:140) at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:118) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1505) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1053) at com.hfa.jacl.persist.common.HibernateService.initialize(HibernateService.java:493)

    Hibernate JIRA | 1 decade ago | Muthu
    java.sql.SQLException: The application requester cannot establish the connection.(No route to host: connect)
  3. 0

    JDBC connection errors

    Oracle Community | 9 years ago | 843859
    java.sql.SQLException: [PWS0082] 1 library(s) not added to the library list.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Connection Pool Problem

    Google Groups | 2 decades ago | bsch...@my-deja.com
    java.sql.SQLException: The application server rejected the connection.
  6. 0

    Problem connecting to iSeries from NT using 100%-Java-Driver

    Oracle Community | 1 decade ago | 843854
    java.sql.SQLException: The application requester cannot establish the connection.

  1. marcbouvierdav 2 times, last 3 weeks ago
2 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.sql.SQLException

    The application requester cannot establish the connection.(No route to host: connect)

    at com.ibm.as400.access.JDError.throwSQLException()
  2. JT400
    AS400JDBCDriver.connect
    1. com.ibm.as400.access.JDError.throwSQLException(JDError.java:460)
    2. com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnection.java:2673)
    3. com.ibm.as400.access.AS400JDBCDriver.prepareConnection(AS400JDBCDriver.java:878)
    4. com.ibm.as400.access.AS400JDBCDriver.initializeConnection(AS400JDBCDriver.java:769)
    5. com.ibm.as400.access.AS400JDBCDriver.connect(AS400JDBCDriver.java:355)
    5 frames
  3. Java RT
    DriverManager.getConnection
    1. java.sql.DriverManager.getConnection(DriverManager.java:512)
    2. java.sql.DriverManager.getConnection(DriverManager.java:140)
    2 frames
  4. Hibernate
    DriverManagerConnectionProvider.getConnection
    1. org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
    1 frame
  5. Hibernate
    Configuration.buildSessionFactory
    1. org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:118)
    2. org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1505)
    3. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1053)
    3 frames
  6. com.hfa.jacl
    HibernateService.initialize
    1. com.hfa.jacl.persist.common.HibernateService.initialize(HibernateService.java:493)
    1 frame