java.sql.SQLException: 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.

Java.net JIRA | arunkumar_s | 4 years ago
  1. 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
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    Tworzenie samodzielnej aplikacji z Hibernate w NetBeans IDE 6.9 – Jacek Laskowski - Wiki Amatora Programowania

    jaceklaskowski.pl | 1 year ago
    java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused.
  4. 0

    Creating users: JDBCConnectionException - PushToTest Community Forums

    pushtotest.com | 1 year ago
    org.hibernate.exception.JDBCConnectionException: Cannot open connection

  1. trust56metal 1 times, last 1 year ago
  2. sriharshakiran 114 times, last 5 months ago
5 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.net.ConnectException

    Connection refused

    at java.net.PlainSocketImpl.socketConnect()
  2. Java RT
    DefaultSocketFactory.createSocket
    1. java.net.PlainSocketImpl.socketConnect(Native Method)
    2. java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    3. java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    4. java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    5. java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
    6. java.net.Socket.connect(Socket.java:579)
    7. java.net.Socket.connect(Socket.java:528)
    8. java.net.Socket.<init>(Socket.java:425)
    9. java.net.Socket.<init>(Socket.java:208)
    10. javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:271)
    10 frames
  3. Apache Derby Client JDBC Driver
    OpenSocketAction.run
    1. org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
    1 frame
  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
    ClientDataSource.getConnection
    1. org.apache.derby.jdbc.ClientDataSource.getConnectionX(Unknown Source)
    2. org.apache.derby.jdbc.ClientDataSource.getConnection(Unknown Source)
    2 frames
  7. Embedded GlassFish Web
    DSManagedConnectionFactory.createManagedConnection
    1. com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:115)
    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:170)
    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:114)
    1 frame
  10. com.ibm.jbatch
    BatchKernelImpl.<init>
    1. com.ibm.jbatch.container.services.impl.JDBCPersistenceManagerImpl.getConnectionToDefaultSchema(JDBCPersistenceManagerImpl.java:340)
    2. com.ibm.jbatch.container.services.impl.JDBCPersistenceManagerImpl.isDerby(JDBCPersistenceManagerImpl.java:171)
    3. com.ibm.jbatch.container.services.impl.JDBCPersistenceManagerImpl.init(JDBCPersistenceManagerImpl.java:132)
    4. com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader.getService(ServicesManagerImpl.java:358)
    5. com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader.access$300(ServicesManagerImpl.java:341)
    6. com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl.getService(ServicesManagerImpl.java:261)
    7. com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl.getPersistenceManagerService(ServicesManagerImpl.java:292)
    8. com.ibm.jbatch.container.impl.BatchKernelImpl.<init>(BatchKernelImpl.java:83)
    8 frames
  11. Java RT
    Constructor.newInstance
    1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    4. java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    4 frames
  12. com.ibm.jbatch
    JobOperatorImpl.<init>
    1. com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader._loadService(ServicesManagerImpl.java:404)
    2. com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader._loadServiceHelper(ServicesManagerImpl.java:377)
    3. com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader.getService(ServicesManagerImpl.java:357)
    4. com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader.access$300(ServicesManagerImpl.java:341)
    5. com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl.getService(ServicesManagerImpl.java:261)
    6. com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl.getBatchKernelService(ServicesManagerImpl.java:307)
    7. com.ibm.jbatch.container.api.impl.JobOperatorImpl.<init>(JobOperatorImpl.java:72)
    7 frames
  13. Java RT
    ServiceLoader$1.next
    1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    4. java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    5. java.lang.Class.newInstance0(Class.java:374)
    6. java.lang.Class.newInstance(Class.java:327)
    7. java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
    8. java.util.ServiceLoader$1.next(ServiceLoader.java:445)
    8 frames
  14. JavaEE 7
    BatchRuntime$1.run
    1. javax.batch.runtime.BatchRuntime$1.run(BatchRuntime.java:52)
    2. javax.batch.runtime.BatchRuntime$1.run(BatchRuntime.java:47)
    2 frames
  15. Java RT
    AccessController.doPrivileged
    1. java.security.AccessController.doPrivileged(Native Method)
    1 frame
  16. JavaEE 7
    BatchRuntime.getJobOperator
    1. javax.batch.runtime.BatchRuntime.getJobOperator(BatchRuntime.java:47)
    1 frame
  17. org.glassfish.batch
    AbstractListCommand.execute
    1. org.glassfish.batch.ListBatchJobs.findJobExecutions(ListBatchJobs.java:177)
    2. org.glassfish.batch.ListBatchJobs.executeCommand(ListBatchJobs.java:118)
    3. org.glassfish.batch.AbstractListCommand.execute(AbstractListCommand.java:101)
    3 frames
  18. Kernel Classes
    CommandRunnerImpl$2$1.run
    1. com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
    2. com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
    2 frames
  19. Java RT
    Subject.doAs
    1. java.security.AccessController.doPrivileged(Native Method)
    2. javax.security.auth.Subject.doAs(Subject.java:356)
    2 frames
  20. Kernel Classes
    CommandRunnerImpl$ExecutionContext.execute
    1. com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
    2. com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
    3. com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
    4. com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
    5. com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
    6. com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
    6 frames
  21. org.glassfish.admin
    CommandResource.execCommandSimpInMultOut
    1. org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:396)
    2. org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:234)
    2 frames
  22. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:601)
    4 frames
  23. jersey-core-server
    ServerRuntime$1.run
    1. org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
    2. org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125)
    3. org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
    4. org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)
    5. org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346)
    6. org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)
    7. org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
    8. org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:217)
    8 frames
  24. Jersey Core
    RequestScope.runInScope
    1. org.glassfish.jersey.internal.Errors$1.call(Errors.java:231)
    2. org.glassfish.jersey.internal.Errors$1.call(Errors.java:227)
    3. org.glassfish.jersey.internal.Errors.process(Errors.java:275)
    4. org.glassfish.jersey.internal.Errors.process(Errors.java:257)
    5. org.glassfish.jersey.internal.Errors.process(Errors.java:227)
    6. org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    6 frames
  25. jersey-core-server
    ApplicationHandler.handle
    1. org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:191)
    2. org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:819)
    2 frames
  26. jersey-container-grizzly2-http
    GrizzlyHttpContainer.service
    1. org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:325)
    1 frame
  27. GlassFish Admin
    RestAdapter.service
    1. org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:161)
    2. org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:181)
    2 frames
  28. Kernel Classes
    ContainerMapper.service
    1. com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
    1 frame
  29. Grizzly Server
    HttpServerFilter.handleRead
    1. org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    2. org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    3. org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    3 frames
  30. Grizzly
    ProcessorExecutor.execute
    1. org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    2. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    3. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    4. org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    5. org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    6. org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    6 frames
  31. Nucleus Grizzly jars Combining
    PUFilter.handleRead
    1. org.glassfish.grizzly.portunif.PUFilter.handleRead(PUFilter.java:231)
    1 frame
  32. Grizzly
    ProcessorExecutor.execute
    1. org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    2. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    3. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    4. org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    5. org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    6. org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    6 frames
  33. Nucleus Grizzly jars Combining
    PUFilter.handleRead
    1. org.glassfish.grizzly.portunif.PUFilter.handleRead(PUFilter.java:231)
    1 frame
  34. Grizzly
    AbstractThreadPool$Worker.run
    1. org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    2. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    3. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    4. org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    5. org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    6. org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    7. org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    8. org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    9. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    10. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    11. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    12. org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    13. org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    13 frames
  35. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:722)
    1 frame