deploying my first project refusing connection always
ankukmrroy
FREEOP

6 months ago

fortunate-happiness

production

ArchitectureObservabilityLogsSettings

Share

Activity

portfolio-backend

Deployments

Variables

Metrics

Settings

Unexposed service

asia-southeast1-eqsg3a

1 Replica

History

portfolio-backend/c5ec48d

Aug 17, 2025, 5:25 PM

Crashed

Get Help

DetailsBuild LogsDeploy Logs

Filter

Load More

at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:238) ~[mysql-connector-j-9.2.0.jar!/:9.2.0]

at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:180) ~[mysql-connector-j-9.2.0.jar!/:9.2.0]

at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:139) ~[HikariCP-6.3.0.jar!/:na]

at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:368) ~[HikariCP-6.3.0.jar!/:na]

at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:205) ~[HikariCP-6.3.0.jar!/:na]

at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:483) ~[HikariCP-6.3.0.jar!/:na]

at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:571) ~[HikariCP-6.3.0.jar!/:na]

at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:101) ~[HikariCP-6.3.0.jar!/:na]

at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:111) ~[HikariCP-6.3.0.jar!/:na]

at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:126) ~[hibernate-core-6.6.15.Final.jar!/:6.6.15.Final]

at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:483) ~[hibernate-core-6.6.15.Final.jar!/:6.6.15.Final]

at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:46) ~[hibernate-core-6.6.15.Final.jar!/:6.6.15.Final]

... 47 common frames omitted

Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[na:na]

at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]

at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[na:na]

at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[na:na]

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:52) ~[mysql-connector-j-9.2.0.jar!/:9.2.0]

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:95) ~[mysql-connector-j-9.2.0.jar!/:9.2.0]

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:140) ~[mysql-connector-j-9.2.0.jar!/:9.2.0]

at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:156) ~[mysql-connector-j-9.2.0.jar!/:9.2.0]

at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:79) ~[mysql-connector-j-9.2.0.jar!/:9.2.0]

at com.mysql.cj.NativeSession.connect(NativeSession.java:142) ~[mysql-connector-j-9.2.0.jar!/:9.2.0]

at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:961) ~[mysql-connector-j-9.2.0.jar!/:9.2.0]

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825) ~[mysql-connector-j-9.2.0.jar!/:9.2.0]

... 60 common frames omitted

Caused by: java.net.ConnectException: Connection refused

at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]

at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[na:na]

at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:542) ~[na:na]

at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) ~[na:na]

at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[na:na]

at java.base/java.net.Socket.connect(Socket.java:633) ~[na:na]

at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:144) ~[mysql-connector-j-9.2.0.jar!/:9.2.0]

at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:53) ~[mysql-connector-j-9.2.0.jar!/:9.2.0]

... 63 common frames omitted

portfolio-backend | Railway

Solved$10 Bounty

20 Replies

Railway
BOT

6 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


ankukmrroy
FREEOP

6 months ago

no even my deployment is not working at all need help tried many times


brody
EMPLOYEE

6 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 6 months ago


Just wanted to clarify. Was it running earlier during your previous deployments?


abhiveer-avonova

Just wanted to clarify. Was it running earlier during your previous deployments?

ankukmrroy
FREEOP

6 months ago

it is my first deployment .. deploying first time ever but yes running well on local server and i am able to do all expected things . also public or private does make any issue for me i need solution only. if all env setup is correct then why refusing connection also just after 13 sec why mysql server closing it self


Do you currently have a railway setup file? Because contrary to running it locally, you need to create a railway.toml file that sets up build and deploy variables. Also, check if the same port numbers have been setup in the variables section, as that in the local setup.


ankukmrroy

it is my first deployment .. deploying first time ever but yes running well on local server and i am able to do all expected things . also public or private does make any issue for me i need solution only. if all env setup is correct then why refusing connection also just after 13 sec why mysql server closing it self

As i mentioned above, please check if the ports have been setup properly in the project.


abhiveer-avonova

As i mentioned above, please check if the ports have been setup properly in the project.

ankukmrroy
FREEOP

6 months ago

which port

MYSQL_DATABASE="railway"

MYSQL_PUBLIC_URL="mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{MYSQL_DATABASE}}"

MYSQL_ROOT_PASSWORD="zIgKlQEHvKselnZefpvcIPIjbOmKdfRs"

MYSQL_URL="mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:3306/${{MYSQL_DATABASE}}"

MYSQLDATABASE="${{MYSQL_DATABASE}}"

