Using Intellij, Maven, Tomcat, Java, JSP to create webpages

  Рет қаралды 20,206

Gaurav Raj

Gaurav Raj

3 жыл бұрын

Using Intellij, Maven, Tomcat, Java, JSP to create webpages
Tutorial referred in video: visionjava1.appspot.com/conte...
Github: github.com/rgbk21/Spring-Mave...

Пікірлер: 14
@radugribincea1423
@radugribincea1423 3 жыл бұрын
Hello sir Gaurav Raj!! I have the same problem like Sayanika Dutta ,Error instantiating servlet class [org.springframework.web.servlet.DispatcherServlet]" . can you help me please? I
@GauravRaj21
@GauravRaj21 3 жыл бұрын
Ok, I have figured out the issue and the error was on my side. I missed recording one part of the video. In order to solve the issue, you need to include the javax servlet api in your pom file. You can find the latest version here: mvnrepository.com/artifact/javax.servlet/javax.servlet-api The dependency was included in the github project, but looks like I forgot to record that part in my video. Let me know if you still face any issues after doing that. ****** The below is my understanding currently. But parts of it might be wrong. If you have any doubts about this, let me know. Why do you need to include the javax-servlet-api dependency separately? - javax.servlet is a package that's part of Java EE (Java Enterprise Edition). It's not in the JDK. - spring-webmvc also does not pull in javax library as a dependency. To pull in javax.servlet dependency, you need to include javax-servlet-api separately. - If we were using something like Spring Boot, we would not have to do this manually. Because Spring Boot uses the spring-boot-starter-web dependency, which automatically pulls in tomcat which in turn pulls in javax.servlet. Because we are not using Boot, we have to do this manually. A SO post that explains a bit here: stackoverflow.com/questions/860022/wheres-javax-servlet So if it was javax-servlet-api that was missing, why were we seeing an error in the instantiation of the DispatcherServlet which is a Spring class? - There are two things to unpack here. You were reading the error wrong. Note that the error that you were seeing (Error instantiating servlet class [org.springframework.web.servlet.DispatcherServlet]) is not just a single error, but an entire error stack. If you want to find the ROOT cause of the error, you have to scroll to the bottom of the page and see the bottom-most error. That is the ROOT cause. Every other error that is "on-top" of that is just being caused BECAUSE of the root cause. So the focus should always be on solving the ROOT cause. That should get rid of the other errors - You can verify that the DispatcherServlet does infact use the javax-servlet-api. You can do this in this way: once you have included the javax-servlet-api dependency in your project and rebuilt everything, search for the DispatcherServlet class. In that class you will find HttpServletRequest type. Now when you click on that type, it should take you to the package that that class belongs to and in that you can see javax.servlet.http which is a package in the javax-servlet-api. That is why the DispatcherServlet was throwing an error.
@radugribincea1423
@radugribincea1423 3 жыл бұрын
@@GauravRaj21 Thank you very much!!!!!!!!!!!!!!!!!!!!!!!!!!! I have fixed the problem!!!!!!!!!!!!! Thank youuuuuuuuuuuuuuuuuuuuu!!!!!!!!!!!
@karenestarly5276
@karenestarly5276 3 жыл бұрын
Chevere, me sirvio mucho tu ayuda para empezar a crear webpages con intellij y java, gracias.
@TuanNguyen-qh7pk
@TuanNguyen-qh7pk 2 жыл бұрын
Thanks a lot, you save my day :3
@tapanradadiya3657
@tapanradadiya3657 Жыл бұрын
Hello sir i cant able to find tomcat in my run/debug configurations please help me
@WillianSantos20
@WillianSantos20 2 жыл бұрын
Thank you
@challangebee4911
@challangebee4911 2 жыл бұрын
not working
@sayanikadutta3685
@sayanikadutta3685 3 жыл бұрын
I am getting an error message in /employee message:"Error instantiating servlet class [org.springframework.web.servlet.DispatcherServlet]" . Can you please help?
@GauravRaj21
@GauravRaj21 3 жыл бұрын
Are you getting the same error when trying to access the "/" path? If yes then it probably is due to missing dependencies. I have linked the github repo in the video description. Take a look at the pom and see what's missing. Browse the repo at the first commit. If you are able to see the "Hello World" message when you visit the "/" path, then that does not make much sense to me. In that case I would just start a new project and incrementally make changes with testing at each step to isolate the issue. Hope this helps.
@radugribincea1423
@radugribincea1423 3 жыл бұрын
Hello, did you solved the problem , sir?
@GauravRaj21
@GauravRaj21 3 жыл бұрын
Sorry I think this was my error. I have written the solution while answering Radu Gribincea in the comment section. You can check it out if you want and let me know if you are still facing the issue or not.
@GauravRaj21
@GauravRaj21 3 жыл бұрын
@@radugribincea1423 Please see my comment above.
IntelliJ IDEA Full Course
2:35:00
Amigoscode
Рет қаралды 805 М.
Amazing weight loss transformation !! 😱😱
00:24
Tibo InShape
Рет қаралды 58 МЛН
Iron Chin ✅ Isaih made this look too easy
00:13
Power Slap
Рет қаралды 35 МЛН
Apache Tomcat Integration in IntelliJ IDEA and War file Deployment
9:03
[2023]: Selenium + Java + Maven +  TestNg in Intellij setup
1:11:35
Ace Automation Academy
Рет қаралды 31 М.
How to Run Java Web Project in IntelliJ IDEA
16:32
Code Java
Рет қаралды 41 М.
I learned to code from scratch in 1 year. Here's how.
41:55
Thomas Frank
Рет қаралды 382 М.
Create your FIRST CRUD RESTful API - Java, MySQL, Springboot, JPA, & Maven
18:38
Spring Boot Tutorial | Full Course [2023] [NEW]
1:37:31
Amigoscode
Рет қаралды 2,7 МЛН
Top 25 Microservice Interview Questions Answered - Java Brains
39:54