0
votes

I deployed API Manager 2.1.0 and setup the api-import-export-2.1.0 war file described here. After importing my API endpoint by uploading a zip file the status=CREATED.

To actually publish the API I am calling the Publisher's change-lifecycle API but I am getting this exception:

TID: [-1234] [] [2017-07-06 11:11:57,289] ERROR {org.wso2.carbon.apimgt.rest.api.util.exception.GlobalThrowableMapper} - An Unknown exception has been captured by global exception mapper. {org.wso2.carbon.apimgt.rest.api.util.exception.GlobalThrowableMapper} java.lang.NoSuchMethodError: org.wso2.carbon.apimgt.api.APIProvider.changeLifeCycleStatus(Lorg/wso2/carbon/apimgt/api/model/APIIdentifier;Ljava/lang/String;)Z

Any ideas on why?

I can get an access token (scope apim:api_view) and call this

:9443/api/am/publisher/v0.10/apis

to list the api's just fine.

I get a different acces_token (for scope: apim:api_publish) and then call

:9443/api/am/publisher/v0.10/apis/change-lifecycle

but get the above Exception. Here's the example:

[root@localhost]  ./publish.sh 
View APIs (token dc0c1497-6c27-3a10-87d7-b2abc7190da5 scope: apim:api_view)
curl -k -s -H "Authorization: Bearer dc0c1497-6c27-3a10-87d7-b2abc7190da5" https://gw-node:9443/api/am/publisher/v0.10/apis 
{
     "count": 1,
     "next": "",
     "previous": "",
     "list": [
         {
             "id": "d214f784-ee16-4067-9588-0898a948bb17",
             "name": "Health",
             "description": "health check",
             "context": "/api",
             "version": "v1",
             "provider": "admin",
             "status": "CREATED"
         }
     ] }

Publish API (token b9a31369-8ea3-3bf2-ba3c-7f2a4883de7d scope: apim:api_publish)   
curl -k -H "Authorization: Bearer b9a31369-8ea3-3bf2-ba3c-7f2a4883de7d" -X POST https://gw-node:9443/api/am/publisher/v0.10/apis/change-lifecycle?apiId=d214f784-ee16-4067-9588-0898a948bb17&action=Publish

{
  "code":500,
  "message":"Internal server error",
  "description":"The server encountered an internal error. Please contact administrator.",
  "moreInfo":"",
  "error":[]
}
1
I also tried to publish the API from the publisher UI page and got this error: TID: [-1234] [] [2017-07-06 16:13:22,741] ERROR {JAGGERY.site.blocks.item-design.ajax.add:jag} - org.mozilla.javascript.WrappedException: Wrapped jav a.lang.ClassCastException: org.mozilla.javascript.UniqueTag cannot be cast to java.lang.String (/publisher/modules/api/add.jag#134)user2725960

1 Answers

0
votes

Issue resolved. In apim 2.1 the publisher & store API versions changed.

In apim 2.0 I was using:

:9443/api/am/publisher/v0.10/apis :9443/api/am/store/v0.10/apis but in apim 2.1 they are: :9443/api/am/publisher/v0.11/apis :9443/api/am/store/v0.11/apis