Hi All, The above issue is resolved with PR [1].
[1] https://github.com/wso2/msf4j/pull/490 Best Regards, Vidura Nanayakkara On Fri, Oct 27, 2017 at 11:30 AM, Vidura Nanayakkara <[email protected]> wrote: > Hi Chanaka, > > I was able to reproduce this issue and opened the git issue [1] to track > this down. The null pointer exception is thrown when metrics configuration > is retrieved due to carbon config resolver being not set. I will look into > this and let you know once this is fixed asap. > > [1] https://github.com/wso2/msf4j/issues/482 > > On Fri, Oct 27, 2017 at 10:03 AM, Viduranga Gunarathne <[email protected] > > wrote: > >> Hi, >> I too encountered the same issue, when I used the following code as >> stated in the sample[1]: >> >> public static void main(String[] args) { >> new MicroservicesRunner() >> .addInterceptor(new MetricsInterceptor()) >> .deploy(new HelloService()) >> .deploy(new DemoService()) >> .start(); >> } >> >> It seems the "addInterceptor()" method is deprecated. >> >> The workaround to this was as follows: >> *No need to pass an instance of "MetricsInterceptor" >> >> public static void main(String[] args) { >> new MicroservicesRunner() >> .addGlobalRequestInterceptor() >> .addGlobalResponseInterceptor() >> .deploy(new HelloService()) >> .deploy(new DemoService()) >> .start(); >> } >> >> This worked out for me. >> Hope this helps! >> >> [1] https://github.com/wso2/msf4j/tree/master/samples/metrics >> >> Thanks, >> Viduranga. >> >> >> >> On Thu, Oct 26, 2017 at 9:40 AM, Chanaka Fernando <[email protected]> >> wrote: >> >>> Hi Devs, >>> >>> When I try to run metrics sample[1] in MSF4J, I'm getting the below NPE >>> during the invocation of the service. >>> >>> [msf4j.executor.workerpool-1] INFO org.wso2.msf4j.analytics.metrics.Metrics >>> - Initializing Metrics Services >>> [msf4j.executor.workerpool-1] ERROR >>> org.wso2.msf4j.analytics.metrics.MetricsInterceptor >>> - Exception while executing request interceptor class >>> org.wso2.msf4j.analytics.metrics.MetricsInterceptor >>> java.lang.NullPointerException >>> at org.wso2.carbon.metrics.core.Metrics.<init>(Metrics.java:78) >>> at org.wso2.msf4j.analytics.metrics.Metrics.initializeServices( >>> Metrics.java:62) >>> at org.wso2.msf4j.analytics.metrics.Metrics.getMetricService(Me >>> trics.java:83) >>> at org.wso2.msf4j.analytics.metrics.MetricsInterceptor.preCall( >>> MetricsInterceptor.java:96) >>> at org.wso2.msf4j.Interceptor.interceptRequest(Interceptor.java:65) >>> at org.wso2.msf4j.interceptor.InterceptorExecutor.executeReques >>> tInterceptor(InterceptorExecutor.java:321) >>> at org.wso2.msf4j.interceptor.InterceptorExecutor.executeGlobal >>> RequestInterceptors(InterceptorExecutor.java:206) >>> at org.wso2.msf4j.interceptor.InterceptorExecutor.executeGlobal >>> RequestInterceptors(InterceptorExecutor.java:52) >>> at org.wso2.msf4j.internal.router.HttpMethodInfo.invokeResource >>> (HttpMethodInfo.java:179) >>> at org.wso2.msf4j.internal.router.HttpMethodInfo.invoke(HttpMet >>> hodInfo.java:143) >>> at org.wso2.msf4j.internal.MSF4JMessageProcessor.dispatchMethod >>> (MSF4JMessageProcessor.java:248) >>> at org.wso2.msf4j.internal.MSF4JMessageProcessor.lambda$receive >>> $0(MSF4JMessageProcessor.java:160) >>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool >>> Executor.java:1142) >>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo >>> lExecutor.java:617) >>> at java.lang.Thread.run(Thread.java:745) >>> >>> Did anyone encounter such an issue? >>> >>> [1] https://github.com/wso2/msf4j/tree/master/samples/metrics >>> >>> Thanks, >>> Chanaka >>> -- >>> Thank you and Best Regards, >>> Chanaka Fernando >>> Senior Technical Lead >>> m: +94 773337238 <+94%2077%20333%207238> >>> https://wso2.com <https://wso2.com/signature> >>> >>> >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Dev mailing list >>> [email protected] >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> Regards, >> >> *Viduranga Gunarathne* >> >> *Software Engineer Intern* >> >> >> *WSO2* >> Email : [email protected] >> Mobile : +94712437484 <+94%2071%20243%207484> >> Web : http://wso2.com >> [image: https://wso2.com/signature] <https://wso2.com/signature> >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > Best Regards, > > *Vidura Nanayakkara* > > Email : [email protected] > Mobile : +94 (0) 717 919277 <+94%2071%20791%209277> > Web : http://wso2.com > -- Best Regards, *Vidura Nanayakkara* Software Engineer Email : [email protected] Mobile : +94 (0) 717 919277 Web : http://wso2.com
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
