0

I put my files in /wso2am-2.6.0/repository/deployment/server/synapse-configs/default/api then send request and I got the below error

<ams:fault xmlns:ams="http://wso2.org/apimanager/security">
    <ams:code>900900</ams:code>
    <ams:message>Unclassified Authentication Failure</ams:message>
    <ams:description>Error while accessing backend services for API key validation</ams:description>
</ams:fault>

and wso2carbon.log as get error message as below

TID: [-1234] [] [2023-03-06 09:40:59,122] ERROR {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler} -  API authentication failure due to Unclassified Authentication Failure {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler}
org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException: Error while accessing backend services for API key validation
        at org.wso2.carbon.apimgt.gateway.handlers.security.keys.WSAPIKeyDataStore.getAllURITemplates(WSAPIKeyDataStore.java:77)
        at org.wso2.carbon.apimgt.gateway.handlers.security.APIKeyValidator.getAllURITemplates(APIKeyValidator.java:791)
        at org.wso2.carbon.apimgt.gateway.handlers.security.APIKeyValidator.doGetAPIInfo(APIKeyValidator.java:639)
        at org.wso2.carbon.apimgt.gateway.handlers.security.APIKeyValidator.findMatchingVerb(APIKeyValidator.java:573)
        at org.wso2.carbon.apimgt.gateway.handlers.security.APIKeyValidator.getResourceAuthenticationScheme(APIKeyValidator.java:357)
        at org.wso2.carbon.apimgt.gateway.handlers.security.oauth.OAuthAuthenticator.authenticate(OAuthAuthenticator.java:127)
        at org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler.isAuthenticate(APIAuthenticationHandler.java:210)
        at org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler.handleRequest(APIAuthenticationHandler.java:158)
        at org.apache.synapse.rest.API.process(API.java:325)
        at org.apache.synapse.rest.RESTRequestHandler.apiProcessNonDefaultStrategy(RESTRequestHandler.java:149)
        at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:95)
        at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:71)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:303)
        at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:92)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
        at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:415)
        at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException: Error while accessing backend services for API key validation
        at org.wso2.carbon.apimgt.gateway.handlers.security.keys.APIKeyValidatorClient.getAllURITemplates(APIKeyValidatorClient.java:189)
        at org.wso2.carbon.apimgt.gateway.handlers.security.keys.WSAPIKeyDataStore.getAllURITemplates(WSAPIKeyDataStore.java:75)
        ... 20 more
Caused by: java.lang.NullPointerException
        at org.wso2.carbon.apimgt.gateway.handlers.security.keys.APIKeyValidatorClient.getAllURITemplates(APIKeyValidatorClient.java:183)
        ... 21 more

Anyone hit the same problem, and what's the root cause of this error?

Yancey
  • 1
  • 1
  • When you say "I put my files in /wso2am-2.6.0/repository/deployment/server/synapse-configs/default/api" Did you create/ copy APIs manually? Didn't you use Publisher to publish the API? What version of API Manager are you using? – Joy Rathnayake Mar 06 '23 at 15:09
  • yes, before I use publisher to publish API but it's not work, so I put my files in path directly and re-publish, not sure it's work or not and get this error. My WSO2 API version is wso2am-2.6.0. – Yancey Mar 07 '23 at 02:26

1 Answers1

0

Ideally, you need to use API Manager Publisher portal and create the API by giving all the configuration details. It used OAuth 2.0 by default.

Check this detailed steps on how to create an API using Publisher - https://docs.wso2.com/display/AM260/Create+and+Publish+an+API

Check this detailed steps on how to subscribe to the API using Store - https://docs.wso2.com/display/AM260/Subscribe+to+an+API

Check this detailed steps on how to invoke the API using Try Out console in the Store - https://docs.wso2.com/display/AM260/Invoke+an+API+using+the+Integrated+API+Console

Joy Rathnayake
  • 485
  • 4
  • 8