If an arbitrary CDI extension wraps a InjectionTarget during @Observes ProcessInjectionTarget<T> event, it will result in a ClassCastException in TomEE JAX-RS service startup.
With the aforementioned wrapping, any existing CDI managed JAX-RS endpoint that is processed by the CDI extension will have its InjectionTarget changed to the wrapper type: InjectionTargetWrapper.
This results in a ClassCastException during TomEE JAX-RS service startup, more precisely in org.apache.openejb.server.cxf.rs.CdiResourceProvider#findContexts(final Class<?> clazz).
This method will be called by the CXF application deployment while processing the JAX-RS endpoint bean and will cast the bean InjectionTarget to InjectionTargetImpl. Since the JAX-RS bean InjectionTarget has been changed to the wrapper - of type InjectionTargetWrapper - this results in a ClassCastException.
While the just mentioned extension is more complex than the initial example described in this issue, this problem will occur for every CDI extension that happens to process and change a JAX-RS endpoint InjectionTarget to another type, ex: a wrapper (if the wrapper itself does not inherit from OpenWebBeans InjectionTargetImpl of course, but this is not likely to happen for the obvious reasons).
I will attach a very simple ready-to-build project that demonstrates the issue. The project has a JAX-RS endpoint and includes the aforementioned CDI extension. The problem will immediately occur if the application is deployed in TomEE JAX-RS v1.7.3