a year ago
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
but there is a var for url 100%
108 Replies
a year ago
Are you using springboot data jpa or mybatis
datasource:
url: ${DATABASE_URL}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: org.postgresql.Driver
jpa:
show-sql: true
properties:
hibernate:
format_sql: true
hibernate:
ddl-auto: update
a year ago
I believe you're missing the spring key before datasource
a year ago
spring:
datasource:
url: ${DATABASE_URL}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: org.postgresql.DriverI have it, it is working on local, it also worked before on railway until I started a new application, I forgot what I used in the variables
spring:
application:
name: Layers
datasource:
url: ${DATABASE_URL}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: org.postgresql.Driver
jpa:
show-sql: true
properties:
hibernate:
format_sql: true
hibernate:
ddl-auto: update
a year ago
please use code blocks
a year ago
You're setting the DATABASE_URL environmental variable?
a year ago
```
before and after
a year ago
What you need to do is make an environmental variable in your Springboot app called DATABASE_URL
Assign it to the value ${{Postgres.DATABASE_URL}}
I did and this is what I have now:
DB_PASSWORD="hidden"
DB_USERNAME="postgres"```
a year ago
That's your raw variables in your Springboot service, correct?
so the URL is from the private tab and the username and password are from the public tab
a year ago
No idea what that means
a year ago
Ah sorry that's not going to work because JDBC
a year ago
Brb
a year ago
jdbc:postgresql://${{Postgres.RAILWAY_PRIVATE_DOMAIN}}:${{Postgres.PGPORT}}/${{Postgres.PGDATABASE}}
That should do the job
a year ago
DATABASE_URL value
a year ago
Replace what you have for it
a year ago
Java is stupid
a year ago
DB_PASSWORD="${{Postgres.PGPASSWORD}}"
DB_USERNAME="${{Postgres.PGUSER}}"so in URL do I put: jdbc:postgresql://${{Postgres.RAILWAY_PRIVATE_DOMAIN}}:${{Postgres.PGPORT}}/${{Postgres.PGDATABASE}}
or just: ${{Postgres.RAILWAY_PRIVATE_DOMAIN}}
a year ago
the first one
a year ago
the whole thing
a year ago
DATABASE_URL=jdbc:postgresql://${{Postgres.RAILWAY_PRIVATE_DOMAIN}}:${{Postgres.PGPORT}}/${{Postgres.PGDATABASE}}
java.lang.RuntimeException: Driver org.postgresql.Driver claims to not accept jdbcUrl, jdbc:postgresql://:/
a year ago
Yeah that error shows that none of the env variables actually resolved
a year ago
Your Postgres service is still called what it was up there right
a year ago
Screenshot your architecture page
a year ago
Oh nos you have to have them in the same project
a year ago
Won't work unless you do
a year ago
Why do you have them in different projects?
a year ago
You can't move it you'll need to make a new one
a year ago
But once you do it should immediately all work
a year ago
Looks like they are all in different projects; it should be in one project.
a year ago
If you connect them using public URL it will cost you egress so it is efficient in one project and use internal URL.
a year ago
they aren't doing that anyway
a year ago
no...
DB_PASSWORD="${{Postgres.PGPASSWORD}}"
DB_USERNAME="${{Postgres.PGUSER}}"
EMAIL_PASSWORD="okfaezxundjhutyf"
EMAIL_USERNAME="layers.app1@gmail.com"
JWT_SECRET="MyVeryStrongJWTSecretKey_987654321!@"
NIXPACKS_JDK_VERSION="21"
PORT="8080"```
a year ago
It will work, but in your case you should use one project.
a year ago
Then use internal variables
a year ago
As long as you moved your database over to that project you're golden
a year ago
(and make sure it's still called Postgres)
a year ago
Yeah the solution here, just move them in your project then it should work.
a year ago
perfect
a year ago
what's the error this time
a year ago
yeah share the error logs
a year ago
@Loudbook I think the user should delete this? It has secrets and email passwords.
a year ago
considering it says "MyVeryStrong..." i would assume they're going to change it
2025-06-25T03:15:04.790Z WARN 1 --- [Layers] [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openAIClient': Injection of autowired dependencies failed
a year ago
That's just an error with your application
a year ago
Are you sure there isn't more to that
a year ago
Do you need to provide an open ai key perhaps
a year ago
Looks like warning only, it would help if you share the actual error that causes to crash.
a year ago
That error is going to crash the whole thing
a year ago
Not sure why it says warning
a year ago
Agree
a year ago
yerp
a year ago
click the service, the deploymeny, and then logs?
a year ago
What port did you give the domain
a year ago
Set PORT=8080, redeploy your service, and delete the public domain and re-add it
a year ago
= or colon
a year ago
Does your public domain in the server settings show it's pointing to it
a year ago
And does Springboot show it bound to 8080 in deployment logs
the last thing that I see in logs is:
2025-06-25T03:21:54.723Z INFO 1 --- [Layers] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
2025-06-25T03:21:54.732Z INFO 1 --- [Layers] [ main] c.e.ai.chateldadt.ChatEldadTApplication : Started ChatEldadTApplication in 6.564 seconds (process running for 7.117)```
a year ago
Screenshot your public domain part of settings
a year ago
great!
a year ago
from Java...?
a year ago
you'll need to use the Railway CLI
a year ago
then use railway connect
a year ago
You can also use a custom tool like pgadmin
Note that you will need to connect to the DB through it's public URL
Status changed to Solved chandrika • 11 months ago