MYSQLHOST="${{RAILWAY_PRIVATE_DOMAIN}}"

MYSQLPASSWORD="${{MYSQL_ROOT_PASSWORD}}"

MYSQLPORT="3306"

MYSQLUSER="root"

above is spring boot microservices project env and below sharing mySQL env

MYSQL_DATABASE="railway" MYSQL_PUBLIC_URL="mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{MYSQL_DATABASE}}" MYSQL_ROOT_PASSWORD="zIgKlQEHvKselnZefpvcIPIjbOmKdfRs" MYSQL_URL="mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:3306/${{MYSQL_DATABASE}}" MYSQLDATABASE="${{MYSQL_DATABASE}}" MYSQLHOST="${{RAILWAY_PRIVATE_DOMAIN}}" MYSQLPASSWORD="${{MYSQL_ROOT_PASSWORD}}" MYSQLPORT="3306" MYSQLUSER="root"

below sharing my project properties
# Trigger fresh Railway build spring.datasource.url=jdbc:mysql://${MYSQLHOST}:${MYSQLPORT}/${MYSQLDATABASE}?useSSL=false&serverTimezone=UTC spring.datasource.username=${MYSQLUSER} spring.datasource.password=${MYSQLPASSWORD} spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # Hibernate (adjust as you like) spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect spring.mail.host=smtp.gmail.com spring.mail.port=587 spring.mail.username=anku.kmr.roy@gmail.com spring.mail.password=#ankukmrROY1991*$ spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true springdoc.api-docs.path=/api-docs springdoc.swagger-ui.path=/swagger-ui.html server.port=${PORT:8080}


ankukmrroy

which portMYSQL_DATABASE="railway"MYSQL_PUBLIC_URL="mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{MYSQL_DATABASE}}"MYSQL_ROOT_PASSWORD="zIgKlQEHvKselnZefpvcIPIjbOmKdfRs"MYSQL_URL="mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:3306/${{MYSQL_DATABASE}}"MYSQLDATABASE="${{MYSQL_DATABASE}}"MYSQLHOST="${{RAILWAY_PRIVATE_DOMAIN}}"MYSQLPASSWORD="${{MYSQL_ROOT_PASSWORD}}"MYSQLPORT="3306"MYSQLUSER="root"above is spring boot microservices project env and below sharing mySQL envMYSQL_DATABASE="railway" MYSQL_PUBLIC_URL="mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{MYSQL_DATABASE}}" MYSQL_ROOT_PASSWORD="zIgKlQEHvKselnZefpvcIPIjbOmKdfRs" MYSQL_URL="mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:3306/${{MYSQL_DATABASE}}" MYSQLDATABASE="${{MYSQL_DATABASE}}" MYSQLHOST="${{RAILWAY_PRIVATE_DOMAIN}}" MYSQLPASSWORD="${{MYSQL_ROOT_PASSWORD}}" MYSQLPORT="3306" MYSQLUSER="root"below sharing my project properties # Trigger fresh Railway build spring.datasource.url=jdbc:mysql://${MYSQLHOST}:${MYSQLPORT}/${MYSQLDATABASE}?useSSL=false&serverTimezone=UTC spring.datasource.username=${MYSQLUSER} spring.datasource.password=${MYSQLPASSWORD} spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # Hibernate (adjust as you like) spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect spring.mail.host=smtp.gmail.com spring.mail.port=587 spring.mail.username=anku.kmr.roy@gmail.com spring.mail.password=#ankukmrROY1991*$ spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true springdoc.api-docs.path=/api-docs springdoc.swagger-ui.path=/swagger-ui.html server.port=${PORT:8080}

MYSQLPORT="3306" --> this. Is it the same as the local setup?


ankukmrroy
FREEOP

6 months ago

below is my local setup which is working well
#local MySql Database connection
#spring.datasource.url=jdbc:mysql://localhost:3306/ak_portfolio_db
#spring.datasource.username=root
#spring.datasource.password=#ankuROY25*$

Can you share the variable section of the MySQL database?


ankukmrroy
FREEOP

6 months ago

already shared above

MYSQL_DATABASE="railway"

MYSQL_PUBLIC_URL="mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{MYSQL_DATABASE}}"

MYSQL_ROOT_PASSWORD="zIgKlQEHvKselnZefpvcIPIjbOmKdfRs"

MYSQL_URL="mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:3306/${{MYSQL_DATABASE}}"

