WSO2 API Manager APICTL api-import error
WSO2 APIM version: 3.2.0.85
APICTL Version: 3.2.4
APICTL errors:
apictl import-api --file D:\test\Test001-API_1.0.0.zip -e dev -k
Error importing API.
Status: 500
Response: {"code":500,"message":"Internal server error","description":"The server encountered an internal error. Please contact administrator.","moreInfo":"","error":[]}
apictl: Error importing API Reason: 500
Exit status 1
wso2carbon logs:
[2021-10-15 23:42:49,635] ERROR - GlobalThrowableMapper An unknown exception has been captured by the global exception mapper.
com.google.gson.JsonSyntaxException: Oct 14, 2021, 10:26:10 AM
at com.google.gson.internal.bind.DateTypeAdapter.deserializeToDate(DateTypeAdapter.java:87) ~[com.google.gson_2.8.5.jar:?]
at com.google.gson.internal.bind.DateTypeAdapter.read(DateTypeAdapter.java:75) ~[com.google.gson_2.8.5.jar:?]
at com.google.gson.internal.bind.DateTypeAdapter.read(DateTypeAdapter.java:46) ~[com.google.gson_2.8.5.jar:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131) ~[com.google.gson_2.8.5.jar:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222) ~[com.google.gson_2.8.5.jar:?]
at com.google.gson.Gson.fromJson(Gson.java:927) ~[com.google.gson_2.8.5.jar:?]
at com.google.gson.Gson.fromJson(Gson.java:994) ~[com.google.gson_2.8.5.jar:?]
at com.google.gson.Gson.fromJson(Gson.java:967) ~[com.google.gson_2.8.5.jar:?]
at org.wso2.carbon.apimgt.impl.importexport.utils.APIImportUtil.importAPI_aroundBody2(APIImportUtil.java:171) ~[org.wso2.carbon.apimgt.impl_6.7.206.168.jar:?]
at org.wso2.carbon.apimgt.impl.importexport.utils.APIImportUtil.importAPI(APIImportUtil.java:114) ~[org.wso2.carbon.apimgt.impl_6.7.206.168.jar:?]
at org.wso2.carbon.apimgt.impl.importexport.APIImportExportManager.importAPIArchive_aroundBody8(APIImportExportManager.java:154) ~[org.wso2.carbon.apimgt.impl_6.7.206.168.jar:?]
at org.wso2.carbon.apimgt.impl.importexport.APIImportExportManager.importAPIArchive(APIImportExportManager.java:144) ~[org.wso2.carbon.apimgt.impl_6.7.206.168.jar:?]
at org.wso2.carbon.apimgt.rest.api.admin.v1.impl.ImportApiServiceImpl.importApiPost(ImportApiServiceImpl.java:103) ~[classes/:?]
at org.wso2.carbon.apimgt.rest.api.admin.v1.ImportApi.importApiPost(ImportApi.java:58) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_291]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_291]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_291]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_291]
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) ~[cxf-core-3.2.8.jar:3.2.8]
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) ~[cxf-core-3.2.8.jar:3.2.8]
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193) [cxf-rt-frontend-jaxrs-3.2.8.jar:3.2.8]
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103) [cxf-rt-frontend-jaxrs-3.2.8.jar:3.2.8]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) [cxf-core-3.2.8.jar:3.2.8]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) [cxf-core-3.2.8.jar:3.2.8]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) [cxf-core-3.2.8.jar:3.2.8]
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [cxf-core-3.2.8.jar:3.2.8]
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:216) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:681) [tomcat-servlet-api_9.0.31.wso2v1.jar:?]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat_9.0.31.wso2v1.jar:?]
at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:86) [org.wso2.carbon.identity.context.rewrite.valve_1.4.0.jar:?]
at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:110) [org.wso2.carbon.identity.authz.valve_1.4.0.jar:?]
at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:103) [org.wso2.carbon.identity.auth.valve_1.4.0.2.jar:?]
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99) [org.wso2.carbon.tomcat.ext_4.6.0.44.jar:?]
at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49) [org.wso2.carbon.tomcat.ext_4.6.0.44.jar:?]
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62) [org.wso2.carbon.tomcat.ext_4.6.0.44.jar:?]
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:145) [org.wso2.carbon.tomcat.ext_4.6.0.44.jar:?]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687) [tomcat_9.0.31.wso2v1.jar:?]
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57) [org.wso2.carbon.tomcat.ext_4.6.0.44.jar:?]
at org.wso2.carbon.tomcat.ext.valves.RequestCorrelationIdValve.invoke(RequestCorrelationIdValve.java:124) [org.wso2.carbon.tomcat.ext_4.6.0.44.jar:?]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1726) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [tomcat_9.0.31.wso2v1.jar:?]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat_9.0.31.wso2v1.jar:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_291]
Caused by: java.text.ParseException: Failed to parse date ["Oct 14, 2021, 10:26:10 AM"]: Invalid number: Oct
at com.google.gson.internal.bind.util.ISO8601Utils.parse(ISO8601Utils.java:274) ~[com.google.gson_2.8.5.jar:?]
at com.google.gson.internal.bind.DateTypeAdapter.deserializeToDate(DateTypeAdapter.java:85) ~[com.google.gson_2.8.5.jar:?]
... 65 more
Caused by: java.lang.NumberFormatException: Invalid number: Oct
at com.google.gson.internal.bind.util.ISO8601Utils.parseInt(ISO8601Utils.java:311) ~[com.google.gson_2.8.5.jar:?]
at com.google.gson.internal.bind.util.ISO8601Utils.parse(ISO8601Utils.java:129) ~[com.google.gson_2.8.5.jar:?]
at com.google.gson.internal.bind.DateTypeAdapter.deserializeToDate(DateTypeAdapter.java:85) ~[com.google.gson_2.8.5.jar:?]
... 65 more
Workaround
The highlighted section clearly indicates that apictl is unable to parse the date format and hence import is completely failed. I have done the following workaround to get my api import to be working-
Comments
Post a Comment