Browsed by
Category: Errors and solutions

[Resolved] Spring boot JWT Filter called twice

[Resolved] Spring boot JWT Filter called twice

[Resolved] Spring boot JWT Filter called twice: Recently when I was integrating JWT Filter and Simple CORS filter in my spring boot project, I observed that both the filters are called twice before actually reaching my servlet/rest controller.   After googling, I got this link, As per that, One invocation is by servlet container and the other is by Spring Security, so the filter will get called twice. So by adding this line in your JWT Filter bean implementation registrationBean.setEnabled(false); only…

Read More Read More

554 total views, no views today

org.springframework.web.HttpMediaTypeNotAcceptableException | Could not find acceptable representation

org.springframework.web.HttpMediaTypeNotAcceptableException | Could not find acceptable representation

org.springframework.web.HttpMediaTypeNotAcceptableException | Could not find acceptable representation: Full Error details: {“timestamp”:1522250376646,”status”:406,”error”:”Not Acceptable”,”exception”:”org.springframework.web.HttpMediaTypeNotAcceptableException”,”message”:”Could not find acceptable representation”,”path”:”/category/deleteImage/google.png”}     As per this link, I found the solution for this issue:   Solution: @SpringBootApplication public class CouponzcornerBackendApplication { public static void main(String[] args) { SpringApplication.run(CouponzcornerBackendApplication.class, args); } @Configuration public static class PathMatchingConfigurationAdapter extends WebMvcConfigurerAdapter { @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { configurer.favorPathExtension(false); } } } 710 total views, 2 views today

710 total views, 2 views today

[Resolved] “org.springframework.web.HttpMediaTypeNotSupportedException” angular 5

[Resolved] “org.springframework.web.HttpMediaTypeNotSupportedException” angular 5

Hi All, Recently I came across this “org.springframework.web.HttpMediaTypeNotSupportedException” error while trying to hit my spring boot rest web services application from angular 5.   I am posting my experience because to help someone quickly. I almost cross checked all the places many times, but I could not find the below miss which I found at last and also do remember this error says that “HttpMediaTypeNotSupportedException”, so this error can happen due to incorrect media type/media type is not set or some…

Read More Read More

414 total views, no views today

Understanding & Resolving “Too many connections” Exception

Understanding & Resolving “Too many connections” Exception

Understanding & Resolving “Too many connections” Exception:   Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: “Too many connections” Issue Fix: Close the open connections properly, because too many open connection error indicates too many connections are opened but not closed. Existing Code which has the issue:   In the below code, finally block still has the code snippet to close the too many connections exception. But I did very badly, closing the connection by opening it…

Read More Read More

365 total views, no views today

[Solved] ReferenceError: KeyboardEvent is not defined

[Solved] ReferenceError: KeyboardEvent is not defined

[Solved] ReferenceError: KeyboardEvent is not defined This error happens due to lot of reasons. In my case I was getting this error while making my angular site to angular universal site for server side rendering and better SEO. But when I was trying to convert to angular universal I got this “ReferenceError: KeyboardEvent is not defined ” issue. In my case it was because of ngx-bootstrap component. In particular I used rating component from ngx-bootstrap and exactly in that module I…

Read More Read More

963 total views, no views today

[Solved] ERROR Error: No value accessor for form control with unspecified name attribute

[Solved] ERROR Error: No value accessor for form control with unspecified name attribute

[Solved] ERROR Error: No value accessor for form control with unspecified name attribute   This issue will occur due to lot of reasons, here I am writing my case to help someone, Issue: This issue happened with angular 4 cli + angular material 2 for me. I used mat-radio-button, mat-checkbox in my template page. But I missed to import the radio module and FormsModule in my app module. Solutions: Import all the respective modules in your module page [In this…

Read More Read More

1,656 total views, no views today

[Solved] Cannot read property ‘getSourceFile’ of null

[Solved] Cannot read property ‘getSourceFile’ of null

[Solved] Cannot read property ‘getSourceFile’ of null:   This error occurs due to lot of things, I just explained what happened in my case below, hope it helps some people. I generated a component named “store component” in two different places using the below comments by mistake, ng g c store one is under layout folder and other one is under layout/homepage folder. When I first generated ng g c store under layout/homepage it imported store component in layout.module. When…

Read More Read More

799 total views, no views today

[Solved] your global angular cli version is greater than your local version

[Solved] your global angular cli version is greater than your local version

[Solved] your global angular cli version is greater than your local version Root cause: If you have developed your angular-cli project in some version, say 1.0.3 in some machine and you are trying to build/compile in the other system which is having higher angular-cli version, say 1.4.2 then you will get this warning message “your global angular cli version is greater than your local version“.   But it is recommended to resolve this by installing npm with the below command…

Read More Read More

1,945 total views, no views today

[Solved] node sass could not find a binding for your current environment windows 64-bit with node.js 6.x

[Solved] node sass could not find a binding for your current environment windows 64-bit with node.js 6.x

[Solved] node sass could not find a binding for your current environment windows 64-bit with node.js 6.x Root cause: This issue will happen if you have moved your angular cli project from 32bit to 64bit environment. Ensure you are rebuilding the node-sass to resolve this issue.   Command to rebuild: npm rebuild node-sass   Issue Screenshot:     Fixing using rebuild command:     Now the issue resolved and ng serve compiles successfully:     Thanks for reading! 987 total views,…

Read More Read More

987 total views, no views today

[Resolved] java.util.LinkedHashMap cannot be cast to org.json.simple.JSONObject

[Resolved] java.util.LinkedHashMap cannot be cast to org.json.simple.JSONObject

[Resolved] java.util.LinkedHashMap cannot be cast to org.json.simple.JSONObject This issue may happen for various use cases, I have explianed my usecase with the explanation below, hope it helps someone. My JSON string / JSON response sample is: {“itemName”:”Amazon”,”id”:1}   Issue code: for(int i=0;i<selectedStoresJsonArray.size();i++){ JSONObject jsonObj = (JSONObject) selectedStoresJsonArray.get(i); if(null!=jsonObj.get(“itemName”) && !jsonObj.get(“itemName”).toString().isEmpty()){ tempSelectedStores.add(jsonObj.get(“itemName”).toString()); } }   Here JSONObject is not knowing the type of the response received while deserializing, so it is throwing this exception. Because by default json deserialize picks linkedhashmap…

Read More Read More

2,523 total views, 1 views today