Programming Issues

Issues

Can’t login to my custom login page in Spring Boot Security

In the spring boot security application, when we try to login to the page. It redirects back to the login page. It doesn’t matter how many times we log in, it won’t allow us to go to the next page. In this post, we’re going to see this strange behavior,

Logout is not working in Spring Boot Security CSRF enabled

IIn the spring boot application, if the security module is configured with CSRF – Cross-Site Request Forgery, all requests are verified for a CSRF attack. In this case, the logout link does not work. If the CSRF is disabled in the security configuration, the logout link will work without any

IllegalStateException: permitAll only works with HttpSecurity.authorizeRequests()

In spring boot application, The exception “IllegalStateException: permitAll only works with HttpSecurity.authorizeRequests()” is thrown if the spring security is configured. In this post, we will see how this exception is thrown and how to fix this exception. When you try to configure web security by extending the WebSecurityConfigurerAdapter class, the

Whitelabel Error Page There was an unexpected error (type=Forbidden, status=403). Access Denied

The Access denied exception There was an unexpected error (type=Forbidden, status=403). Access Denied is a common exception seen in the browser when you access the url of the spring boot application. As stated, due to the restriction of access to the url, it refuses to serve you because you do

At least one mapping is required (i.e. authorizeRequests().anyRequest().authenticated())

Spring Boot security is one of the most requested features in the application. Security controls the user access page on the basis of the configured roles. In this post, we analyze this simple exception “At least one mapping is required (i.e. authorizeRequests().anyRequest().authenticated())” and how this exception can be resolved. This

There was an unexpected error (type=Internal Server Error, status=500).

When a restful web service call is made to a Spring Boot MVC application, It shows error “Whitelabel Error Page – There was an unexpected error (type=Internal Server Error, status=500).” in the browser. The Internal Server Error is a popular error in spring boot application if a server side error

There is no PasswordEncoder mapped for the id “null”

The exception “java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id “null”” occurs if the spring boot application is enabled with security feature and password encoder is not configured for encryption. Spring boot application does not allow the password to be used as plain text. The password encoder is necessary

Using generated security password Spring Boot Security

The log “Using generated security password:” appears in the startup of the spring boot application. This log is due to default security configuration. This can be disabled, removed or customized using configurations. If the spring boot security dependency is added to pom.xml, the security authentication of the spring boot application

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