I just spent a while dealing with this, so wanted to share what I did to resolve the issue in case it will be useful for anyone else.
Scenario: I updated the DB Connect app, after which Java 8 was no longer supported. After this when accessing the DB Connect app I got the following errors:
I installed JDK 17.0.7, then went into DB Connect - Configuration - Settings where I updated the value of JRE Installation Path (JAVA_HOME).
When saving it, I got the error Failed to restart task server. Restarting Splunk did not help.
After a couple of hours of troubleshooting, and it not really behaving any differently, I wondered what if it is trying to use the old JRE still? So I renamed the old JRE directory from /usr/lib/jre1.8.0_151 to /usr/lib/jre1.8.0_151_z to guarantee it could not find it and then splunkd.log then had a helpful entry after restarting:
ERROR ModularInputs [1677 MainThread] - <stderr> Introspecting scheme=server: /opt/splunk/etc/apps/splunk_app_db_connect/linux_x86_64/bin/server.sh: line 33: /usr/lib/jre1.8.0_151/bin/java: No such file or directory host = splunk-ifw-p02.austin.utexas.edu source = /opt/splunk/var/log/splunk/splunkd.log sourcetype = splunkd
... so it was still trying to use the older JRE (in fact, that was the original JRE I installed for DB Connect, I had since then already installed a newer JRE a couple of years ago that I *thought* it was using)
To find out where this old JRE was being specified, I ran
grep -rnw '/opt/splunk/etc/apps/splunk_app_db_connect' -e 'jre1.8.0_151'
Which returned one file:
After updating the content of customized.java.path and restarting Splunk, DB Connect was working again.
Searching for files containing jdk-17.0.7 returned 7 files in total..... it looks like the Settings page in DB Connect is updating all of them except for the one I had to edit.
I suppose adding $JAVA_HOME would have worked as well, I was trying to get it to work without doing that since it had worked fine in the past without it set: this way there is one less place to have to go (outside of Splunk itself) to update it in the future when the JDK has to be updated again, and also not knowing if any (non-Splunk) updates or other processes in the future may change it in /etc/profile
Here's what happened to me. I had installed the DB Connect app before installing the Oracle JDK version 1.8. After installing the right JDK and correcting your Java path (and getting that error), you need to restart Splunk one more time. Seems that Splunk will only do the initial Task Server startup on Splunk startup.
After restarting Splunk, I had a running Task Server and everything was okay.