java.net.ConnectException: Connection refused: connect

Stack Overflow | Tirath | 5 months 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

    Not able to connect to MySQL - Glassfish and Hibernate

    Stack Overflow | 5 months ago | Tirath
    java.net.ConnectException: Connection refused: connect
  2. 0

    how am i supposed to decypher this glassfish log junk?

    Stack Overflow | 2 years ago
    java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : erreur lors de la connexion au serveur localhost sur le port 1527 avec le message Connection refused: connect. Error Code: 0
  3. 0

    SQuirreL SQL Client / Bugs / #1079 SQuirrel Hangs and does not response when Derby Server is not on

    sourceforge.net | 1 year ago
    java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Exception while deploying jpa app on glassfish

    Stack Overflow | 1 year ago | eatSleepCode
    javax.resource.spi.ResourceAllocationException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
  6. 0

    persistence is not using a given port to connect with MySQL DB

    Stack Overflow | 1 year ago | Krystian
    java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException: Błąd podczas łączenia z serwerem localhost na porcie 1527 z komunikatem Connection refused: connect. Error Code: 0
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.net.ConnectException

    Connection refused: connect

    at java.net.DualStackPlainSocketImpl.connect0()
  2. Java RT
    DefaultSocketFactory.createSocket
    1. java.net.DualStackPlainSocketImpl.connect0(Native Method)
    2. java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
    3. java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    4. java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    5. java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    6. java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    7. java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    8. java.net.Socket.connect(Socket.java:589)
    9. java.net.Socket.connect(Socket.java:538)
    10. java.net.Socket.<init>(Socket.java:434)
    11. java.net.Socket.<init>(Socket.java:211)
    12. javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:271)
    12 frames
  3. Apache Derby Client JDBC Driver
    OpenSocketAction.run
    1. org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
    2. org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
    2 frames
  4. Java RT
    AccessController.doPrivileged
    1. java.security.AccessController.doPrivileged(Native Method)
    1 frame
  5. Apache Derby Client JDBC Driver
    ClientJDBCObjectFactoryImpl40.newNetConnection
    1. org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
    2. org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
    3. org.apache.derby.client.am.Connection.initConnection(Unknown Source)
    4. org.apache.derby.client.am.Connection.<init>(Unknown Source)
    5. org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
    6. org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
    7. org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown Source)
    7 frames
  6. Derby
    ClientBaseDataSourceRoot.getConnection
    1. org.apache.derby.jdbc.ClientBaseDataSourceRoot.getConnectionX(Unknown Source)
    2. org.apache.derby.jdbc.ClientBaseDataSourceRoot.getConnection(Unknown Source)
    2 frames
  7. Embedded GlassFish Web
    DSManagedConnectionFactory.createManagedConnection
    1. com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:117)
    1 frame
  8. Connectors Runtime
    ConnectionManagerImpl.allocateConnection
    1. com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:87)
    2. com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:907)
    3. com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1189)
    4. com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:98)
    5. com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionPool.java:282)
    6. com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(ConnectionPool.java:1512)
    7. com.sun.enterprise.resource.pool.ConnectionPool.createResources(ConnectionPool.java:944)
    8. com.sun.enterprise.resource.pool.ConnectionPool.initPool(ConnectionPool.java:230)
    9. com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:511)
    10. com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:381)
    11. com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:245)
    12. com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:171)
    13. com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:360)
    14. com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:307)
    15. com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:196)
    16. com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:171)
    17. com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:166)
    17 frames
  9. Embedded GlassFish Web
    AbstractDataSource.getConnection
    1. com.sun.gjc.spi.base.AbstractDataSource.getConnection(AbstractDataSource.java:147)
    1 frame
  10. org.hibernate.engine
    DatasourceConnectionProviderImpl.getConnection
    1. org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
    1 frame
  11. Hibernate
    NonContextualJdbcConnectionAccess.obtainConnection
    1. org.hibernate.internal.NonContextualJdbcConnectionAccess.obtainConnection(NonContextualJdbcConnectionAccess.java:35)
    1 frame
  12. org.hibernate.resource
    LogicalConnectionManagedImpl.getPhysicalConnection
    1. org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:99)
    2. org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:129)
    2 frames
  13. Hibernate
    SessionImpl.list
    1. org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:47)
    2. org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:146)
    3. org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:172)
    4. org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:148)
    5. org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1940)
    6. org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1909)
    7. org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1887)
    8. org.hibernate.loader.Loader.doQuery(Loader.java:932)
    9. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:349)
    10. org.hibernate.loader.Loader.doList(Loader.java:2615)
    11. org.hibernate.loader.Loader.doList(Loader.java:2598)
    12. org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2430)
    13. org.hibernate.loader.Loader.list(Loader.java:2425)
    14. org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502)
    15. org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371)
    16. org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
    17. org.hibernate.internal.SessionImpl.list(SessionImpl.java:1458)
    17 frames
  14. org.hibernate.query
    AbstractProducedQuery.list
    1. org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1426)
    2. org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1398)
    2 frames
  15. Hibernate
    Query.getResultList
    1. org.hibernate.Query.getResultList(Query.java:417)
    1 frame
  16. org.hibernate.query
    CriteriaQueryTypeQueryAdapter.getResultList
    1. org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.getResultList(CriteriaQueryTypeQueryAdapter.java:72)
    1 frame
  17. Container Common
    TypedQueryWrapper.getResultList
    1. com.sun.enterprise.container.common.impl.QueryWrapper.getResultList(QueryWrapper.java:84)
    2. com.sun.enterprise.container.common.impl.TypedQueryWrapper.getResultList(TypedQueryWrapper.java:73)
    2 frames
  18. com.accountpro.entity
    CityFacadeREST.findAll
    1. com.accountpro.entity.service.AbstractFacade.findAll(AbstractFacade.java:43)
    2. com.accountpro.entity.service.CityFacadeREST.findAll(CityFacadeREST.java:76)
    2 frames
  19. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:498)
    4 frames
  20. jersey-core-server
    ServerRuntime$2.run
    1. org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
    2. org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
    3. org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
    4. org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205)
    5. org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
    6. org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
    7. org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
    8. org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
    9. org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
    9 frames
  21. Jersey Core
    RequestScope.runInScope
    1. org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    2. org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    3. org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    4. org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    5. org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    6. org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    6 frames
  22. jersey-core-server
    ApplicationHandler.handle
    1. org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
    2. org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
    2 frames
  23. jersey-container-servlet-core
    ServletContainer.service
    1. org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471)
    2. org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
    3. org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
    4. org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
    5. org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
    5 frames
  24. Glassfish Core
    StandardPipeline.invoke
    1. org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1681)
    2. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
    3. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    4. org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    5. org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
    5 frames
  25. Glassfish
    WebPipeline.invoke
    1. com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    1 frame
  26. Glassfish Core
    CoyoteAdapter.service
    1. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    2. org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
    3. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
    3 frames
  27. Kernel Classes
    ContainerMapper.service
    1. com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:466)
    2. com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:169)
    2 frames
  28. Grizzly Server
    HttpServerFilter.handleRead
    1. org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
    2. org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
    3. org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    3 frames
  29. Grizzly
    AbstractThreadPool$Worker.run
    1. org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    2. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    3. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    4. org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    5. org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    6. org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    7. org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:526)
    8. org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    9. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    10. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    11. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    12. org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
    13. org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
    13 frames
  30. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:745)
    1 frame