Thanks Chanaka

I have the following resource in my registry.

*/_system/governance/repository/components/org.wso2.apn/apns.p12*

When I try to get it using  *regInstance.getResource(new
Entry("gov:/repository/components/org.wso2.apn/apns.p12**"),null);*   it
gives the following NPE

Caused by: java.lang.NullPointerException
at
org.wso2.carbon.mediation.registry.WSO2Registry.readNonXML(WSO2Registry.java:664)
at
org.wso2.carbon.mediation.registry.WSO2Registry.lookup(WSO2Registry.java:186)

But if I cast the registry to WSO2Registry and use the following code line
it works.

*wso2registry.wso2Registry.getResource("gov:/repository/components/org.wso2.apn/apns.p12")*

Any thoughts on this please ?


On Fri, Apr 4, 2014 at 1:09 PM, Chanaka Fernando <[email protected]> wrote:

> You can access registry resource inside mediate method as below.
>
>   // if localentry "testLocalentry" defined in synapse econfig
>         Entry localEntryObj = (Entry) synapseMsgContext.getConfiguration()
>                 .getLocalRegistry().get("testLocalentry");
>         System.out.println(" value: " + localEntryObj.getValue());
>         System.out.println(" Filename : " + localEntryObj.getFileName());
>
>         // goverance/config registry
>         Registry regInstance = synapseMsgContext.getConfiguration()
>                 .getRegistry();
>         Object obj=regInstance.getResource(new
> Entry("gov:/test1.txt"),null);
>         Object obj2=regInstance.getResource(new
> Entry("conf:/test2.txt"),null);
>
> Thanks,
> Chanaka
>
>
> On Fri, Apr 4, 2014 at 12:51 PM, Rushmin Fernando <[email protected]>wrote:
>
>> Hi
>>
>> I need to read a blob in the the registry, from a mediator class. How can
>> I do that please ?
>>
>> Thanks
>> /rushmin
>>
>> --
>> *Rushmin Fernando*
>> *Technical Lead*
>>
>> WSO2 Inc. <http://wso2.com/> - Lean . Enterprise . Middleware
>>
>> email : [email protected]
>> mobile : +94772310855
>>
>>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> --
> Chanaka Fernando
> Technical Lead
> WSO2, Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: +94 773337238
> Blog : http://soatutorials.blogspot.com
> LinkedIn:http://www.linkedin.com/pub/chanaka-fernando/19/a20/5b0
> Twitter:https://twitter.com/chanakaudaya
> Wordpress:http://chanakaudaya.wordpress.com
>
>
>
>


-- 
*Rushmin Fernando*
*Technical Lead*

WSO2 Inc. <http://wso2.com/> - Lean . Enterprise . Middleware

email : [email protected]
mobile : +94772310855
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to