0

I have a REST API and I need to implement a ContainerRequestFilter, but it is not invoked.

After some changes, when I publish my application a warning appears in glassfish log saying:

The class com.seguranca.FiltroAutenticacao is not assignable to the class com.sun.jersey.spi.container.ContainerRequestFilter. This class is ignored.

Can anybody help me?

I am using glassfish 4, java and ee 7, and jersey 1.17.1

  • [That link](https://stackoverflow.com/a/28067653/2587435) I gave you in your previous post showed you how to use the Jersey 1.x filter. Maybe you missed it. It was mixed in with a 2.x example. The 1.x example is the second one. – Paul Samsotha Jul 11 '18 at 07:13
  • I'm sorry Paul, it was my mistake. – Gustavo de Freitas Jul 11 '18 at 11:39
  • I discovered the problem, following his suggestion of trying to publish the application with Jersey 2 on glassfish, I discovered incompatibility in glassfish version. Glassfish 4.0 does not support jersey 2, version 4.1.2 yes. I migrated the server and solved the problem. Thanks a lot!!! – Gustavo de Freitas Jul 11 '18 at 11:44
  • That doesn't make sense. Java EE 7 uses JAX-RS 2.0, which is Jersey 2.x. Different versions of Glassfish 4 use different versions of Jersey 2.x Probably you were trying to add jars to your project that are incompatible with the ones that Glassfish already has. Remember Glassfish already _has_ all the Jersey jars. So when your project tries to add more, the versions can be incompatible. What your supposed to do, is not ship the project jars with the application, and just use the server ones. Wit Maven, we use a `provided` `scope` to handle this situation. – Paul Samsotha Jul 11 '18 at 16:38

0 Answers0