[jira] [Commented] (FINERACT-1088) ResourceAccessException at SmsCampaignDropdownReadPlatformServiceImpl

2020-08-26 Thread Petri Tuomola (Jira)


[ 
https://issues.apache.org/jira/browse/FINERACT-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17185136#comment-17185136
 ] 

Petri Tuomola commented on FINERACT-1088:
-

[~vorburger] I just tried this out, and unfortunately the caller does not get a 
PlatformDataIntegrityException: the exception thrown by Spring means the line 
checking the status code never gets executed.

So we can catch the exception and then throw our own, so that the client gets a 
sensible error message.  

> ResourceAccessException at SmsCampaignDropdownReadPlatformServiceImpl
> -
>
> Key: FINERACT-1088
> URL: https://issues.apache.org/jira/browse/FINERACT-1088
> Project: Apache Fineract
>  Issue Type: Bug
>Reporter: Michael Vorburger
>Assignee: Petri Tuomola
>Priority: Minor
>
> See FINERACT-932 for general background; I've found this in logs of 
> https://www.fineract.dev:
> {noformat}org.springframework.web.client.ResourceAccessException: I/O error 
> on GET request for "http://localhost:9191/smsbridges": Connection refused 
> (Connection refused); nested exception is java.net.ConnectException: 
> Connection refused (Connection refused)
> at org.springframework.web.client.RestTemplate.doExecute 
> (RestTemplate.java:748)
> at org.springframework.web.client.RestTemplate.execute 
> (RestTemplate.java:714)
> at org.springframework.web.client.RestTemplate.exchange 
> (RestTemplate.java:632)
> at 
> org.apache.fineract.infrastructure.campaigns.sms.service.SmsCampaignDropdownReadPlatformServiceImpl.retrieveSmsProviders
>  (SmsCampaignDropdownReadPlatformServiceImpl.java:80)
> at 
> org.apache.fineract.infrastructure.campaigns.sms.service.SmsCampaignReadPlatformServiceImpl.retrieveTemplate
>  (SmsCampaignReadPlatformServiceImpl.java:111)
> at 
> org.apache.fineract.infrastructure.campaigns.sms.api.SmsCampaignApiResource.template
>  (SmsCampaignApiResource.java:107)
> at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native 
> Method)
> at jdk.internal.reflect.NativeMethodAccessorImpl.invoke 
> (NativeMethodAccessorImpl.java:62)
> at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke 
> (DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke (Method.java:566)
> at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke 
> (JavaMethodInvokerFactory.java:60)
> at 
> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch
>  (AbstractResourceMethodDispatchProvider.java:185)
> at 
> com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch
>  (ResourceJavaMethodDispatcher.java:75)
> at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept 
> (HttpMethodRule.java:302)
> at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept 
> (RightHandPathRule.java:147)
> at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept 
> (ResourceClassRule.java:108)
> at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept 
> (RightHandPathRule.java:147)
> at 
> com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept 
> (RootResourceClassesRule.java:84)
> at 
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest 
> (WebApplicationImpl.java:1542)
> at 
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest 
> (WebApplicationImpl.java:1473)
> at 
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest 
> (WebApplicationImpl.java:1419)
> at 
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest 
> (WebApplicationImpl.java:1409)
> at com.sun.jersey.spi.container.servlet.WebComponent.service 
> (WebComponent.java:409)
> at com.sun.jersey.spi.container.servlet.ServletContainer.service 
> (ServletContainer.java:558)
> at com.sun.jersey.spi.container.servlet.ServletContainer.service 
> (ServletContainer.java:733)
> at javax.servlet.http.HttpServlet.service (HttpServlet.java:741)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
> (ApplicationFilterChain.java:231)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter 
> (ApplicationFilterChain.java:166)
> at org.apache.tomcat.websocket.server.WsFilter.doFilter 
> (WsFilter.java:53)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
> (ApplicationFilterChain.java:193)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter 
> (ApplicationFilterChain.java:166)
> at 
> org.springframework.security.web.access.intercept.FilterSecuri

[jira] [Commented] (FINERACT-1088) ResourceAccessException at SmsCampaignDropdownReadPlatformServiceImpl

2020-07-11 Thread Michael Vorburger (Jira)


[ 
https://issues.apache.org/jira/browse/FINERACT-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17155987#comment-17155987
 ] 

Michael Vorburger commented on FINERACT-1088:
-

I've done a quick analysis of this... so, looking at 
https://github.com/apache/fineract/blob/develop/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDropdownReadPlatformServiceImpl.java,
 I suspect that the client actually did receive a 
{{PlatformDataIntegrityException}} (because 
{{!responseOne.getStatusCode().equals(HttpStatus.OK)}}. Note that this error 
log isn't actually coming from Fineract itself, but from Spring Framework's 
RestTemplate.

My PoV would be that, in a perfect world, this shouldn't (does have to be) 
logged as an error, because the client is already appropriately informed 
through a REST API response. E.g. 
https://stackoverflow.com/questions/7952154/spring-resttemplate-how-to-enable-full-debugging-logging-of-requests-responses
 seems to show that using {{restTemplate.setErrorHandler()}} it may be possible 
to make it stop doing that.

Thus classifying this with Priority: Minor... this is "just an error log", 
which in an ideal world we would hide - but many of the other issues linked 
from FINERACT-932 are much more important than sorting this out. I still wanted 
to have an open issue about it just to record it.

> ResourceAccessException at SmsCampaignDropdownReadPlatformServiceImpl
> -
>
> Key: FINERACT-1088
> URL: https://issues.apache.org/jira/browse/FINERACT-1088
> Project: Apache Fineract
>  Issue Type: Bug
>Reporter: Michael Vorburger
>Priority: Minor
>
> See FINERACT-932 for general background; I've found this in logs of 
> https://www.fineract.dev:
> {noformat}org.springframework.web.client.ResourceAccessException: I/O error 
> on GET request for "http://localhost:9191/smsbridges": Connection refused 
> (Connection refused); nested exception is java.net.ConnectException: 
> Connection refused (Connection refused)
> at org.springframework.web.client.RestTemplate.doExecute 
> (RestTemplate.java:748)
> at org.springframework.web.client.RestTemplate.execute 
> (RestTemplate.java:714)
> at org.springframework.web.client.RestTemplate.exchange 
> (RestTemplate.java:632)
> at 
> org.apache.fineract.infrastructure.campaigns.sms.service.SmsCampaignDropdownReadPlatformServiceImpl.retrieveSmsProviders
>  (SmsCampaignDropdownReadPlatformServiceImpl.java:80)
> at 
> org.apache.fineract.infrastructure.campaigns.sms.service.SmsCampaignReadPlatformServiceImpl.retrieveTemplate
>  (SmsCampaignReadPlatformServiceImpl.java:111)
> at 
> org.apache.fineract.infrastructure.campaigns.sms.api.SmsCampaignApiResource.template
>  (SmsCampaignApiResource.java:107)
> at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native 
> Method)
> at jdk.internal.reflect.NativeMethodAccessorImpl.invoke 
> (NativeMethodAccessorImpl.java:62)
> at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke 
> (DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke (Method.java:566)
> at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke 
> (JavaMethodInvokerFactory.java:60)
> at 
> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch
>  (AbstractResourceMethodDispatchProvider.java:185)
> at 
> com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch
>  (ResourceJavaMethodDispatcher.java:75)
> at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept 
> (HttpMethodRule.java:302)
> at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept 
> (RightHandPathRule.java:147)
> at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept 
> (ResourceClassRule.java:108)
> at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept 
> (RightHandPathRule.java:147)
> at 
> com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept 
> (RootResourceClassesRule.java:84)
> at 
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest 
> (WebApplicationImpl.java:1542)
> at 
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest 
> (WebApplicationImpl.java:1473)
> at 
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest 
> (WebApplicationImpl.java:1419)
> at 
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest 
> (WebApplicationImpl.java:1409)
> at com.sun.jersey.spi.container.servlet.WebComponent.service 
> (WebComponent.java:409)
> at com.sun.jersey.spi.