Programming Issues

Issues

java.lang.IllegalArgumentException: Could not resolve placeholder ‘message’ in value “${message}”

The spring boot application failed at startup with the exception java.lang.IllegalArgumentException: Could not resolve placeholder ‘message’. This exception is due to a simple discrepancy between application.properties and the spring boot annotation with in your code. Spring boot application validates the @Value annotation in spring boot environments at Startup. If the

The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

JSTL (JSP Standard tag library) supports common java operator functions, structural tasks including conditionals statements, looping structures. It also supports tags for editing XML documents, tags for localization and internationalization, and database operations like SQL query tags. Spring boot framework does not support jstl (JSP Standard tag library) tags by

“restartedMain” java.lang.reflect.InvocationTargetException: java.lang.AbstractMethodError

Spring boot application uses inversion of control to load all the dependency classes. Java supports the backward compatibility. If any issue occurred due to compatibility, the exception “java.lang.AbstractMethodError” will be thrown. In this post, the issue of java.lang.AbstractMethodError will be discussed Root Cause This problem occurs when some software is updated. If spring boot is upgraded to higher version

java.lang.AssertionError: Status expected: but was: in Junit test case Spring Boot

The Spring Boot MVC Controller returns a different HTTP status code compared to the intended HTTP status code in the Junit test case, then the Spring Boot Framework will throw this exception. Each status code indicates the type of the HTTP error. The issue will be resolved on the basis of the status code returned by the application server.  Root Cause The exception is thrown due

java.lang.AssertionError: Content type expected: but was: in Junit test case Spring Boot

We often see “Content type expected” error in unit test when testing spring boot MVC application. Spring boot test case makes a call to a web service.The Web service comes back with a response body. In response the test case expects content to be the same format. In Spring Boot,

java.lang.AssertionError: Content type not set in Junit test case Spring Boot

Junit test case returns “Content type not set” error when you are testing the Spring MVC Controller. The MVC controller returns a response that has no identified content type. The exception is as shown below. Root Cause The Junit test case expects the response content type while using the Spring

java.lang.AssertionError: No value at JSON path in JUnit

Spring boot MVC framework allows developers to write Junit test cases to test REST API. the rest api calls are tested using Junit with the help of MockMVC class. One of the common error in rest json is “No value at JSON path”. In this article, let us discuss on

java.lang.Exception No runnable methods

In spring boot junit test, the error “java.lang.Exception: No runnable methods” occurs because the junit framework does not find any test method with the @Test annotation in the test class. In the older version of the junit framework, the test method is identified with a method signature. The junit identifies

No qualifying bean of type ‘org.springframework.test.web.servlet.MockMvc’ available

In spring boot integration test, MockMvc throws NoSuchBeanDefinitionException on auto wire. MockMvc failed with an @autowired annotation in the spring boot test environment. In this article, we discuss the explanation for NoSuchBeanDefinitionExceptio: org.springframework.test.web.servlet.MockMvc, and the solution to fix this exception. Root Cause MockMvc is used to mock the mvc request

No qualifying bean of type org.springframework.web.context.WebApplicationContext available

WebApplicationContext creates a web environment to run a spring boot test class. If the WebApplicationContext bean is not available or is not created within the spring boot framework and the spring boot bean attempts to auto-wire this WebApplicationContext bean, this exception will be thrown by spring boot. Root Cause The

java.lang.IllegalArgumentException WebApplicationContext is required SpringRunner.class

In this post, we will explore the issue of loading the WebApplicationContext. The common issue is not loading the WebApplicationContext into the spring boot test environment. WebApplicationContext provides a web-based environment to run test cases. The WebApplicationContext is not required to run a spring boot console test. The web-based spring

Popup Message – No tests found with test runner JUnit5

The unusual Popup Message “No tests found with test runner ‘JUnit5’ ” is often seen when running test classes in spring boot application In eclipse, when you run the JUnit test case in your spring boot application, some time you’ll encounter a problem that eclipse can’t find any tests. In

java.lang.IllegalStateException ThreadPoolTaskScheduler not initialized

ThreadPoolTaskScheduler is used to create a thread pool that manages scheduler task. These threads will run periodically based on the time interval that has been configured. Configured parameters must be initialized before the schedulers are used. Root Cause The custom thread pool is created in the spring boot application. Schedulers

java.lang.IllegalArgumentException: ‘poolSize’ must be 1 or higher

By Default, the Spring boot scheduler runs using default thread pool of size one. ThreadPoolTaskScheduler allows to create a custom thread pool with any pool size. The size of the pool must be set to 1 or higher. The size of the pool must be set higher if you are

java.lang.IllegalStateException: Encountered invalid @Scheduled method ‘task’: Invalid time zone specification

The exception “java.lang.IllegalStateException: Encountered invalid @Scheduled method ‘task’: Invalid time zone specification”  is thrown in the spring boot scheduler on invalid time zone configured. Schedulers are the tasks that run at a certain interval on a regular basis. Spring boot offers good support for spring boot schedulers. It is possible to configure these schedulers as cron job. By default, cron time