Problem: by injection of ResourceInfo in resource class or in provider in OSGi environment CXF throws following exception:
Reason of the problem: there is no dedicated thread local context for ResourceInfo and CXF instantiates it using java reflection proxy in InjectionUtils:
The problem is that classloader in first argument is taken from type class, but proxy have to implement two interfaces: type and ThreadLocalProxy (second argument). It works fine in standalone environment, but in OSGi classloader of ResourceInfo bundle doesn't know nothing about ThreadLocalProxy interface in CXF JAX-RS bundle. Of course, the ThreadLocalProxy cannot be found.
Solution: possible solution is use the classloader of current class (InjectionUtils) instead of type class. As far as InjectionUtils classloader knows type class as well it should work in standalone as well as in OSGi environments.