I have created a new custom namespace for the asset metadata. I am able to add the custom metadata to the asset. But while retrieving using asset,getMetadata it comes as ns2:<customname>
In order for the custom namespace to be saved, the namespace has to be registered in AEM. Please look at the document -> Namespace | Content Management under the heading "Register namespace via CRX Console" and follow the steps.
Glad to hear it was resolved.
Issue resolved after server restart
It is already added in namespace editor interface. Adding the custom metadata is not an issue. Retrieving it using asset.getMetadata() is causing the issue
Nice response and helpful pointing to the related docs.