Browsed by
Category: Errors and solutions

Developers Repeated Mistakes

Developers Repeated Mistakes

In this post we are going to discuss about the repeated mistakes of developers during design/implementation/planning etc. This is just a sudden thought process, so this post will grow on my day to day experience and research wise only. Feel free to comment your repeated mistakes to add it to this master list. In Hibernate/Databases: While creating/planning a column for description, we forget to define the length of values it can hold or even forget to think such scenarios. So…

Read More Read More

102 total views, no views today

[Solved] Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

[Solved] Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Full Error: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by   Root cause: This exception comes when we try to run the query with few fields in the select, but only one group by column field   Resolution: This issue comes in mysql 5.7, run the below command to disable the only_full_group_by in mysql:…

Read More Read More

142 total views, 4 views today

SOLVED: Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate appropriate constructor on class

SOLVED: Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate appropriate constructor on class

SOLVED: Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate appropriate constructor on class: Root cause: If you are trying to populate result sets directly to your custom bean (not entity bean) then you must have public default constructor in your bean. See the below sample snippet to understand better.   Example: @Query(“SELECT new com.ngdeveloper.dto.SlugCountBean(t.tagSlug, count(c)) FROM Coupon c join c.tags t where c.couponEndDate >=CURRENT_DATE and t.tagType=:tagType GROUP BY t.tagSlug”) List<SlugCountBean> findCouponCountsTagWise(@Param(“tagType”) String tagType);   SlugCountBean.java Bean | which is causing the issue:…

Read More Read More

192 total views, no views today

SOLVED: ng serve throws Could not find module “@angular-devkit/build-angular”

SOLVED: ng serve throws Could not find module “@angular-devkit/build-angular”

SOLVED: ng serve throws Could not find module “@angular-devkit/build-angular”: Resolution: npm install @angular-devkit/build-angular (or) remove node_modules folder completely and run npm install command then try ng serve. 179 total views, 6 views today

179 total views, 6 views today

[Solved] JSON parse error: (was java.lang.NullPointerException); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain:

[Solved] JSON parse error: (was java.lang.NullPointerException); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain:

[Solved] JSON parse error: (was java.lang.NullPointerException); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: Full Exception: {“timestamp”:”2018-09-21T12:25:44.365+0000″,”status”:400,”error”:”Bad Request”,”message”:”JSON parse error: (was java.lang.NullPointerException); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: com.ngdeveloper.entities.Coupon[\”store\”]->com.ngdeveloper.entities.Store[\”description\”])”,”path”:”/ngdeveloper/api/rest/coupon/add”}   Solution: By default jackson tries to serialize the class as well as all the fields of the class, so you could have got the null pointer exception. Add @JsonIgnore to your getter method, here I resolved like this, @JsonIgnore public Set<Description> getDescription() { return description; }…

Read More Read More

254 total views, no views today

[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

674 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); } } } 844 total views, no views today

844 total views, no 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

469 total views, 3 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

410 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

1,055 total views, no views today