0

I am using the answer here to implement authentication on a jax-rs REST endpoint running on WebSphere Application Server.

Eclipse is telling me that it can't find @NameBinding anywhere in the classpath.

pom:

    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>jsr311-api</artifactId>
        <version>1.0</version>
    </dependency>

As I understand it, I can't use a different version of JSR because WAS 8.5.5 only supports JAX-RS 1.1 (see WAS API Docs and the JSR Specification it links to

I now understand that NameBinding is not available in the 3.11 spec; so what's my alternative?

simonalexander2005
  • 4,338
  • 4
  • 48
  • 92

1 Answers1

1

You can bring your own JAX-RS 2.0 API and implementation and configure your application to use that. Two major steps:

  1. Disable the JAX-RS engine in WAS: https://www.ibm.com/docs/en/was/8.5.5?topic=djrwa-disabling-jax-rs-runtime-environment (the most important part there is setting the JVM custom property com.ibm.websphere.jaxrs.server.DisableIBMJAXRSEngine to true).
  2. Put your desired API and implementation jars in a shared library, select the option to use an isolated class loader for the library (so it loads its own classes in preference to the server's), and associate that shared library with the server.

With that configuration, the server will avoid starting its own JAX-RS component or processing JAX-RS annotations, and the application will get its JAX-RS API and implementation classes from the shared library.

Jarid
  • 1,878
  • 7
  • 11