Lucee restart deletes lucee-server.xml

Restarting Lucee 5.1.0.34 on Ubuntu deletes the file /opt/lucee/tomcat/lucee-server/context/lucee-server.xml and some others within that folder, meaning that the datasource and mappings are lost.
Restarting Tomcat then restores the files with a default version of lucee-server.xml, meaning I have to set the password to access the server admin page and then re-enter the datasource and mappings.
Any idea what might be going on, or what clues I should check for in log files?

you might be able to update the lucee.jar as noted in this bug about the same issue
https://luceeserver.atlassian.net/browse/LDEV-920

But upgrading to a newer release is probably a better solution, 5.1.0.34 is about 3 years old

Thanks, really appreciate your help - updated to newest release and same problem. Also, if I restart Lucee, the /opt/lucee/tomcat/lucee-server/context/cfclasses folder is empty until I restart Tomcat, which deletes and recreates the folder. Is that normal?

was this an older installation? did you do a fresh install?

as @micstriit noted in that issue, the problem may be with the lucee loader

It was installed as 5.1.0.34 when I built the server.
Restarting from the web interface does not cause any problem.
After a Lucee restart there is a long series of entries in the felix.log like this:

DEBUG [Thu May 09 16:27:46 BST 2019]:
 not found by com.mysql.cj [92]
DEBUG [Thu May 09 16:27:46 BST 2019]:
com/mysql/cj/LocalizedErrorMessages_en.properties not found by com.mysql.cj [92]
DEBUG [Thu May 09 16:27:46 BST 2019]:
com/mysql/cj/LocalizedErrorMessages_en_GB.properties not found by com.mysql.cj [92]
DEBUG [Thu May 09 16:27:51 BST 2019]:
 not found by com.mysql.cj [92]
DEBUG [Thu May 09 16:28:02 BST 2019]:
META-INF/services/javax.xml.parsers.SAXParserFactory not found by lucee.core [46]

suggesting that bundles are missing.
catalina.out includes sections like these:

09-May-2019 16:29:53.395 SEVERE [main] org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated with ProtocolHandler ["http-nio-8888"]
 java.net.BindException: Address already in use
	at sun.nio.ch.Net.bind0(Native Method)
	at sun.nio.ch.Net.bind(Net.java:433)
	at sun.nio.ch.Net.bind(Net.java:425)
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
	at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:228)
	at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:866)
	at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:213)
	at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:575)
	at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:65)
	at org.apache.catalina.connector.Connector.initInternal(Connector.java:944)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	at org.apache.catalina.core.StandardService.initInternal(StandardService.java:549)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:873)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:606)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:629)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)

09-May-2019 16:29:53.397 SEVERE [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[HTTP/1.1-8888]]
 org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-8888]]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112)
	at org.apache.catalina.core.StandardService.initInternal(StandardService.java:549)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:873)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:606)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:629)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
	at org.apache.catalina.connector.Connector.initInternal(Connector.java:946)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	... 12 more
Caused by: java.net.BindException: Address already in use
	at sun.nio.ch.Net.bind0(Native Method)
	at sun.nio.ch.Net.bind(Net.java:433)
	at sun.nio.ch.Net.bind(Net.java:425)
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
	at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:228)
	at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:866)
	at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:213)
	at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:575)
	at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:65)
	at org.apache.catalina.connector.Connector.initInternal(Connector.java:944)
	... 13 more

09-May-2019 16:29:53.399 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
09-May-2019 16:29:53.401 SEVERE [main] org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated with ProtocolHandler ["ajp-nio-8009"]
 java.net.BindException: Address already in use
	at sun.nio.ch.Net.bind0(Native Method)
	at sun.nio.ch.Net.bind(Net.java:433)
	at sun.nio.ch.Net.bind(Net.java:425)
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
	at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:228)
	at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:866)
	at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:213)
	at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:575)
	at org.apache.catalina.connector.Connector.initInternal(Connector.java:944)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	at org.apache.catalina.core.StandardService.initInternal(StandardService.java:549)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:873)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:606)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:629)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)

09-May-2019 16:29:53.401 SEVERE [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[AJP/1.3-8009]]
 org.apache.catalina.LifecycleException: Failed to initialize component [Connector[AJP/1.3-8009]]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112)
	at org.apache.catalina.core.StandardService.initInternal(StandardService.java:549)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:873)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:606)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:629)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
	at org.apache.catalina.connector.Connector.initInternal(Connector.java:946)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	... 12 more
Caused by: java.net.BindException: Address already in use
	at sun.nio.ch.Net.bind0(Native Method)
	at sun.nio.ch.Net.bind(Net.java:433)
	at sun.nio.ch.Net.bind(Net.java:425)
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
	at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:228)
	at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:866)
	at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:213)
	at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:575)
	at org.apache.catalina.connector.Connector.initInternal(Connector.java:944)
	... 13 more

suggesting Tomcat is already running (?), and

