Steven Huypens created KARAF-7129:
-------------------------------------
Summary: Missing @RequireService for
org.apache.karaf.shell.ssh.Activator
Key: KARAF-7129
URL: https://issues.apache.org/jira/browse/KARAF-7129
Project: Karaf
Issue Type: Bug
Components: karaf
Affects Versions: 4.2.11
Reporter: Steven Huypens
Fix For: 4.2.12, 4.3.2
When starting our custom Karaf distribution, we're always seeing this
stacktrace in the logs. Everything seems to be working, I'm not sure how to
explain that, but still seems a little bug to me.
{code:java}
2021-04-30 12:13:56,385 -
[o.a.k.f.i.s.FeaturesServiceImpl][features-3-thread-1] INFO -
org.apache.sshd.sftp/2.5.1 2021-04-30 12:13:56,385 -
[o.a.k.f.i.s.FeaturesServiceImpl][features-3-thread-1] INFO -
org.apache.sshd.sftp/2.5.1 2021-04-30 12:13:56,387 -
[o.a.k.f.i.s.FeaturesServiceImpl][features-3-thread-1] INFO -
org.apache.karaf.shell.ssh/4.2.11 2021-04-30 12:13:56,399 -
[o.a.k.s.s.Activator ][activator-1-thread-1] WARN - Error starting activator
java.lang.IllegalStateException: Service not tracked for class interface
org.osgi.service.cm.ConfigurationAdmin at
org.apache.karaf.util.tracker.BaseActivator.getTrackedService(BaseActivator.java:369)
at
org.apache.karaf.util.tracker.BaseActivator.ensureStartupConfiguration(BaseActivator.java:154)
at org.apache.karaf.shell.ssh.Activator.doStart(Activator.java:96) at
org.apache.karaf.util.tracker.BaseActivator.run(BaseActivator.java:312) at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at
java.util.concurrent.FutureTask.run(FutureTask.java:266) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)2021-04-30 12:13:56,426 -
[o.a.k.s.i.a.o.CommandExtension][features-3-thread-1] INFO - Command
registration delayed for bundle org.apache.karaf.shell.ssh/4.2.11. Missing
service: [org.apache.sshd.server.SshServer] {code}
I had a look at the org.apache.karaf.shell.ssh.Activator and I feel like it's
missing a
@RequireService(ConfigurationAdmin.class) because that service is required by
the method
ensureStartupConfiguration() and the only other Activator using that method
does have the @RequireService(ConfigurationAdmin.class) .
Also, it might be better to add a null-check for this service in the
doStart()-method
{code:java}
ConfigurationAdmin configurationAdmin =
getTrackedService(ConfigurationAdmin.class);
if (configurationAdmin == null ) {
return;
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)