Spring Boot Error
guys im trying to learn spring boot im creating my first project using postgresql as database and when i try to run the application i get this error how can i fix it : Database JDBC URL [Connecting through datasource 'HikariDataSource (HikariPool-1)']
Database driver: undefined/unknown
Database version: 17.2
Autocommit mode: undefined/unknown
Isolation level: undefined/unknown
Minimum pool size: undefined/unknown
Maximum pool size: undefined/unknown
40 Replies
⌛
This post has been reserved for your question.
Hey @om_100! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
That itself is not actually an error
Can you show the full logs?
Hey there my friend, Hey, @om_100 , please send me a picture of your
application.yml / application.properties
files from
src/main/resources
paththis is the full log :
looks perfectly fine
I don't see an issue here
i get this when i try to open localhost:8080 but normally i have to see the questions from my database
well, the page doesn't exist
Which page are you requesting and why should it exist?
im trying to open this url to display the questions from my database : http://localhost:8080/question/allQuestions
And why should that endpoint exist?
i found the solution for this thank you, but i still see the questions display like this and not actually displaying the questions from my database
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Can you show the endpoint code?
I cannot tell you anything about it without you providing any information about it
package com.telusko.quizapp.controller;
import com.telusko.quizapp.Question;
import com.telusko.quizapp.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("question")
public class QuestionController {
@Autowired
QuestionService questionService;
@GetMapping("allQuestions")
public List<Question> getAllQuestions() {
return questionService.getAllQuestions();
}
}
Please format your code to make it more readable. For java, it should look like this:
What exactly is
Question
?its another class this is the code : package com.telusko.quizapp;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.Data;
@Data
@Entity
public class Question {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Integer id;
private String questionTitle;
private String option1;
private String option2;
private String option3;
private String option4;
private String rightAnswer;
private String difficultylevel;
private String category;
}
Please format your code to make it more readable. For java, it should look like this:
I assume your main class is in
com.telusko
?my main class is QuizappApplication my main package is com.telusko.quizapp
ah yeah my fault - that should be fine
Can you show your dependencies?
You aren't using native-image, right?
no im not
.
I meant the pom.xml/build.gradle you are using
Can you check whether lombok works?
i cant send it here because its so long
Can you send it as a file?
<dependencies>
<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.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.4</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>
Can you show the full pom.xml including the <parent> and <build>?
you can just include an attachment
try to create the getters and setters in that class manually
I think Lombok isn't doing anything
or you could try something like
new Question().getOption1();
somewhere - I think it results in a compilation errorokay i will try it now
If that is the case, I think I know why and I can try helping you fix it - after that's confirmed
i created getter manually without setter and i got the option1 from database
ok yeah
So the issue is that Lombok broke with Java 23
in multiple ways
You need to ensure two things:
- You need to use the latest Lombok version
- You need to enable annotation processing
if you want to use Lombok
https://stackoverflow.com/a/79210588/10871900
Disclaimer: I wrote that
Stack Overflow
Build Failure: @Data Annotation won't regonize by Maven
I consider that my maven has problems with the annotation @Data from lombok.
About the project: Java 23 Spring Boot Version 3.3.4 also using Intellij ultimate
The error appears after like mvn comp...
otherwise just don't use lombok
thank you so much i will try these and see if lombok works
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.