kumuluz / kumuluzee

Lightweight open-source framework for developing microservices using standard Java EE technologies and migrating Java EE to cloud-native architecture.
https://ee.kumuluz.com
MIT License
291 stars 71 forks source link

Unable to load ContainerRequestFilter from different archive #44

Closed ondrejtomcik closed 7 years ago

ondrejtomcik commented 7 years ago

Hello. I started to use KumuluzEE and I need to use couple of ContainerRequestFilters in my jax-rs application. Those filters which are in project are loaded and invoked. I have one jar archive for authorization which contains another ContainerRequestFilter which is not loaded at all.

I tried to create web.xml with jersey.config.server.provider.packages but without any success. How to load this ContainerRequestFilter from different archive please?

Thakns

osbeorn commented 7 years ago

Which library are you using for authorization? It would be very helpful if you could attach a gist containing the filter configuration.

osbeorn commented 7 years ago

I had no problems registering a ContainerRequestFilter from a different archive. I tried both approaches: by configuring the web.xml deployment descriptor and by adding the filters in the code.

Please refer this gist to see how to do it.

Let us know if this solves your issue.

TFaga commented 7 years ago

I've tried this by myself as well and it seems to work as expected.

Please keep in mind that annotation scanning for JAX-RS resources (like filters or interceptors) only works for the main module. If you have any of those in a different module, you must add them manually. Either through web.xml or through the methods within the Application or ResourceConfig class.

Again please refer to the example in @osbeorn 's gist. It should work.

I'll be closing this, if you have a more specific example that is not working, please do share it either here and I'll reopen or post it in a new issue.