I am pretty new in Jakarta world. I am trying to do a simple Rest API connected to SQL Server. A simple Entity that should be displayed in JSON format. When I am trying to deploy the app using Glassfish server app I am getting the following error:
[2022-04-12T03:42:50.974+0300] [glassfish 6.0] [INFO] [] [jakarta.enterprise.system.tools.deployment.common] [tid: _ThreadID=48 _ThreadName=admin-listener(1)] [timeMillis: 1649724170974] [levelValue: 800] [[
visiting unvisited references]]
[2022-04-12T03:42:51.439+0300] [glassfish 6.0] [INFO] [] [org.eclipse.persistence.session./file:/D:/faculta - mi/Licenta/demo4/target/demo4-1.0-SNAPSHOT/WEB-INF/classes/_default] [tid: _ThreadID=48 _ThreadName=admin-listener(1)] [timeMillis: 1649724171439] [levelValue: 800] [[
EclipseLink, version: Eclipse Persistence Services - 3.0.0.v202012081010]]
[2022-04-12T03:42:53.746+0300] [glassfish 6.0] [WARNING] [poolmgr.create_resource_error] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource.allocator] [tid: _ThreadID=48 _ThreadName=admin-listener(1)] [timeMillis: 1649724173746] [levelValue: 900] [[
[2022-04-12T03:42:53.746+0300] [glassfish 6.0] [WARNING] [poolmgr.get_connection_failure] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors] [tid: _ThreadID=48 _ThreadName=admin-listener(1)] [timeMillis: 1649724173746] [levelValue: 900] [[
[2022-04-12T03:42:53.747+0300] [glassfish 6.0] [WARNING] [jdbc.exc_get_conn] [javax.enterprise.resource.resourceadapter.com.sun.gjc.spi] [tid: _ThreadID=48 _ThreadName=admin-listener(1)] [timeMillis: 1649724173747] [levelValue: 900] [[
RAR5038:Unexpected exception while creating resource for pool DerbyPool. Exception : jakarta.resource.spi.ResourceAllocationException: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.]]
RAR5117 : Failed to obtain/create connection from connection pool [ DerbyPool ]. Reason : com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.]]
RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.]]]
[2022-04-12T03:42:53.747+0300] [glassfish 6.0] [SEVERE] [] [org.eclipse.persistence.session./file:/D:/faculta - mi/Licenta/demo4/target/demo4-1.0-SNAPSHOT/WEB-INF/classes/_default.ejb] [tid: _ThreadID=48 _ThreadName=admin-listener(1)] [timeMillis: 1649724173747] [levelValue: 1000] [[
Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 3.0.0.v202012081010): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: 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 1,527 with message Connection refused: connect.
Error Code: 0
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:319)
Caused by: 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 1,527 with message Connection refused: connect.
at com.sun.gjc.spi.base.AbstractDataSource.getConnection(AbstractDataSource.java:128)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:149)
Caused by: jakarta.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 1,527 with message Connection refused: connect.
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:295)
a
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.
at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:79)
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.
at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:899)
Caus
Caused by: jakarta.resource.spi.ResourceAllocationException: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.
at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:105)
Caused by: java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.
Caused by: ERROR 08001: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.
Caused by: java.net.ConnectException: Connection refused: connect
]]
[2022-04-12T03:42:53.751+0300] [glassfish 6.0] [SEVERE] [] [jakarta.enterprise.system.core] [tid: _ThreadID=48 _ThreadName=admin-listener(1)] [timeMillis: 1649724173751] [levelValue: 1000] [[
Exception while deploying the app [demo4-1.0-SNAPSHOT]]]
[2022-04-12T03:42:53.751+0300] [glassfish 6.0] [SEVERE] [NCLS-CORE-00026] [jakarta.enterprise.system.core] [tid: _ThreadID=48 _ThreadName=admin-listener(1)] [timeMillis: 1649724173751] [levelValue: 1000] [[
Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 3.0.0.v202012081010): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: 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 1,527 with message Connection refused: connect.
Error Code: 0
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:853)
]]
[2022-04-12T03:42:53.762+0300] [glassfish 6.0] [SEVERE] [] [jakarta.enterprise.system.core] [tid: _ThreadID=48 _ThreadName=admin-listener(1)] [timeMillis: 1649724173762] [levelValue: 1000] [[
Exception while deploying the app [demo4-1.0-SNAPSHOT] : Exception [EclipseLink-4002] (Eclipse Persistence Services - 3.0.0.v202012081010): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: 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 1,527 with message Connection refused: connect.
Error Code: 0]]
What should I do in order to solve this?
P.s.: I forgot to mention that I work on Intellij and I already connected Intellij to that sql server
I solved this by recreating the sql server connection with glassfish app server, recreating the connection pool and the datasource. Something was wrong there but I can't figure what was wrong.