I have a class (stored in server/java) that returns a Response type object and I want to use it in adapters.
public class CorsResponse {
public static Response build() {
return Response
.ok()
.header("Access-Control-Allow-Origin", "*")
.header("Access-Control-Allow-Methods", "GET, POST")
.header("Access-Control-Allow-Headers", "accept, origin, content-type")
.header("Access-Control-Max-Age", "1728000")
.build();
}
If I use this class in an adapter's method, I get an exception:
javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation: loader (instance of com/ibm/ws/classloading/internal/AppClassLoader) previously initiated loading for a different type with name "javax/ws/rs/core/Response" ...
Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of com/ibm/ws/classloading/internal/AppClassLoader) previously initiated loading for a different type with name "javax/ws/rs/core/Response"
How can I set which Response type to load?