无法在MobileFirst V8.0 Consumer Edition中调用适配器过程

时间:2016-08-25 20:20:53

标签: ibm-mobilefirst mobilefirst-adapters mobilefirst-server

我正在使用MobileFirst V8.0 Consumer Edition。我为我的应用设置了一个测试服务器。当我从移动应用程序调用适配器过程(受安全检查保护)时,我在服务器中遇到以下错误:

[8/25/16 15:10:08:879 CDT] 0000010b com.ibm.mfp.server.az.internal.ConfidentialClientHelper      E Unable to sign access token
com.ibm.mfp.server.security.shared.webtoken.WebTokenException: com.ibm.mfp.server.security.shared.webtoken.WebTokenException: Unsupported credentials type
    at com.ibm.mfp.server.security.shared.webtoken.JWS.sign(JWS.java:191)
    at com.ibm.mfp.server.az.internal.ConfidentialClientHelper.generateAccessToken(ConfidentialClientHelper.java:94)
    at com.ibm.mfp.server.az.internal.token.TokenEndpointImpl.generateTokenResponse(TokenEndpointImpl.java:170)
    at com.ibm.mfp.server.az.internal.token.TokenEndpointImpl.serveAuthorizationCodeGrantType(TokenEndpointImpl.java:147)
    at com.ibm.mfp.server.az.internal.token.TokenEndpointImpl.getToken(TokenEndpointImpl.java:96)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1285)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:776)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:473)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1104)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:81)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:912)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:262)
    at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:955)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.ibm.mfp.server.security.shared.webtoken.WebTokenException: Unsupported credentials type
    at com.ibm.mfp.server.security.shared.webtoken.PKICredentials.getRsaPublicKey(PKICredentials.java:120)
    at com.ibm.mfp.server.security.shared.webtoken.PKICredentials.createWebKey(PKICredentials.java:96)
    at com.ibm.mfp.server.security.shared.webtoken.PKICredentials.createHeader(PKICredentials.java:48)
    at com.ibm.mfp.server.security.shared.webtoken.JWS.sign(JWS.java:186)
    ... 32 more

此外,我在MFP服务器实例中使用用户定义的密钥库。

1 个答案:

答案 0 :(得分:1)

我使用-keyalg RSA选项中的keytool -keystore <keystore name> -genkey -alias <alias name> -keylag RSA 选项使用以下命令重新生成密钥库,并重新配置密钥库,此错误消失了:

Runtime Settings --> Keystore

之前我提到了位于MobileFirst控制台中的名为“创建自己的密钥库”的MFP控制台中的指南,位于以下位置-keyalg RSA,并且缺少public class ElasticsearchContextListener implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent servletContextEvent) { System.out.println("Starting up!"); try { Client client = TransportClient.builder().build().addTransportAddress( new InetSocketTransportAddress(InetAddress.getByName("IP-address"),9300)); //Storing the client connection in a static variable Parameters.setESclient(client); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void contextDestroyed(ServletContextEvent servletContextEvent) { Parameters.getESclient().close(); System.out.println("Shutting down!"); } } 选项。

this