ERROR: Error creating bundle cache.
java.lang.Exception: Unable to create bundle cache lock file: java.io.FileNotFoundException: /opt/lucee/tomcat/lucee-server/felix-cache/cache.lock (Permission denied)
	at org.apache.felix.framework.cache.BundleCache.<init>(BundleCache.java:172)
	at org.apache.felix.framework.Felix.init(Felix.java:699)
	at org.apache.felix.framework.Felix.init(Felix.java:637)
	at org.apache.felix.framework.Felix.start(Felix.java:1080)
	at lucee.loader.engine.CFMLEngineFactory.getFelix(CFMLEngineFactory.java:487)
	at lucee.loader.osgi.BundleLoader.loadBundles(BundleLoader.java:104)
	at lucee.loader.engine.CFMLEngineFactory.initEngine(CFMLEngineFactory.java:358)
	at lucee.loader.engine.CFMLEngineFactory.initEngineIfNecessary(CFMLEngineFactory.java:261)
	at lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:167)
	at lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:201)
	at lucee.loader.servlet.CFMLServlet.init(CFMLServlet.java:42)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4913)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5223)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1403)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
java.lang.NullPointerException
	at lucee.loader.osgi.BundleUtil.installBundle(BundleUtil.java:76)
	at lucee.loader.osgi.BundleUtil.addBundle(BundleUtil.java:68)
	at lucee.loader.osgi.BundleUtil.addBundle(BundleUtil.java:47)
	at lucee.loader.osgi.BundleLoader.loadBundles(BundleLoader.java:141)
	at lucee.loader.engine.CFMLEngineFactory.initEngine(CFMLEngineFactory.java:358)
	at lucee.loader.engine.CFMLEngineFactory.initEngineIfNecessary(CFMLEngineFactory.java:261)
	at lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:167)
	at lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:201)
	at lucee.loader.servlet.CFMLServlet.init(CFMLServlet.java:42)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4913)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5223)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1403)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
09-May-2019 16:29:54.273 SEVERE [wwwdev.gwc.org.uk-startStop-1] org.apache.catalina.core.StandardContext.loadOnStartup Servlet [CFMLServlet] in web application [] threw load() exception
 java.lang.NullPointerException
	at lucee.loader.osgi.BundleUtil.installBundle(BundleUtil.java:76)
	at lucee.loader.osgi.BundleUtil.addBundle(BundleUtil.java:68)
	at lucee.loader.osgi.BundleUtil.addBundle(BundleUtil.java:47)
	at lucee.loader.osgi.BundleLoader.loadBundles(BundleLoader.java:141)
	at lucee.loader.engine.CFMLEngineFactory.initEngine(CFMLEngineFactory.java:358)
	at lucee.loader.engine.CFMLEngineFactory.initEngineIfNecessary(CFMLEngineFactory.java:261)
	at lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:167)
	at lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:201)
	at lucee.loader.servlet.CFMLServlet.init(CFMLServlet.java:42)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4913)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5223)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1403)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

suggesting a permissions problem; I can set everything in /opt/lucee/tomcat/lucee-server to be owned by lucee but a restart reverts ownership of most folders to root (I use sudo to restart Lucee and Tomcat).

After a Tomcat restart, the felix.log shows the same bundles not found. catalina.out shows no errors but does show many warnings e.g.

