current position:Home>com. fasterxml. jackson. databind. Objectmapper throw exception

com. fasterxml. jackson. databind. Objectmapper throw exception

2022-02-02 23:26:37 CSDN Q & A

serious : In the path /HotelSystem In the context of ,Servlet[com.city.jd.rest.controller.GuserLoginController] Of Servlet.service() An exception with a root cause was thrown Servlet The execution threw an exception
java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1407)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1215)
at com.city.jd.rest.controller.GuserLoginController.doGet(GuserLoginController.java:32)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:655)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at com.city.jd.filter.IpCheckFilter.doFilter(IpCheckFilter.java:42)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at com.city.jd.filter.AUTF8Filter.doFilter(AUTF8Filter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1726)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:831)
front end Vue.js Error after sending data

package com.city.jd.rest.controller;import java.io.IOException;import java.io.PrintWriter;import javax.servlet.ServletContext;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpSession;import com.city.jd.factory.ServiceFactory;import com.city.jd.model.GuserModel;import com.city.jd.result.Result;import com.city.jd.service.IGuserService;import com.fasterxml.jackson.databind.ObjectMapper;/** * Servlet implementation class GuserLoginController */@WebServlet("/api/guser/Login.do")public class GuserLoginController extends HttpServlet {    private static final long serialVersionUID = 1L;    /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {        Result<GuserModel> result=new Result<GuserModel>();        ObjectMapper mapper = new ObjectMapper();        IGuserService gs=ServiceFactory.createGuserService();        response.setContentType("application/json");        response.setCharacterEncoding("UTF-8");        PrintWriter out=response.getWriter();        String guser=request.getParameter("puser");        String gpassword=request.getParameter("password");        String status="false";        try {            status=gs.login(guser, gpassword);                                    result.setStatus(status);            result.setMessage(" Login successful ");                    String resultjson=mapper.writeValueAsString(result);        out.println(resultjson);        out.flush();        out.close();    }    /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {        // TODO Auto-generated method stub        doGet(request, response);    }}



Refer to the answer 1:

ObjectMapper mapper = new ObjectMapper();
java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper
Can't find this class .




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202022326351328.html

Random recommended