Wildfly as Systemd Service

Wildfly as Systemd Service

I wanna make wildfly-domain as a systemd service in centos7 in works by root user but when i start it as wilfly user after a while it shows error:

java.lang.OutOfMemoryError: unable to create new native threadESC

and stop . even stop service doesn't work .

I tried to change heap-memo and ... but the user is a problem! How can I solve this?

service file is ib wildfly8/bin/init.d/wildfly-init-redhat.sh I tried "ulimit -n " at the top of service script but nothing changed! I have 256Gb Ram and 64core CPU but ....

7

1 Answer

Right place for unit is:

/etc/systemd/system/wildfly.service

This minimal is ok

[Unit]
Description=WildFly application server
Wants=network-online.target 
After=network-online.target

[Service]
Type=simple
User=web
Group=web
ExecStart=/opt/
Restart=always
RestartSec=20

[Install]
WantedBy=multi-user.target

You should edit only ExecStart field to match your path.

Create user web with

useradd web

Also exec by root:

chown -R web:web /opt/

When

systemctl start wildfly
systemctl enable wildfly

If you get OOMs, inspect your limits

[Service] section of systemd unit, like

LimitFSIZE=infinity
LimitCPU=infinity
LimitAS=infinity
LimitNOFILE=64000
LimitNPROC=64000

or /etc/security/limits.d/ /etc/security/limits.conf

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.