Programming Issues

Issues

java.lang.IllegalArgumentException: URI is not absolute

java.lang. IllegalArgumentException: URI is not absolute occurs when a relative url is used to identify the resource. In the spring boot RestTemplate, the complete url will be used to invoke the rest call. If the relative url is used in the restful call, the java exception java.lang. IllegalArgumentException: URI is

Missing URI template variable for method parameter of type String

The spring boot exception Missing URI template variable for method parameter of type String occurs when the path variable name in the @RequestMapping annotation is different from the @PathVariable name. The name of the path variable should be the same in @RequestMapping and @PathVariable. If there is some mismatch, the exception Missing URI template variable for method parameter of type String would be thrown. The path variable is added as part of the request url in the @RequestMapping annotation. The path variable is covered by curly brackets. The path variable is added to the method parameter with a @PathVariable annotation. The name of the method parameter and the name of the path variable should be the same to avoid an exception Missing URI template variable ” for method parameter of type String. Exception The exception Missing URI template variable for method parameter of type String will be shown in the browser as below. The spring boot console log will be the exception as seen below. Root Cause The exception Missing URI template variable ” for method parameter of type String is triggered by the inconsistency of the path variable in the request url in the @RequestMapping annotation and the method variable name in the @PathVariable annotation.

Post a JSON data with curl

How to post a JSON data with curl – In this article, we can see about How to POST a JSON data with CURL, How to POST a JSON file with CURL, How to POST a JSON request using CURL to spring boot rest controller methods, How to POST a

UnsatisfiedDependencyException: Error creating bean with name defined in file

The spring boot exception org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name defined in file: Unsatisfied dependency expressed through field occurs when a problem occurs when a bean auto-wired on other beans that have not bean loaded in the spring boot application context. The exception org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name defined

BeanCreationException: Error creating bean with name

The spring boot exception org.springframework.beans.factory.BeanCreationException: Error creating bean with name happens when a problem occurs when the BeanFactory creates a bean. If the BeanFactory encounters an error when creating a bean from either bean definition or auto-configuration, the BeanCreationException will be thrown. The exception Error creating bean with name defined

BeanInstantiationException: Failed to instantiate

The spring boot exception BeanInstantiationException: Failed to instantiate happens when the bean can’t instantiate when auto-wiring in another bean. If the bean is instantiated in another bean, the bean either throws an exception or fails to create an object. BeanInstantiationException will be fired on runtime when the bean is created

BeanInstantiationException: Failed to instantiate: Factory method threw exception

The spring boot exception org.springframework.beans.BeanInstantiationException: Failed to instantiate: Factory method threw exception occurs when the abstract class could not find the implemented class while auto-wiring using the factory method. The implementation class of the abstract class cannot be created or is not available in the java classpath or is not

BeanCurrentlyInCreationException: Error creating bean with name: Requested bean is currently in creation

The spring boot exception BeanCurrentlyInCreationException: Error creating bean with name: Requested bean is currently in creation happens when two beans are in circular dependences with each other. If the bean A depends on another bean B and the bean B depends on the bean A, the BeanCurrentlyInCreationException will occur. When

BeanInstantiationException: Failed to instantiate: No default constructor found

The spring boot exception org.springframework.beans.BeanInstantiationException: Failed to instantiate: No default constructor found occurs when no default constructor is found in a bean when the bean is created. The bean is automatically wired using the @Autowired annotation. If an exception occurs in the bean, the bean will not be auto-wired. If

BeanInstantiationException: Failed to instantiate: Constructor threw exception

The spring boot exception org.springframework.beans.BeanInstantiationException: Failed to instantiate: Constructor threw exception occurs when the default constructor in a bean throws exception when the bean is created. The bean is auto-wired using the annotation @Autowired. If the bean throws exception, the bean could not be auto-wired. If the bean triggers an

NoUniqueBeanDefinitionException: No qualifying bean of type available: expected single matching bean but found 2:

The spring boot exception org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type available: expected single matching bean but found occurs when the bean is auto-wired that matches two or more loaded beans in the spring boot application context. When the bean is auto-wired in the spring boot, two or more beans are

Field in required a bean of type that could not be found

The spring boot exception Field in required a bean of type that could not be found occurs when a field in the class is auto-wired as a bean type that could not be found in the spring boot context. The auto-wired class will be injected in the spring boot when

Circular view path

The Circular view path error in spring boot occurs when the request mapping url and the model view url are the same in a rest controller method and no ViewResolver is configured. The check your viewresolver setup! error occurs because the view path url points to the request mapping annotation

java.lang.IllegalStateException: Ambiguous mapping. Cannot map method

The spring boot exception IllegalStateException: Ambiguous mapping. Cannot map method occurs when two methods in the rest controller class are configured with the same request mapping url. Two methods in the rest controller class should not be configured using the same url. The exception will be shown as BeanCreationException: Error

AnnotationConfigApplicationContext has not been refreshed yet

In the spring boot web application development, you may need to use Application Context to handle loaded beans.The Application context contains all the references to the loaded beans. Spring boot provides a handle for the context of the application. If you use the application context, you may encounter an error