Category Archives: springboot

javax.servlet.ServletException: Circular view path

Problem :

javax.servlet.ServletException: Circular view path [error]: would dispatch back to the current handler URL [/latestOrder] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)

Solution :

You’ve annotated the controller method as producing JSON or String or any other object . You probably want to annotate the method with @ResponseBody and change its return type to allow you to return an object representation of the JSON that you want to include in the response

  @RequestMapping(value="latestOrders",method = RequestMethod.GET)
public @ResponseBody List<Order> listProducts(Model model) throws JMSException{
List<Order> list=new ArrayList();
return list;

103 total views, no views today

Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.

I was hitting the same problem when working with Apache tomcat . .

Solution Steps :

  1. Backup your pom.xml somewhere.
  2. Go to your pom.xml and on the bottom tab and click “Dependency Hierarchy” tab. 
  3. From there search for log4j-over-slf4j. 
  4. Exclude all instances of this dependency (right click on the instance and “Exclude Maven Artifact”). After you have no more log4j-over-slf4j appearing save your POM and try to run the program. 
  5. If it still doesn’t work then undo the changes you just made and exclude all instances of slf4j-log4j12.

Hopes this will resolve your problem

75 total views, no views today

Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.2.3.RELEASE:repackage failed: Unable to find main class


Solution 1 :

You needed to change the packaging parameter to jar from pom. Also, the repositories, pluginRepositories, the maven-compiler-plugin and the spring-boot-maven-plugin’s version and executions weren’t needed.

Solution 2: 

Try mvn install and see if it works

Solution 3:

    <!-- The main class to start by executing java -jar -->
Solution 4:

Enable the main() method in your

Configure spring-boot-maven-plugin to specify the class with the main class (Spring should find it anyway if you have one, but good to be explicit):


72 total views, no views today

Required request body content is missing: org.springframework.web.method.HandlerMethod

You can’t send a request body with an HTTP GET request. You should modify your call so that it only supports POST, and POST your JSON to that endpoint.

If you want to GET information about a bean, you should create a separate controller method that does that (and does not require a request body).

Also, double-check your endpoint definitions  in the $.ajax call.

74 total views, no views today

exception is com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.json.JSONObject

Could not write content: No serializer found for class org.json.JSONObject and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )

controller methods return simple POJOs – Collection<Bookmark>, and Bookmark, etc., 

When an HTTP request comes in that specifies an Accept header, Spring MVC loops through the configured HttpMessageConverter until it finds one that can convert from the POJO domain model types into the content-type specified in the Accept header, if so configured.

Spring Boot automatically wires up an HttpMessageConverter that can convert generic Object’s to JSON, absent any more specific converter. HttpMessageConverter s work in both directions: incoming requests bodies are converted to Java objects, and Java objects are converted into HTTP response bodies.

To solve Exception just override the default behaivour of the HttpMessageConverter provided by spring.

public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
return jsonConverter;

This will do the trick for you.

76 total views, no views today

Caused by: java.lang.IllegalArgumentException: ‘dataSource’ or ‘jdbcTemplate’ is required

A Simple DAO class extends JdbcDaoSupport, but, unable to inject or @autowired a “dataSource”, the method setDataSource is final, can’t override.


To quickly fix it, uses @PostConstruct to inject the dataSource like this :

public class UserDetailsDaoImpl extends JdbcDaoSupport implements UserDetailsDao {

private DataSource dataSource;

private void initialize() {


Alternatively, create an own implementation of JdbcDaoSupport class, and do whatever you want. Dive inside the source code of JdbcDaoSupport, it’s just a simple helper class to create a jdbcTemplate.

Source :-

120 total views, no views today

org.hibernate.hql.internal.ast.querysyntaxexception: “table_name” is not mapped Spring boot

Put your in pl.test package and execute the application.

It is recommended by Spring Boot to run your application from the root package and all your entities, controllers,DAO’s and other service classes should be placed in child packages. This is not a hard and fast rule but it ensures all your subpackage annotated classes are scanned properly

In your case your User class is not scanned and Hibernate is not able to find the mapping for the same and eventually throwing the QuerySyntaxException when executing the from User query.

Currently Spring Boot will scan @Entity classes if they are placed in the same package or sub-packages where you specified the @SpringBootApplication annotation. Atleast, this is what I observed while developing spring boot apps lately.

If you do not want to move the location of the, then use 

@EntityScan(basePackages = "pl.test.model")

 annotation and this will fix the issue.

75 total views, no views today

spring boot controllers not initialized

Controllers are not initialize because you have not scan the packages for controller
add these lines in your main class.
If you are scanning a particular class for controller.
@ComponentScan(basePackageClasses = temInventoryController.class)
public class InventoryApp {
if you want to scan a whole package for controller add this.
@ComponentScan(basePackages = "com.home.controller")

65 total views, no views today

Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:

Exception :

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ’employeeController’: Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 
[javax.persistence.EntityManagerFactory] is defined

Solution :

you are scanning wrong package for controller class change your package declaration.

97 total views, no views today