Posts

Access to XMLHttpRequest at 'http://localhost:8081/api/v1/employees' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Image
  Fix : Add the add cross controller to springboot controller class Ex : @CrossOrigin (origins = "http://localhost:3000/" )

Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]:

Image
 Error: org.springframework.beans.factory.BeanCreationException : Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException : Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] org.hibernate.boot.registry.selector.spi.StrategySelectionException : Unable to resolve name [org.hibernate.dialect.MYSQL5InnoDBDialect] as strategy [org.hibernate.dialect.Dialect] in my case, it was caused by this  spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MYSQL5InnoDBDialect instead of that you may use spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect The difference between MYSQL5InnoDBDialect and MYSQL5Dialect can be found by referring to this link : https://stackoverflow.com/questions/4368195/hibernate-wh

Error processing condition on org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.jpaVendorAdapter

Caused by nonmatching spring boot dependencies. when you get an error please check what is the required version. that will be displayed in the console.

$ git push orgin master fatal: 'orgin' does not appear to be a git repository fatal: Could not read from remote repository.

Image
GitHub tutorial I followed to upload my project:https://youtu.be/2vASHVT0qKc  tutorial I used to fix the above issue : https://youtu.be/H3KjgiBaakM when putting  git remote add origin YOUR URL some times it shows this error if you get it try checking with this command git remote --verbose this means you have already cloned a github project and now you gonna add it as an origin. so the fix is, instead of using  git remote add origin  YOUR URL , use below one git remote  set-url  origin  YOUR URL

"status": 404, "error": "not found", "message": "no message available", "path": "/api/employee"

Image
  first, make sure the YourController.java file that has the @Controller and the YourSpringBootFile.java file that has the @SpringBootApplication are in the same package. If you want your controller to be in a different package outside of YourSpringBootFile.java's package, then follow these instructions =  Spring: Run multiple "SpringApplication.Run()" in application main method There are 2 methods to overcome this Place the bootup application at the start of the package structure and rest all controllers inside it. Example : package com.spring.boot.app; - You bootup application(i.e. Main Method -SpringApplication.run(App.class, args);) You Rest Controller in with the same package structure Example: package com.spring.boot.app.rest; Explicitly define the Controller in the Bootup package. Method 1 is more cleaner. referred to:  https://stackoverflow.com/questions/31318107/spring-boot-cannot-access-rest-controller-on-localhost-404 https://stackoverflow.com/questions/3413520

There was an unexpected error (type=Not Found, status=404). No message available in Springboot

Image
 in my scenario, it was because I missed one of the dependencies. I referred to this :  https://stackoverflow.com/questions/36819277/issue-with-spring-there-was-an-unexpected-error-type-not-found-status-404 and got fixes it by adding the bellow code piece in pom.xml.           <dependency>         <groupId>org.apache.tomcat.embed</groupId>         <artifactId>tomcat-embed-jasper</artifactId>         <scope>provided</scope>     </dependency>     <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>