1. Null pointer exception:
Request processing failed; nested exception is java.lang.NullPointerException java.lang.NullPointerException com.atguigu.mvc.controller.NodesController.getFilesAndSendId(NodesController.java:61)
See the exception address and check the control layer
Control level, line 61:
List<FilePath> files = fileService.getFiles();
current
@RequestMapping(value = "/getFilesAndSendId/{sensor_id}",method = RequestMethod.GET)
Parameter sensor_id is passed;
Solution to null pointer:
Original:
private FileService fileService;
Change to: add @Autowired annotation
@Autowired
private FileService fileService;
If there is any other error when you run the codes:
Servlet.init() of Servlet[DispatcherServlet] raises an exception. org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘nodesController’: Unsatisfied dependency expressed through field ‘fileService’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.atguigu.mvc.service.FileService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Solution:
Check if the @Service annotation is added to the implementation class here
Read More:
- [Solved] Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException
- [Solved] MultipartException: Failed to parse multipart servlet request; nested exception is java.lang.Runtime
- [Solved] Failed to start bean ‘eurekaAutoServiceRegistration‘; nested exception is java.lang.NullPointerExce
- [Solved] nacos Startup Error: nested exception is java.lang.RuntimeException: java.lang.RuntimeException: [db-load-error
- [Solved] swagger Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullP
- [Solved] Upload Files Error: Request processing failed;nested exception is org.springframework.web.multipart.MultipartExcepti
- Error resolution: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/Datatype
- [Solved] nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
- [Solved] Invocation of init method failed; nested exception is java.lang.NoSuchMethodError:
- nested exception is java.lang.StackOverflowError [How to Solve]
- [Solved] Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullPointerEx
- Java uses class array to report error Exception in thread “main” java.lang.NullPointerException solution
- [Solved] org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is
- [Solved] java: Internal error in the mapping processor: java.lang.NullPointerException
- I/O error while reading input message; nested exception is java.io.IOException: Stream closed
- [Solved] java Internal error in the mapping processor java.lang.NullPointerException
- [Solved] java Internal error in the mapping processor java.lang.NullPointerException
- [Solved] nested exception is org.flowable.common.engine.api.FlowableException: Error initialising dmn data mo
- [Solved] Tomcat Server Error: java.lang.NullPointerException Csonsole Error ClassNotFoundException: com.mysql.jdbc.Driver
- Tinyint error: java.lang.NullPointerException… [How to Solve]