Issues
o.s.boot.SpringApplication: Application run failed, java.lang.IllegalArgumentException: null – @Scheduled Method
The spring boot @Scheduled method is not working and throws Application run failed, java.lang.IllegalArgumentException: null exception if the scheduler is configured with an invalid value in the @Scheduled annotation. The @Scheduled annotation is configured for two arguments, fixedRate and fixedDelay. If the argument is set to an invalid value, the
Encountered invalid @Scheduled method ‘task’: Exactly one of the ‘cron’, ‘fixedDelay(String)’, or ‘fixedRate(String)’ attributes is required
The Exactly one of the ‘cron’, ‘fixedDelay(String)’, or ‘fixedRate(String)’ attributes is required exception occurs when an invalid value is provided in cron or fixedDelay(String) or fixedRate(String) in the @Scheduled annotation. The @Scheduled annotation requires exactly one of the attribute cron or fixedDelay(String) or fixedRate(String). The exception Encountered invalid @Scheduled method
restartedMain Unresolved compilation problem
Spring boot application loads all the beans using bean factory. If any error occurred while invoking the java classes, this exception is thrown Exception Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) Caused by: java.lang.Error: Unresolved compilation problem: SpringApplication
Unable to open JDBC Connection for DDL execution
The spring boot application creates database connection in startup. The EntityManager class is responsible for basic CRUD database operation. If the creation of EntityManger is failed, then this error is shown Exception 2019-10-07 13:46:48.751 ERROR 5068 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name
HikariPool-1 – Exception during pool initialization. java.sql.SQLSyntaxErrorException: Access denied for user ‘root’@’localhost’ to database
The exception “java.sql.SQLSyntaxErrorException: Access denied for user ‘root’@’localhost’ to database ‘testdb’” is thrown if you are using mysql database first time or newly installed. If you start the spring boot application, the jpa will try to create a database conection pool. If any error is thrown from the database, this
Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured. Reason: Failed to
Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured exception occurs when the datasource url is not configured in the spring boot application.properties. The spring boot reason is Reason: Failed to determine a suitable driver class in the spring boot application. The
CONDITION EVALUATION DELTA spring boot console log Positive matches Negative matches Exclusions Unconditional classes
CONDITION EVALUATION DELTA is a feature by spring boot developer tool which evaluates bean changes. The spring boot developer tool evaluate the spring boot application on inititalization. CONDITION EVALUATION DELTA comprises four types of information namely Positive matches, Negative matches, Exclusions and Unconditional classes On every restart, spring boot application shows
@ConditionalOnMissingBean did not find any beans (OnBeanCondition)
The spring boot application runs on auto configuration mode. On a configuration change, that matches a dependent class but not loaded in the bean factory. Auto Configuration Report Root Cause If the spring boot application configuration has changed and if @ConditionalOnMissingBean matches the condition and the bean is not loaded
ConditionalOnClass found required class
If auto configuration is enabled in spring boot application and the ConditionalOnClass property is modified, the dependent class shows in auto configuration report Auto Configuration Report Negative matches: JpaBaseConfiguration.JpaWebConfiguration: Did not match: - @ConditionalOnProperty (spring.jpa.open-in-view=true) found different value in property 'open-in-view' (OnPropertyCondition) Matched: - @ConditionalOnClass found required class 'org.springframework.web.servlet.config.annotation.WebMvcConfigurer' (OnClassCondition)
ConditionalOnProperty found different open-in-view
If spring boot application is running and any of the property configuration is modified in configuration files like application.properties, This auto configuration report will be shown in console log. Auto Configuration Report Negative matches: JpaBaseConfiguration.JpaWebConfiguration: Did not match: - @ConditionalOnProperty (spring.jpa.open-in-view=true) found different value in property 'open-in-view' (OnPropertyCondition) Positive matches:
spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this
In Spring boot, by default OSIV (Open Session in View) is enabled. As OSIV affects the connection and performance of the database, this warning log will be displayed when starting the spring boot application. Exception 2019-10-05 16:32:06.548 WARN 3840 --- [ restartedMain] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore,
java.util.NoSuchElementException: No value present
The java.util.NoSuchElementException: No value present error occurred in spring boot application when an entity object is being attempted to get it from an optional object. If the hibernate returns an empty optional object, this exception Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested
Request method ‘GET’ not supported – Http Status 405
The spring boot exception Request method ‘GET’ not supported exists when the request method is not configured as ‘GET’ in one of the rest controller methods and is requested using the HTTP GET method. The request method is configured in annotation @RequestMapping. In spring boot, all HTTP request methods are
No default constructor for entity
The spring boot error No default constructor for entity occurs in an entity class which does not have a default constructor. The hibernate uses the default constructor method to create a bean class. Hibernate fails to create entity classes unless there is a default constructor. Therefore, throws exception org.hibernate.InstantiationException: No entity default constructor. The default constructor is
Required string parameter is not present
The spring boot error Required string parameter is not present occurs when the request parameter is not stated in the request url and the request parameter is configured as mandatory. The controller method needs to provide a value for the request parameter. The invoked url does not contain the value