Currently, I'm trying to run my Spring Boot project which was made previously. When I was making this project, My JDK version is 17 but now this JDK version is 11 because of AEM(ADOBE EXPERIENCE MANAGER) which is run on JDK 11 or lower version. Currently when I'm trying to run this project it will produce an error.
Here down is full stack trace
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[2m2023-02-21 12:49:14.134[0;39m [31mERROR[0;39m [35m10964[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.s.b.d.LoggingFailureAnalysisReporter [0;39m [2m:[0;39m
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
I tried with mvn clean
and mvn install
but still I'm facing a same issue.
Here down is my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>practice</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>practice</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Here down is my application.properties
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/demotesting545?createDatabaseIfNotExist=true
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.show-sql:true
server.port=9999
My problem is resolved. I'm doing a Maven clean
and Maven install
but I forget to do aMaven buid
.
Here down is a steps which is usefull for that who are changing his JDK version.
Maven clean
: It will clean the files and directories generated by Maven during its build.Maven build
: It will builds the Maven project.Maven install
: It will installs the project files to the local repository.How to build maven project in eclipse?
Right click on project -> Run As -> Maven Build
Now Edit Configuration
popup is open. In a Goals
field just type a package
. It will execute validate, compile, test, and package phases of the project.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments