我正在使用 IBM MFP8 安全检查适配器。一旦用户通过身份验证,我的后端服务将在 JSONObject 中提供用户数据,并将该用户数据作为字符串存储在属性中。在另一个适配器中,我正在调用此用户数据并尝试再次解析为 JSONObject,并在将字符串解析为 JSONObject 时出现以下错误。请帮助确定问题所在以及如何解决此问题。
代码:
import com.ibm.json.java.JSON;
import com.ibm.json.java.JSONArray;
import com.ibm.json.java.JSONObject;
AuthenticatedUser user = securityContext.getAuthenticatedUser();
String queryParams = (String) user.getAttributes().get("queryParams");
JSONObject queryParamsObject = (JSONObject) JSON.parse(queryParams);
错误:
[err] org.apache.cxf.interceptor.Fault: loader constraint violation: when resolving method "com.ibm.json.java.internal.Parser.parse()Lcom/ibm/json/java/JSONObject;" the class loader (instance of com/ibm/mfp/server/core/shared/ParentLastClassLoader) of the current class, com/ibm/json/java/JSONObject, and the class loader (instance of com/ibm/ws/classloading/internal/ParentLastClassLoader) for the method's defining class, com/ibm/json/java/internal/Parser, have different Class objects for the type com/ibm/json/java/JSONObject used in the signature
[err] at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:163)
[err] at [internal classes]
[err] at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
[err] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:268)
[err] at com.ibm.mfp.server.java.adapter.shared.JAXRSSandbox$3.doFilter(JAXRSSandbox.java:579)
[err] at com.ibm.mfp.server.java.adapter.shared.FilterChainImpl.doFilter(FilterChainImpl.java:86)
[err] at com.ibm.mfp.server.java.adapter.shared.JAXRSSandbox.handleRequest(JAXRSSandbox.java:584)
[err] at com.ibm.mfp.server.java.adapter.internal.rest.AdaptersEndpoint.adapterServing(AdaptersEndpoint.java:115)
[err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[err] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[err] at java.lang.reflect.Method.invoke(Unknown Source)
[err] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
[err] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
[err] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
[err] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
[err] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
[err] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
[err] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
[err] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
[err] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
[err] at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
[err] at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
[err] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
[err] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
[err] at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1287)
[err] at [internal classes]
[err] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[err] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[err] at java.lang.Thread.run(Unknown Source)
[err] Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "com.ibm.json.java.internal.Parser.parse()Lcom/ibm/json/java/JSONObject;" the class loader (instance of com/ibm/mfp/server/core/shared/ParentLastClassLoader) of the current class, com/ibm/json/java/JSONObject, and the class loader (instance of com/ibm/ws/classloading/internal/ParentLastClassLoader) for the method's defining class, com/ibm/json/java/internal/Parser, have different Class objects for the type com/ibm/json/java/JSONObject used in the signature
[err] at com.ibm.json.java.JSONObject.parse(JSONObject.java:79)
[err] at [internal classes]