MYSQLDATABASE="${{MYSQL_DATABASE}}"

MYSQLHOST="${{RAILWAY_PRIVATE_DOMAIN}}"

MYSQLPASSWORD="${{MYSQL_ROOT_PASSWORD}}"

MYSQLPORT="3306"

MYSQLUSER="root"


spring.datasource.url=jdbc:mysql://localhost:3306/ak_portfolio_db

Can you check if adding 'jdbc:' to the MYSQL_PUBLIC_URL and MYSQL_URL would give you different results?


ankukmrroy
FREEOP

6 months ago

both are already same but ok i will apply that once and check


ankukmrroy
FREEOP

6 months ago

no having same result


ankukmrroy
FREEOP

6 months ago

Caused by: java.net.ConnectException: Connection refused

at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]

at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[na:na]

at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:542) ~[na:na]

at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) ~[na:na]

at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[na:na]

at java.base/java.net.Socket.connect(Socket.java:633) ~[na:na]

at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:144) ~[mysql-connector-j-


ankukmrroy
FREEOP

6 months ago

actual problem is below container started -- mysql server started -- then container stopped immediately why this is happening i think railway can explain this as i can see log of my sql .. fact is mysql server is not running ..
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/0761173b-9d6d-49be-bb75-9385935536d4/vol_vciu0oxm9juglccl Starting Container 2025-08-17 11:16:30+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.4.0-1.el9 started. 2025-08-17 11:16:30+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2025-08-17 11:16:30+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.4.0-1.el9 started. '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' 2025-08-17T11:16:30.974322Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2025-08-17T11:16:31.099530Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 9.4.0) starting as process 1 2025-08-17T11:16:31.099541Z 0 [System] [MY-015590] [Server] MySQL Server has access to 8 logical CPUs. 2025-08-17T11:16:31.099551Z 0 [System] [MY-015590] [Server] MySQL Server has access to 8000000000 bytes of physical memory. 2025-08-17T11:16:31.106114Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2025-08-17T11:16:31.947025Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2025-08-17T11:16:32.259631Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2025-08-17T11:16:32.259665Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2025-08-17T11:16:32.262092Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. 2025-08-17T11:16:32.307755Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock 2025-08-17T11:16:32.307836Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '9.4.0' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL. Stopping Container 2025-08-17T11:16:43.459753Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 9.4.0). 2025-08-17T11:16:44.243927Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 9.4.0) MySQL Community Server - GPL. 2025-08-17T11:16:44.243942Z 0 [System] [MY-015016] [Server] MySQL Server - end.


ankukmrroy

actual problem is below container started -- mysql server started -- then container stopped immediately why this is happening i think railway can explain this as i can see log of my sql .. fact is mysql server is not running ..Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/0761173b-9d6d-49be-bb75-9385935536d4/vol_vciu0oxm9juglccl Starting Container 2025-08-17 11:16:30+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.4.0-1.el9 started. 2025-08-17 11:16:30+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2025-08-17 11:16:30+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.4.0-1.el9 started. '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' 2025-08-17T11:16:30.974322Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2025-08-17T11:16:31.099530Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 9.4.0) starting as process 1 2025-08-17T11:16:31.099541Z 0 [System] [MY-015590] [Server] MySQL Server has access to 8 logical CPUs. 2025-08-17T11:16:31.099551Z 0 [System] [MY-015590] [Server] MySQL Server has access to 8000000000 bytes of physical memory. 2025-08-17T11:16:31.106114Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2025-08-17T11:16:31.947025Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2025-08-17T11:16:32.259631Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2025-08-17T11:16:32.259665Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2025-08-17T11:16:32.262092Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. 2025-08-17T11:16:32.307755Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock 2025-08-17T11:16:32.307836Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '9.4.0' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL. Stopping Container 2025-08-17T11:16:43.459753Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 9.4.0). 2025-08-17T11:16:44.243927Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 9.4.0) MySQL Community Server - GPL. 2025-08-17T11:16:44.243942Z 0 [System] [MY-015016] [Server] MySQL Server - end.

Can you share the contents of the railway.toml file?


ankukmrroy
FREEOP

6 months ago

sorry don't know where i will get railway.toml file


ankukmrroy
FREEOP

6 months ago

leave it's working now actual problem was 1 . mySQL server was not connecting before so i was not getting sql server public url for connection . i fixed it. but now i want to know why railway is not allowing to modify database name from my project and if not allowing to change database name

howmany user can keep it same and why every one should keep same "railway" a default database name


Status changed to Solved chandrika 6 months ago


Loading...