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
JavaBot
JavaBot•2mo ago
⌛ This post has been reserved for your question.
Hey @om_100! Please use /close or the Close 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.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st•2mo ago
That itself is not actually an error Can you show the full logs?
Amir Golmoradi
Amir Golmoradi•2mo ago
Hey there my friend, Hey, @om_100 , please send me a picture of your application.yml / application.properties files from src/main/resources path
om_100
om_100OP•2mo ago
No description
om_100
om_100OP•2mo ago
this is the full log :
dan1st
dan1st•2mo ago
looks perfectly fine I don't see an issue here
om_100
om_100OP•2mo ago
i get this when i try to open localhost:8080 but normally i have to see the questions from my database
No description
dan1st
dan1st•2mo ago
well, the page doesn't exist Which page are you requesting and why should it exist?
om_100
om_100OP•2mo ago
im trying to open this url to display the questions from my database : http://localhost:8080/question/allQuestions
dan1st
dan1st•2mo ago
And why should that endpoint exist?
om_100
om_100OP•2mo ago
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
No description
JavaBot
JavaBot•2mo ago
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.
dan1st
dan1st•2mo ago
Can you show the endpoint code? I cannot tell you anything about it without you providing any information about it
om_100
om_100OP•2mo ago
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(); } }
JavaBot
JavaBot•2mo ago
Please format your code to make it more readable. For java, it should look like this:
​`​`​`​java
public void foo() {

}
​`​`​`​
​`​`​`​java
public void foo() {

}
​`​`​`​
JavaBot
JavaBot•2mo ago
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();
}

}
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();
}

}
dan1st
dan1st•2mo ago
What exactly is Question?
om_100
om_100OP•2mo ago
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; }
JavaBot
JavaBot•2mo ago
Please format your code to make it more readable. For java, it should look like this:
​`​`​`​java
public void foo() {

}
​`​`​`​
​`​`​`​java
public void foo() {

}
​`​`​`​
dan1st
dan1st•2mo ago
I assume your main class is in com.telusko?
om_100
om_100OP•2mo ago
my main class is QuizappApplication my main package is com.telusko.quizapp
dan1st
dan1st•2mo ago
ah yeah my fault - that should be fine Can you show your dependencies? You aren't using native-image, right?
om_100
om_100OP•2mo ago
no im not
dan1st
dan1st•2mo ago
.
om_100
om_100OP•2mo ago
No description
dan1st
dan1st•2mo ago
I meant the pom.xml/build.gradle you are using Can you check whether lombok works?
om_100
om_100OP•2mo ago
i cant send it here because its so long
dan1st
dan1st•2mo ago
Can you send it as a file?
om_100
om_100OP•2mo ago
<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>
dan1st
dan1st•2mo ago
Can you show the full pom.xml including the <parent> and <build>? you can just include an attachment
om_100
om_100OP•2mo ago
dan1st
dan1st•2mo ago
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 error
om_100
om_100OP•2mo ago
okay i will try it now
dan1st
dan1st•2mo ago
If that is the case, I think I know why and I can try helping you fix it - after that's confirmed
om_100
om_100OP•2mo ago
i created getter manually without setter and i got the option1 from database
dan1st
dan1st•2mo ago
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
dan1st
dan1st•2mo ago
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...
dan1st
dan1st•2mo ago
otherwise just don't use lombok
om_100
om_100OP•2mo ago
thank you so much i will try these and see if lombok works
JavaBot
JavaBot•2mo ago
💤 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.

Did you find this page helpful?