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

  Рет қаралды 21,603

Gaurav Raj

Gaurav Raj

Күн бұрын

Пікірлер: 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.
@tapanradadiya3657
@tapanradadiya3657 2 жыл бұрын
Hello sir i cant able to find tomcat in my run/debug configurations please help me
@TuanNguyen-qh7pk
@TuanNguyen-qh7pk 2 жыл бұрын
Thanks a lot, you save my day :3
@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.
How to use Intellij communiti editor with tomcat and serlets
6:37
Vytas Gadliauskas
Рет қаралды 14 М.
Maven Complete Tutorial with IntelliJ
38:17
Programming Techie
Рет қаралды 127 М.
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
I tried 8 different Postgres ORMs
9:46
Beyond Fireship
Рет қаралды 441 М.
IntelliJ IDEA Beginner Tutorial | How to create Maven Project
9:23
Automation Step by Step
Рет қаралды 158 М.
Apache Tomcat Integration in IntelliJ IDEA and War file Deployment
9:03
Maven - How to integrate Apache Tomcat in IntelliJ IDEA and deploy a WAR file
8:03
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 900 М.
Tomcat in IntelliJ IDEA Ultimate
14:03
IntelliJ IDEA, a JetBrains IDE
Рет қаралды 117 М.
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН