0

I have a simple Rest application that is deployed to an IBM MobileFirst 7.1 Liberty Server. (I don't know the implementation of the JAX-RS but it is included with the liberty server runtime I believe)

I have to share some of my common code with other teams, so I moved some of the code into a separate maven project to be jared and added as a server library. This all works great until I had to add some @Provider annotated classes into the separate maven project. Specifically, some ExceptionMapper implementations marked with the @Provider annotation.

I have tried setting the class directly within the Application classes getClasses() method. This seemed to work, but I get a warning message saying that my exception mapper implementations need to be marked with the @Provider or @Path annotations (which they are).

Is there some sort of trick to get JAX-RS to recognize these resource classes from a Jar file?

Nick H
  • 8,897
  • 9
  • 41
  • 64

1 Answers1

1

In order to have the @Provider recognized, please try to put the JAR inside the adapter /lib folder instead of the server/lib folder.

Issahar Weiss
  • 203
  • 1
  • 10
  • Is there anyway to do it within the server/lib directory? Right now I have 10+ copies of the same exact jar in each adapter because they all use it. I also have it in the server/lib directory because I have custom authenticators that also use some classes from it. Getting difficult to manage – Nick H Aug 02 '16 at 17:09
  • I'm sorry, but no. The adapter is inside a sandbox, that's why you can deploy it and undeploy it easily. The scan of classes for annotation is done only inside the adapter class loader. The server/lib is a parent class loader of the adapter, and it couldn't be found there. – Issahar Weiss Aug 04 '16 at 08:03
  • That makes sense, Thank you for the further explanation. – Nick H Aug 04 '16 at 13:11