0

There is Pizzashack sample API is deployed in WSO2 APIm 4.1.0

pizzashack

However API state has been moved to Deprecated in sometimes before.

When click on this API to make some changes (delete/moved to some other state etc) , It is loading, not getting any response.

loading pic

Got below logs in wso2carbon.log

ERROR:

[2023-02-05 22:53:29,331] ERROR - GlobalThrowableMapper An unknown exception has been captured by the global exception mapper.
java.lang.NullPointerException: null
        at org.wso2.carbon.apimgt.rest.api.publisher.v1.common.mappings.APIMappingUtil.fromAPItoDTO(APIMappingUtil.java:1136) ~[org.wso2.carbon.apimgt.rest.api.publisher.v1.common_9.20.74.jar:?]
        at org.wso2.carbon.apimgt.rest.api.publisher.v1.common.mappings.APIMappingUtil.fromAPItoDTO(APIMappingUtil.java:858) ~[org.wso2.carbon.apimgt.rest.api.publisher.v1.common_9.20.74.jar:?]
        at org.wso2.carbon.apimgt.rest.api.publisher.v1.impl.ApisApiServiceImpl.getAPIByID(ApisApiServiceImpl.java:3961) ~[?:?]
        at org.wso2.carbon.apimgt.rest.api.publisher.v1.impl.ApisApiServiceImpl.getAPI(ApisApiServiceImpl.java:327) ~[?:?]
        at org.wso2.carbon.apimgt.rest.api.publisher.v1.ApisApi.getAPI(ApisApi.java:618) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_291]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_291]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_291]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_291]
        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) ~[?:?]
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) ~[?:?]
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201) ~[?:?]
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104) ~[?:?]
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) ~[?:?]
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) ~[?:?]
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) ~[?:?]
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) ~[?:?]
        at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265) ~[?:?]
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) ~[?:?]
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) ~[?:?]
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) ~[?:?]
        at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225) ~[?:?]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:304) ~[?:?]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:222) ~[?:?]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:655) ~[tomcat-servlet-api_9.0.58.wso2v1.jar:?]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:279) ~[?:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:107) ~[org.wso2.carbon.identity.context.rewrite.valve_1.4.52.jar:?]
        at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:110) ~[org.wso2.carbon.identity.authz.valve_1.4.52.jar:?]
        at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:102) ~[org.wso2.carbon.identity.auth.valve_1.4.52.jar:?]
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:101) ~[org.wso2.carbon.tomcat.ext_4.6.3.jar:?]
        at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49) ~[org.wso2.carbon.tomcat.ext_4.6.3.jar:?]
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62) ~[org.wso2.carbon.tomcat.ext_4.6.3.jar:?]
        at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:146) ~[org.wso2.carbon.tomcat.ext_4.6.3.jar:?]
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:58) ~[org.wso2.carbon.tomcat.ext_4.6.3.jar:?]
        at org.wso2.carbon.tomcat.ext.valves.RequestCorrelationIdValve.invoke(RequestCorrelationIdValve.java:126) ~[org.wso2.carbon.tomcat.ext_4.6.3.jar:?]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:359) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:889) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1735) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat_9.0.58.wso2v1.jar:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_291]

As suggested below, adding xml of the registry artifact of PizzaShackAPI:

<metadata
xmlns="http://www.wso2.org/governance/metadata">
<overview>
    <provider>admin</provider>
    <name>PizzaShack</name>
    <context>/pizzashack/1.0.0</context>
    <contextTemplate>/pizzashack</contextTemplate>
    <version>1.0.0</version>
    <versionType>context</versionType>
    <versionComparable>1671437384506</versionComparable>
    <type>HTTP</type>
    <keyManagers>[]</keyManagers>
    <isDefaultVersion>false</isDefaultVersion>
    <advertiseOnly>false</advertiseOnly>
    <endpointSecured>false</endpointSecured>
    <endpointAuthDigest>false</endpointAuthDigest>
    <implementation>ENDPOINT</implementation>
    <isLatest>true</isLatest>
    <tier>Gold</tier>
    <status>DEPRECATED</status>
    <corsConfiguration>null</corsConfiguration>
    <websubSubscriptionConfiguration>null</websubSubscriptionConfiguration>
    <wsUriMapping>null</wsUriMapping>
    <responseCaching>Enabled</responseCaching>
    <cacheTimeout>0</cacheTimeout>
    <apiSecurity>oauth2</apiSecurity>
    <enableSchemaValidation>false</enableSchemaValidation>
    <enableStore>true</enableStore>
