Reinstate "Avoid CNFE by setting classloader resource of service .class."

This reverts commit 8794c4776a1d792ee7e6227dd0d67a28abae96fe.