0

I keep getting this error when running my JUnit tests. It only occurs when I try to import Jersey custom ExceptionMappers from a .jar file to my .war file.

I know that the mappers work correctly when they are in the .war file but I have two separate modules that need them and would prefer not to duplicate the mappers to have one in each module.

[RxCachedThreadScheduler-1] ERROR
c.s.j.s.container.ContainerResponse - The exception contained within
MappableContainerException could not be mapped to a response, re
throwing to the HTTP container
search.internal.datapower.InvalidUserInfoException:
WRRC003: The required X-UserInfo header was missing from the
request.

Does anyone know how to import an ExceptionMapper from a .jar file?

alats
  • 1
  • 1

1 Answers1

0

Yes, you can do this.

However, it looks like you haven't registered an exception mapper with Jersey for search.internal.datapower.InvalidUserInfoException, or you need to catch this exception and handle it in your resource method.

You can accomplish this by creating a Jersey @Provider class that implements ExceptionMapper<InvalidUserInfoException>.

See example 7.6 here for more details: https://jersey.java.net/documentation/latest/representations.html#d0e6665

ck1
  • 5,243
  • 1
  • 21
  • 25