When writing springMVC, after importing all required packages, run the program, the console reports the following error:
Critical: Servlet [springDispatcherServlet] in web application [/SpringMVC-1 ] threw load() exception java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java: 1333 ) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java: 1167 ) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java: 518 ) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java: 499 ) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java: 118 ) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java: 1091 ) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java: 1027 ) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java: 5038 ) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java: 5348 ) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java: 145 ) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java: 725 ) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java: 701 ) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java: 717 ) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java: 587 ) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java: 1798 ) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
You can’t import org.springframework.web.servlet.DispatcherServlet in a java file. This class is mainly under the spring-webmvc jar package. All imported jar packages are as follows:
All have been imported, there is no problem. But in fact, all dependencies must be added to the classpath. step:
Right-click the project–>properties–>Deployment Assembly–>add–>Java Build Path Entries–>import all dependent Jar packages and restart tomcat.
Read More:
- Start error in maven web project java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
- [Solved] springmvc:Error creating bean with name ‘org.springframework.cache.interceptor.CacheInterceptor
- How to Solve BANKEX/web3swift Error
- [Solved] swagger3 Error: org.springframework.context.ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException
- [Solved] org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource‘
- [Solved] Bat starts springboot project error: ERROR org.springframework.boot.SpringApplication -Application run failed
- How to Solve org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) Error
- Servlet.service() for servlet [dispatcherServlet] in context && Whitelabel Error Page
- [Solved] SpringBoot Project Start Error: No bean named ‘org.springframework.context.xxxxx.importRegistry‘ available
- org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [XXX.xml]‘;
- [Solved] org.springframework.dao.InvalidDataAccessApiUsageException: Error attempting to get column ‘Sage‘ fr
- [Solved] Error reported: org.springframework.validation.BeanPropertyBindingResult
- [Solved] Springboot Error: org.apache.catalina.core.ContainerBase : A child container failed during start
- SpringBoot Access Clickhouse Error: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘jdbcConverter’ defined in class path resource [***.class]
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘globalTransa
- How to Solve Spring MVC upload file error
- Gateway Error: Cannot resolve org.springframework.cloud:spring-cloud-starter-gateway:unknown
- How to Solve Spark Writes Hudi Error
- [Solved] Redis Cache Error: org.springframework.data.redis.serializer.SerializationException: Could not read JSON..