R
Railway14mo ago
Kurdiez

Java is not found

It seems Java is not available out of the box. How do I configure Railway service to have Java so I can run a Java process?
No description
60 Replies
Percy
Percy14mo ago
Project ID: 1f1e865e-cb58-46db-b427-0b47e5dad0c1
Kurdiez
KurdiezOP14mo ago
Product ID: 1f1e865e-cb58-46db-b427-0b47e5dad0c1
Brody
Brody14mo ago
what provider is currently being detected?
Kurdiez
KurdiezOP14mo ago
I don't need to build. I just need to run already built Java server How do I check this?
Kurdiez
KurdiezOP14mo ago
I don't know how to use that bookmarklets It's confusing
Brody
Brody14mo ago
please follow the instructions
Kurdiez
KurdiezOP14mo ago
I did, but when I click on bookmarklet from the bookmarks bar, it just goes to the page you sent me And that makes sense because it's in the bookmarks bar...
Brody
Brody14mo ago
you did not follow the instructions
Kurdiez
KurdiezOP14mo ago
I did. I opened the desired service and then clicked on the bookmarklet in the bookmarks bar It looks like your instructions are not detailed enough... What is it that you would like to see? The build log?
Brody
Brody14mo ago
the build logs produced from that bookmarklet
Kurdiez
KurdiezOP14mo ago
This is from Railway Build logs
Brody
Brody14mo ago
please use the bookmarklet
Kurdiez
KurdiezOP14mo ago
Is there a YouTube video or something that explains how to use bookmarklet?
Brody
Brody14mo ago
there is an arrow and 3 steps on that page please follow the instructions
Kurdiez
KurdiezOP14mo ago
Yes... I followed those 3 steps.
Brody
Brody14mo ago
okay send the build logs please
Kurdiez
KurdiezOP14mo ago
I got the log from bookmarklet.. that was confusing to me sorry
Brody
Brody14mo ago
that is the deployment logs
Brody
Brody14mo ago
do you have a nixpacks.toml file?
Kurdiez
KurdiezOP14mo ago
no
Brody
Brody14mo ago
any kind of config file relating to railway?
Kurdiez
KurdiezOP14mo ago
no nothing. First time using Railway
Brody
Brody14mo ago
do you have any service variables set?
Kurdiez
KurdiezOP14mo ago
No
Brody
Brody14mo ago
do you have a start command set in the service settings?
Kurdiez
KurdiezOP14mo ago
yes bin/run.sh root/config.yaml the run.sh calls java to run the server
Brody
Brody14mo ago
what languages do you need made available, other than java
Kurdiez
KurdiezOP14mo ago
Only Java
Brody
Brody14mo ago
what version
Kurdiez
KurdiezOP14mo ago
17
Brody
Brody14mo ago
do you need anything else in the container?
Kurdiez
KurdiezOP14mo ago
no Just need Java that's all
Brody
Brody14mo ago
would that just be jre?
Kurdiez
KurdiezOP14mo ago
Yes just JRE is ok
Brody
Brody14mo ago
untested, but add this to a railway.json file in your project
{
"$schema": "https://schema.up.railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"nixpacksPlan": {
"providers": [],
"phases": {
"setup": {
"nixPkgs": ["jdk17"]
}
}
}
},
"deploy": {
"restartPolicyMaxRetries": 3,
"startCommand": "bin/run.sh /app/apps/ib-client-portal/root/config.yaml"
}
}
{
"$schema": "https://schema.up.railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"nixpacksPlan": {
"providers": [],
"phases": {
"setup": {
"nixPkgs": ["jdk17"]
}
}
}
},
"deploy": {
"restartPolicyMaxRetries": 3,
"startCommand": "bin/run.sh /app/apps/ib-client-portal/root/config.yaml"
}
}
Kurdiez
KurdiezOP14mo ago
Root folder of my project?
Brody
Brody14mo ago
if thats what you have railway deploying from, yes
Kurdiez
KurdiezOP14mo ago
It's a monorepo that will have many things deployed from. This Java server is one of them. How can I make it so that only one service is using this railway.json configuration. All the other services don't need Java at all
Brody
Brody14mo ago
are they in subfolders?
Kurdiez
KurdiezOP14mo ago
Yeah
Brody
Brody14mo ago
have you set a root directory for this railway service?
Kurdiez
KurdiezOP14mo ago
yes that root directory is the subfolder where this Java server is in
Brody
Brody14mo ago
what did you set it to?
Kurdiez
KurdiezOP14mo ago
/apps/ib-client-portal This is the root folder that's set in the settings of the service
Brody
Brody14mo ago
then that is where you should put that railway.json file
Kurdiez
KurdiezOP14mo ago
ok thank you. testing it out now
╔════════════ Nixpacks v1.17.0 ════════════╗