</overview>
<uritemplate/>

How can we get overview page OR to do some other action on the same API?

Justin
  • 855
  • 2
  • 11
  • 30
  • Does this happen when you create a new version of the API and while publishing, tried to deprecated the previous version? – Lakshitha Feb 05 '23 at 18:18
  • Hi @Lakshitha Sorry for delay response. There is one Version of Pizzashack is available(V1.0.0) which is in deprecated state. Either i want to move state of this API from current state(ie deprecated) to another state or delete this old one, so that i can deploy sample pizza shack APi as new one. It is loading and not opening so couldn't able to do above action. when i try to delete, active subscription is there already(ie default app subscribed), couldnot able to edit this is devportal as EDIT or DELETE is hided in devportal – Justin Feb 09 '23 at 15:34
  • Can you add a screenshot or the xml of the registry artifact of PizzaShackAPI? You can follow the process i have mentioned in the answer. – Lakshitha Feb 10 '23 at 17:41
  • Hi @Lakshitha As suggested below, Navigated to Carbon console and added Registry file data of Pizzashack API in Question. Please have a look on this – Justin Feb 14 '23 at 15:26

2 Answers2

1

Seems like your artifact is missing some mandatory fields. Can you fill it in with the following information?

enter image description here

Endpoint config:

{"endpoint_type":"http","sandbox_endpoints":{"url":"https:\/\/localhost:9443\/am\/sample\/pizzashack\/v1\/api\/"},"production_endpoints":{"url":"https:\/\/localhost:9443\/am\/sample\/pizzashack\/v1\/api\/"}}

Cors Configurations:

{"corsConfigurationEnabled":false,"accessControlAllowOrigins":["*"],"accessControlAllowCredentials":false,"accessControlAllowHeaders":["authorization","Access-Control-Allow-Origin","Content-Type","SOAPAction","apikey","Internal-Key"],"accessControlAllowMethods":["GET","PUT","POST","DELETE","PATCH","OPTIONS"]}

API Security:

oauth2,oauth_basic_auth_api_key_mandatory
Lakshitha
  • 1,021
  • 1
  • 6
  • 15
  • Hi @Lakshitha, Thanks for providing answer, after adding endpoint config, cors config and security details in registry file, this issue resolved, now i can able to do some activities like delete existing subscription from dev portal and delete api from publisher portal also – Justin Feb 21 '23 at 06:44
0

This is a known issue in APIM 4.1.0. If you create a new version of the API (v1.0.0 and v2.0.0) and during the publishing step of v2.0.0, you have the option to deprecate the v1.0.0 while publishing v2.0.0. There was an error in this flow that corrupts the artifacts of v1.0.0. v1.0.0 status is changed to deprecated, however, you can't open or delete the existing API. This has been fixed by fix.

As a solution, you need to fix the corrupted artifact. Luckily you should have a version that is not corrupted and you can use the fields in the v2.0.0 to fix the corrupted v1.0.0.

  1. Log in to the carbon console.
  2. Access the registry artifacts from "Browse" in the Resources section of the Main tab.
  3. Navigate to /_system/governance/apimgt/applicationdata/provider/<user>/<API_Name>/
  4. Here you can find both versions of the API. Navigate to the latest version and open the api artifact.
  5. Navigate to the corrupted version and open the api artifact.

You should be able to see that some data in the corrupted version is missing and they are populated in the working version. By manually adding these fields, you should be able to get the corrupted version working again.

Lakshitha
  • 1,021
  • 1
  • 6
  • 15