09-May-2019 16:39:42.291 WARNING [wwwdev.gwc.org.uk-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [Thread-629] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Thread.sleep(Native Method)
 lucee.runtime.schedule.ScheduledTaskThread.sleepEL(ScheduledTaskThread.java:168)
 lucee.runtime.schedule.ScheduledTaskThread._run(ScheduledTaskThread.java:121)
 lucee.runtime.schedule.ScheduledTaskThread.run(ScheduledTaskThread.java:78)
09-May-2019 16:39:42.292 WARNING [wwwdev.gwc.org.uk-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [Thread-630] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Thread.sleep(Native Method)
 lucee.runtime.schedule.ScheduledTaskThread.sleepEL(ScheduledTaskThread.java:168)
 lucee.runtime.schedule.ScheduledTaskThread._run(ScheduledTaskThread.java:121)
 lucee.runtime.schedule.ScheduledTaskThread.run(ScheduledTaskThread.java:78)
09-May-2019 16:39:42.293 WARNING [wwwdev.gwc.org.uk-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [Thread-631] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Thread.sleep(Native Method)
 lucee.runtime.schedule.ScheduledTaskThread.sleepEL(ScheduledTaskThread.java:168)
 lucee.runtime.schedule.ScheduledTaskThread._run(ScheduledTaskThread.java:121)
 lucee.runtime.schedule.ScheduledTaskThread.run(ScheduledTaskThread.java:78)

Anything jumping out???

the scheduledTaskThread cruft can be ignored, there’s an open task about that one

CLONE - scheduled task errors when shutting down tomcat
https://luceeserver.atlassian.net/browse/LDEV-2222

Did you do a custom install or use the linux installer?

Right, thanks…
I used the linux installer.

@Stephen_Gray Did directly upgrading the Lucee jar file work for you?

If you haven’t tried that yet, all that is needed is to replace the jar file located in /opt/luceel/lib/ by default with the newer Lucee jar. Please let us know how this turns out for you.

Thanks. I directly updated the Lucee jar file but there was no difference: rebooted the server, got a java.lang.nullPointerException on every frontend website view.
Restarting Tomcat gets the web/server admins back, but with a default copy of lucee-server.xml; overwriting this with a saved backup and performing a restart from the admin (not the command line - this wipes lucee-server.xml again) restores datasources and mappings.
Next step is to uninstall/reinstall Lucee, unless any clues are leaping out of the above…

Unfortunately no. I do recall seeing this before, but I think it was with OpenBD and it’s been so long that I don’t recall what the solution was. Sorry I can’t be more helpful.

I’ve found this recently while making manual changes to the file, and in my case some incorrect syntax I used in datasources resulted in the file being replaced. Perhaps it’s worth backing up the file and reimplementing your config changes through the web interface, might help isolate what is tripping it up?

It looks like it’s the user running the startup process that is the issue.
I changed the user running Lucee to ‘lucee’ - still no good.
I added the ‘lucee’ user to the root group and everything is fixed: I can reboot the server and Lucee/Tomcat comes back up as it should.
There is no root access to the server; any issue with having the Lucee user as part of the ‘root’ group?

That’s interesting. Do you have a root user (guessing you do since you have a root group) and by “no root access” do you mean that root just doesn’t have a shell?

Yes, there is a root user but no shell.

I can sudo /opt/lucee/lucee_ctl restart then sudo shutdown -r now and everything comes back up as it should.

But if I restart Tomcat – sudo ./shutdown.sh then sudo ./startup.sh in /opt/lucee/tomcat/bin – then restart the server, the frontend comes back with the 500 error and the lucee-server.xml file is restored to the default. I can also only ./shutdown.sh and then reboot to get the error.

So the Tomcat restart process seems to change permissions when I run it (sudo or not), but it doesn’t when it runs as part of the server restart. Lucee consequently seems to be forced to recreate the lucee-server.xml file. Any advice on how to narrow down which permissions/ownerships are responsible?

sudo’ing the startup.sh will cause that script to be run as the root user, so I’m guessing that this has to do with your root user not having a shell. If you’d be willing to test giving the root user a shell (if you haven’t done it before, it’s just a matter of editing the /etc/passwd file) and then seeing if it works? I’m not sure what you have root’s shell pointed to now, but you may also be able to point root’s shell to another “non-shell” and get better results. For example, if you have it pointed to /bin/false now, you may get better results with /usr/sbin/nologin or visa/versa. It’s an interesting problem and worth testing.

You could also run your Lucee stack as a whole as a non-root user. On a Linux install there are some tools included that can be used to help you do change the user. Specifically, /opt/lucee/sys/change_user.sh is a script that the installer uses to set the user permissions during the install. You can use this script the same way the installer does, and change the permissions on the /opt/lucee directory and build a new lucee_ctl script. The new script will be dropped in /opt/lucee/lucee_ctl, where you can test it. If all works well, you can move that script to the /etc/init.d/ directory for production. I really need to write a systemD compatible script… just haven’t yet.

Thanks again for the advice. I am running the Lucee stack as user lucee: both control scripts have TOMCAT_OWNER set to ‘lucee’. I’m keen to keep it that way and not use root.

Running sudo ./shutdown.sh & sudo ./startup.sh results in the felix-cache directory being chowned by root:root with no write permission for the group so when Lucee tries to restart it can’t access the felix-cache directory. If I run top after a Tomcat restart using sudo it shows a process /opt/lucee//jre/bin/java owned by lucee and another very similar one owned by root.

When I restore ownership to lucee:lucee I can restart the server and Lucee restarts OK; Lucee seems to change the permissions but that’s okay as it owns the directory.
The questions are: why does Tomcat assign ownership of felix-cache to root:root, and should I simply avoid restarting Tomcat using sudo?

Hi Stephen,

By executing the startup.sh and shutdown.sh scripts you’re starting and stopping Tomcat directly as root. Instead, please try using the “lucee_ctl” script, for example:

sudo systemctl restart lucee_ctl
sudo service lucee_ctl restart
sudo /etc/init.d/lucee_ctl restart
sudo /opt/lucee/lucee_ctl restart

All of the above should work if you used the installer. The last two call the lucee_ctl script directly. This script assigns initial user permissions and starts the lucee process as the lucee user you configured during install, or via the “change_user.sh” script. Again, I need to re-write this script to provide native support to SystemD some time in the near future, but now SystemD is still SysV compatible, so it works.

In addition to giving you system-level control of your Lucee server (ie: starting at boot time), this script also is designed to execute the Tomcat/Lucee start and stop sequences as the specific user you assigned to Lucee. So your problem should go away.

Running as the “lucee” user will also give you some complications when you set up new sites. For example, the WEB-INF directory that Tomcat creates (and Lucee uses) as part of the context will need to be created and assigned permissions. The Lucee user will also need read access to your site’s directories. If you run into any problems with those things, let us know. :wink:

That’s really clear - thanks again for taking the time!

1 Like