【发布时间】:2018-03-26 06:41:08
【问题描述】:
我最近发现了在 AdapterSecurityContext 中存储 mobilefirst 8 服务器数据的问题。我们在自定义安全检查下使用 getClientRegistrationData 方法将安全用户数据存储在 AdapterSecurityContext 中。 它在 Mobilefirst DevKit 服务器中运行良好
ClientData clientData = adapterSecurityCheck.getClientRegistrationData();
clientData.getPublicAttributes().put(key, "hello");
adapterSecurityCheck.storeClientRegistrationData(clientData);
但是当我在 Liberty 服务器或我们安装的 Was ND 服务器上运行相同的适配器时,它给了我以下错误
com.ibm.mfp.server.core.sha red.MFPRESTException: 409; headers=[ MFP-Conflict=并发失败];身体={}
at com.ibm.mfp.server.registration.internal.RegistrationServiceImpl.stor eClient(RegistrationServiceImpl.java:235)
at sun.reflect.GeneratedMethodAccessor965.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti on(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo inpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:157)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doP roceed(DelegatingIntroductionInterceptor.java:133)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.inv oke(DelegatingIntroductionInterceptor.java:121)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami cAopProxy.java:207)
at com.sun.proxy.$Proxy219.storeClient(Unknown Source)
at com.ibm.mfp.server.security.internal.services.AdapterSecurityContextI mpl.storeClientRegistrationData(AdapterSecurityContextImpl.java:91)
at com.pscu.ServiceAdapterResource.setSecureData(ServiceAdapterResource. java:2321)
at com.pscu.ServiceAdapterResource.setAllCardsInToSecuredStore(ServiceAd apterResource.java:2332)
at com.pscu.ServiceAdapterResource.getPostLoginData(ServiceAdapterResour ce.java:250)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(Abst ractInvoker.java:181)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker .java:97)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInv okerInterceptor.java:59)
【问题讨论】:
-
您是使用 getClientRegistrationData() 还是 storeClientRegistrationData() 存储数据?
-
使用 storeClientRegistrationData。我已经用代码 sn-p 更新了这个问题。谢谢。
-
这看起来像在执行 getClientRegistrationData() 后立即执行 storeClientRegistrationData() 时存在并发问题。您可以尝试仅在客户端 ID 不为 null 时使用 storeClientRegistrationData() 调用吗?在调用 storeClientRegistrationData() 之前进行验证,以确保在调用 storeClientRegistrationData() 之前完成 getClientRegistrationData() 调用。
-
getClientRegistrationData() 是一种同步方法吗?它也返回所有存储的数据。但是当我尝试使用 storeClientRegistrationData 进行修改时,它给了我错误。
-
storeClientRegistrationData 正在引发此异常。 MFP 数据库是 oracle。
标签: ibm-mobilefirst mobilefirst-adapters mobilefirst-server