║ setup │ jdk17 ║

║──────────────────────────────────────────║

║ start │ bin/run.sh root/config.yaml ║

╚══════════════════════════════════════════╝
╔════════════ Nixpacks v1.17.0 ════════════╗

║ setup │ jdk17 ║

║──────────────────────────────────────────║

║ start │ bin/run.sh root/config.yaml ║

╚══════════════════════════════════════════╝
This showed up in build log so far. So I guess that's good.
Brody
Brody14mo ago
indeed
Kurdiez
KurdiezOP14mo ago
Well build was successful and deployment shows this log
running

runtime path : root:dist/ibgroup.web.core.iblink.router.clientportal.gw.jar:build/lib/runtime/*

config file : root/config.yaml

Failed to load configuration file: ../root/config.yaml

java.io.IOException: Stream closed

running

runtime path : root:dist/ibgroup.web.core.iblink.router.clientportal.gw.jar:build/lib/runtime/*

config file : root/config.yaml

Failed to load configuration file: ../root/config.yaml

java.io.IOException: Stream closed
running

runtime path : root:dist/ibgroup.web.core.iblink.router.clientportal.gw.jar:build/lib/runtime/*

config file : root/config.yaml

Failed to load configuration file: ../root/config.yaml

java.io.IOException: Stream closed

running

runtime path : root:dist/ibgroup.web.core.iblink.router.clientportal.gw.jar:build/lib/runtime/*

config file : root/config.yaml

Failed to load configuration file: ../root/config.yaml

java.io.IOException: Stream closed
I think this is an issue I should solve myself. My start command is bin/run.sh root/config.yaml where I pass the config.yaml but it can't find that config file...
Brody
Brody14mo ago
where is the config file relative to the root of your entire project?
Kurdiez
KurdiezOP14mo ago
- monorepo-root/apps/ib-client-portal/railway.json - monorepo-root/apps/ib-client-portal/bin/run.sh - monorepo-root/apps/ib-client-portal/root/config.yaml
Brody
Brody14mo ago
should you have written monorepo-root? is that an actual folder within your projects root folder?
Kurdiez
KurdiezOP14mo ago
no, i'm just letting you know the relative paths from my monorepo-root That is the root folder in Github repo basically
Brody
Brody14mo ago
okay so you dont actually have a monorepo-root in your root, that is the name of the root folder on your computer?
Kurdiez
KurdiezOP14mo ago
yes that's correct
Brody
Brody14mo ago
ive updated this, please update your copy
Kurdiez
KurdiezOP14mo ago
Thanks. trying it out
running

runtime path : /app/apps/ib-client-portal/root:dist/ibgroup.web.core.iblink.router.clientportal.gw.jar:build/lib/runtime/*

config file : /app/apps/ib-client-portal/root/config.yaml

Failed to load configuration file: ..//app/apps/ib-client-portal/root/config.yaml

java.io.IOException: Stream closed
running

runtime path : /app/apps/ib-client-portal/root:dist/ibgroup.web.core.iblink.router.clientportal.gw.jar:build/lib/runtime/*

config file : /app/apps/ib-client-portal/root/config.yaml

Failed to load configuration file: ..//app/apps/ib-client-portal/root/config.yaml

java.io.IOException: Stream closed
Brody
Brody14mo ago
im starting to think a dockerfile would be more suitable for this
Want results from more Discord servers?
Add your server