Category Archives: How to Fix

Apache service failed to start, semaphore not released

1. Apache failure

Because Apache has been hot deployed with reload before, some mutex semaphores may not be released, resulting in unable to apply. Sometimes, Apache will fail to start/load, and some errors will be reported as follows — & gt;

root@lry httpd]# tail error_log
[Mon Jun 28 16:34:28.797261 2021] [core:notice] [pid 31927] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Mon Jun 28 16:34:28.799903 2021] [suexec:notice] [pid 31927] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Jun 28 16:34:28.816970 2021] [core:emerg] [pid 31927] (28)No space left on device: AH00023: Couldn't create the proxy mutex 
[Mon Jun 28 16:34:28.818127 2021] [proxy:crit] [pid 31927] (28)No space left on device: AH02478: failed to create proxy mutex
[Mon Jun 28 16:34:28.818141 2021] [:emerg] [pid 31927] AH00020: Configuration Failed, exiting
[Mon Jun 28 16:37:30.133663 2021] [core:notice] [pid 32151] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Mon Jun 28 16:37:30.134915 2021] [suexec:notice] [pid 32151] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Jun 28 16:37:30.147614 2021] [core:emerg] [pid 32151] (28)No space left on device: AH00023: Couldn't create the proxy mutex 
[Mon Jun 28 16:37:30.147647 2021] [proxy:crit] [pid 32151] (28)No space left on device: AH02478: failed to create proxy mutex
[Mon Jun 28 16:37:30.147667 2021] [:emerg] [pid 32151] AH00020: Configuration Failed, exiting

2. Solutions

Then execute the following statement to release the synchronization semaphore

ipcs | grep apache | awk  '{print $2}'  >  signal.txt
for  i  in  `cat  signal.txt` ;  do  { ipcrm -s $i; } ;  done;

3. Restart Apache again

The local web page in WebView failed to load with XMLHttpRequest

Problem description

When using WebView to display local web pages, if developers use XMLHttpRequest to load additional local files, the following error messages will appear on some mobile phones:

Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'file:///asset/content.txt'

Cause of the problem

The reason for this error is that Android, based on security considerations, has prohibited local web pages in WebView from using XMLHttpRequest to read local files since Android version 4.1. As a result, “phones before Android 4.1” can use XMLHttpRequest normally, while “phones after Android 4.1” cannot use XMLHttpRequest normally.

Solution

Use the “allowfileaccessfromfileurls” method provided by WebView to restart the function of XMLHttpRequest to read files. Subsequent local web pages executed in WebView can normally use XMLHttpRequest to read local file contents.

// WebSettings
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
   settings.setAllowFileAccessFromFileURLs(true);
}

Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

The following error occurred in Maven install because the testsendattachmentsmail method did not pass the test

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.032 sec

Results :

Tests in error: 
  testSendAttachmentsMail(com.weichen.house.biz.service.impl.MailSeviceImplTest): Failed messages: javax.mail.MessagingException: IOException while sending message;(..)

Tests run: 6, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] house-parent 1.0.0-SNAPSHOT ........................ SUCCESS [  0.446 s]
[INFO] house-common ....................................... SUCCESS [  3.833 s]
[INFO] house-biz .......................................... SUCCESS [  1.927 s]
[INFO] house-web 1.0.0-SNAPSHOT ........................... FAILURE [ 24.759 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.540 s
[INFO] Finished at: 2021-06-28T21:10:04+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project house-web: There are test failures.
[ERROR] 
[ERROR] Please refer to H:\Fangdichang\MyprojectWorkSpace\house\house-web\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project house-web: There are test failures.

Please refer to H:\Fangdichang\MyprojectWorkSpace\house\house-web\target\surefire-reports for the individual test results.
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

Please refer to H:\Fangdichang\MyprojectWorkSpace\house\house-web\target\surefire-reports for the individual test results.
	at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:83)
	at org.apache.maven.plugin.surefire.SurefirePlugin.writeSummary(SurefirePlugin.java:176)
	at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:150)
	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:650)
	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:586)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	... 20 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :house-web

TypeError: Failed to execute ‘fetch‘ on ‘Window‘: Request with GET/HEAD method cannot have body.

Swagger error:

TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body.

reason:

The @ ResponseBody is used. Because the get method is declared in the method, the @ requestbody is used  
Get cannot get parameters using.

solve:

Getmapping   Change to postmapping

Failed to resolve: com.se renegiant:common 1.5.20

Then we found another more simple and effective way

1. From http://download.csdn.net/download/qq_ 38355313/12156696 download the common package you need

2. Directly put the required module into the LIBS folder

3. Add the original

implementation fileTree(include: ['*.jar'], dir: 'libs')

Change to

implementation fileTree(include: ['*.jar','*.aar'], dir: 'libs') 

This problem can be solved, and the pro test is effective.

CMake Error: The source directory “opencv_install_catalog“ does not appear to contain CMakeLists.txt.

Cmake error: the source directory “opencv installation directory” does not appear to contain cmakelists.txt

I want to build opencv 4.5.0 in Ubuntu 20.04 this morning; In the C + + environment, I tried to learn opencv in the Linux system, but I was not familiar with the use of Linux system. I was puzzled by one step in building the environment, and the error was as follows:

Cmake error: the source directory “opencv installation directory” does not appear to contain cmakelists.txt

In Baidu search, we found many solutions provided by big men. After some attempts, we failed collectively. After carefully studying the reasons for the error and checking our opencv installation directory, we found that the specific path of our cmakelists.txt is "home"/ ××××/ Opencv/opencv master/cmakelists.txt " instead of " home/ ×××/ Opencv/cmakelists. TXT ", finally found the cause of the error and solved the problem. Therefore, I hope this article can help some beginners like me. Thank you for your support!

@Controlleradvice exception [How to Solve]

ControllerAdvice

 @ControllerAdviceSpring 3.2 provides a new annotation, which is a Controller enhancer that adds some logic to the methods annotated by @RequestMapping in the controller. The most common one is exception handling

2: @controlleradvice with exception handler

When throwing exceptions to the controller, you can unify the exception handling by specifying the returned json format or jumping to an error page

3: Examples

@Slf4j
 @ControllerAdvice
 public class ExceptionHandlerAdvice {

     @ResponseStatus(HttpStatus.OK)
     @ResponseBody
     @ExceptionHandler({MethodArgumentNotValidException.class})
     public <T> ResponseEntity<ResultDTO<T>> handleBusinessException(MethodArgumentNotValidException method) {
         String defaultMessage = method.getBindingResult().getFieldError().getDefaultMessage();
         log.error("Error in parameters: {}", defaultMessage);
         return ResponseEntity.ok(ResultDTO.getErrorResult(defaultMessage));
     }

     @ResponseStatus(HttpStatus.OK)
     @ResponseBody
     @ExceptionHandler(ValidationException.class)
     public <T> ResponseEntity<ResultDTO<T>> handleBusinessException(ValidationException exception) {
         String defaultMessage = exception.getMessage();
         log.error("Error in parameters,{}", defaultMessage);
         return ResponseEntity.ok(ResultDTO.getErrorResult(defaultMessage));
     }
 }

Ng Zorro antd file stream upload, access to upload file path

HTML page

<nz-upload 
        nzAccept="application/pdf,image/jpeg,image/jpg,image/png"
        [(nzFileList)]="fileList"
        [(nzAction)]="UPLOAD_FILE"
        [nzShowButton]="fileList.length < 1"
        [nzBeforeUpload]="beforeUpload"
        (nzChange)="getFileUrl($event)" >
        <button nz-button>
            <i nz-icon nzType="upload"></i>
            <span>upload files</span>            
        </button>
</nz-upload>

TS file

 import { Component, OnInit } from '@angular/core';
 import { NzMessageService, NzModalService, UploadFile } from 'ng-zorro-antd';
    
 @Component({
     selector: 'app-detail',
     templateUrl: './detail.component.html',
     styleUrls: ['./detail.component.scss']
 })
 export class DetailComponent implements OnInit {
  	UPLOAD_FILE = ''; // File upload path
    constructor(
         private activeRoute: ActivatedRoute,
         private msg: NzMessageService,
         private router: Router,
         private message: NzModalService,
    ){ }
              
    fileList: UploadFile[] = [];
  	beforeUpload = (file: UploadFile): boolean => {
         // Judgment on the upload file type
         const type = file.type;
               
         const str = ['application/pdf', 'image/jpg', 'image/jpeg', 'image/png'];
              if (str.indexOf(type) < 0) {
                  this.message.warning({
                      nzTitle: 'Warning',
                      nzContent: 'Select file failed, only pdf, jpg, jpeg, png and other formats are supported'
                  });
                  return false;
              }
              // Limit on upload file size
              const isLt20M = file.size / 1024 / 1024 < 30;
              if (!isLt20M) {
                  this.message.warning({
                      nzTitle: 'Warning',
                      nzContent: 'The file must be less than 30M'
                  });
                  return false;
              }
              this.fileList = this.fileList.concat(file);
              // When the type and size meet the requirements, upload directly; if return false, then you need to call the upload method manually
              return true;
          }
          // Method to get the path when the file upload is finished     	 
      getFileUrl({ file, fileList }): void {
              const status = file.status;
              if (status === 'done') {
                this.zizhi_prove = file.response.data
              } else if (status === 'error') {
                this.msg.error(`${file.name} file upload failed.`);
              }
        }
  	}

Serverlet: How to Add, Delete, Modify and Query item code

Serverlet project code

Define database connection closure

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.PreparedStatement;
import java.sql.*;

public class DBManager {
	
	private static final String DRIVERNAME = "com.mysql.jdbc.Driver";
	private static final String URL = "jdbc:mysql://127.0.0.1:3306/bbs?useUnicode=true&characterEncoding=utf8";
	private static final String USERNAME = "root";
	private static final String USERPWD = "123456";
	
	public Connection getconn() throws ClassNotFoundException, SQLException {
		Class.forName(DRIVERNAME);
		Connection conn=DriverManager.getConnection(URL,USERNAME,USERPWD);
		System.out.print("DB Success!!");
		return  conn;
		
	}
	
	public void closeAll(ResultSet rs,PreparedStatement pstmt,Connection conn) throws SQLException {
			if(rs!=null) {
				rs.close();
			}
			if(pstmt!=null) {
				pstmt.close();
			}
			if(conn!=null) {
				conn.close();
			}
	}	
}

Add, delete, change and search (BaseDao)

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 * 
 * @author Administrator
 *General method of adding, deleting and checking
 */
public class BaseDao {

	public boolean insert_update_del(String sql,Object val[]) throws ClassNotFoundException, SQLException {
		boolean flag=false;
		Connection con=new DBManager().getconn();
		PreparedStatement pstmt=con.prepareStatement(sql);
		if(val!=null) {
			for(int i=0;i<val.length;i++) {
				pstmt.setObject(i+1, val[i]);
			}			
		}	
		if(pstmt.executeUpdate()>0) {
			flag=true;
		}
		return flag;
	}
	
	public ResultSet query(String sql,Object val[]) throws ClassNotFoundException, SQLException {
		boolean flag=false;
		Connection con=new DBManager().getconn();
		PreparedStatement pstmt=con.prepareStatement(sql);
		if(val!=null) {
			for(int i=0;i<val.length;i++) {
				pstmt.setObject(i+1, val[i]);
			}			
		}	
		ResultSet rs=pstmt.executeQuery();
		return rs;
	}
}

Inherit, add, delete, modify and query

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class StudentsDao extends BaseDao{
	
	public boolean regeditStudent(Student stu) throws ClassNotFoundException, SQLException {
		String sql="insert into students values (null,?,?)";
		Object[] val= {stu.getSname(),stu.getSpwd()};
		return insert_update_del(sql,val);
	}
	
	public List<Student> quaryAll() throws ClassNotFoundException, SQLException{
		List<Student> list=new ArrayList<Student>();
		String sql="select * from students";
		Object[] val= {};
		ResultSet rs=query(sql,val);
		while(rs.next()) {
			Student stu=new  Student();
			stu.setSid(rs.getInt("sid"));
			stu.setSname(rs.getString("sname"));
			stu.setSpwd(rs.getString("spwd"));
			list.add(stu);
		}
		return list;
	}
	public Student queryById(int sid) throws ClassNotFoundException, SQLException {
		Student stu=new Student();
		String sql="select * from students where sid=?";
		Object[] val= {sid};
		ResultSet rs=query(sql,val);
		while(rs.next()) {
			stu.setSid(rs.getInt("sid"));
			stu.setSname(rs.getString("sname"));
			stu.setSpwd(rs.getString("spwd"));
		}
		return stu;
	}
	public boolean updateStudent(Student stu) throws ClassNotFoundException, SQLException {
//		Student stu=new Student();
		String sql="update students set sname=?,spwd=?where sid=?";
		Object[] val= {stu.getSname(),stu.getSpwd(),stu.getSid()};
		if(insert_update_del(sql,val)) {
			return true;
		}
		else {
			return false;
		}
	}
}

RegeditServlet

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class RegeditServlet
 */
@WebServlet("/RegeditServlet")
public class RegeditServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public RegeditServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	/**
	 * @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);
		System.out.println("Welcome……");
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		
		String sname=request.getParameter("uname");
		String spwd=request.getParameter("upwd");
		Student stu=new Student();
		stu.setSname(sname);
		stu.setSpwd(spwd);
		try {
			if(new StudentsDao().regeditStudent(stu)) {
//				response.sendRedirect("success.jsp");
				response.sendRedirect("queryAllServlet");
			}else {
				response.sendRedirect("error.jsp");
			}
		} catch (ClassNotFoundException | SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}

Registration page (regedit)

<%@ page language="java" contentType="text/html; charset=utf-8"
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<h1>User registration page</h1>
	<form action="regeditservlet" method="post">
		<p>ursename:<input type="text" name="uname"/></p>
		<p>password:<input type="password" name="upwd"/></p>
		<input type="submit" value="register"/>
		
	</form>

</body>
</html>

Error page

<%@ page language="java" contentType="text/html; charset=utf-8"
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<h1>Failed to register</h1>
</body>
</html>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/Demo4.xsd" id="WebApp_ID" version="3.1">
  <display-name>Demo4</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>regeditservlet</servlet-name>
    <servlet-class>aaa.com.RegeditServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>regeditservlet</servlet-name>
    <url-pattern>/regeditservlet</url-pattern>
  </servlet-mapping>
  
  <!--Add additional content here -->

</web-app>

EditServlet

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class EditServlet
 */
@WebServlet("/EditServlet")
public class EditServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public EditServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
//		response.getWriter().append("Served at: ").append(request.getContextPath());
	}

	/**
	 * @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);
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		
		try {
			int sid=Integer.parseInt(request.getParameter("uid"));
			String sname=request.getParameter("uname");
			System.out.println(sname);
			String spwd=request.getParameter("upwd");
			System.out.println(spwd);
			Student stu=new Student();
			stu.setSid(sid);
			stu.setSname(sname);
			stu.setSpwd(spwd);
		
			if(new StudentsDao().updateStudent(stu)) {
				response.sendRedirect("queryallservlet");
			}else {
				response.sendRedirect("error.jsp");
			}
		} catch (ClassNotFoundException | SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}

QueryAllServlet

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class QueryAllServlet
 */
@WebServlet("/queryAllServlet")
public class QueryAllServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public QueryAllServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		try {
			List<Student> list=new StudentsDao().quaryAll();
			request.setAttribute("list", list);
			request.getRequestDispatcher("show.jsp").forward(request, response);
		} catch (ClassNotFoundException | SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}

Show page

<%@ page language="java" contentType="text/html; charset=utf-8"
    %>
<%@ page import="java.util.*" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<h1>User Information Details</h1>
<table>
<tr>
	<td>num</td>
	<td>name</td>
	<td>password</td>
	<td>Operation</td>
<tr>

<c:forEach var="stu" items="${list}" step="1">
<tr>
	<td>${stu.sid}</td>
	<td>${stu.sname}</td>
	<td>${stu.spwd}</td>
	<td><a href="updateservlet?sid=${stu.sid}">修改</a>|<a href="delserverlet?sid=${stu.sid}">删除</a></td>
<tr>
</c:forEach>


</table>
</body>
</html>

web.xml

  <servlet>
    <servlet-name>editservlet</servlet-name>
    <servlet-class>aaa.com.EditServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>editservlet</servlet-name>
    <url-pattern>/editservlet</url-pattern>
  </servlet-mapping>

web.xml

  <servlet>
    <servlet-name>queryallservlet</servlet-name>
    <servlet-class>aaa.com.QueryAllServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>queryallservlet</servlet-name>
    <url-pattern>/queryallservlet</url-pattern>
  </servlet-mapping>

UpdateServlet

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class UpdateServlet
 */
@WebServlet("/updateServlet")
public class UpdateServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public UpdateServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
//		response.getWriter().append("Served at: ").append(request.getContextPath());
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		int sid=Integer.parseInt(request.getParameter("sid"));
		System.out.println(sid);
		Student stu=new Student();
		try {
			stu=new StudentsDao().queryById(sid);
			request.setAttribute("stu", stu);
			request.getRequestDispatcher("update.jsp").forward(request, response);
//			System.out.println(stu.sid);
		} catch (ClassNotFoundException | SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}

Modify page

<%@ page language="java" contentType="text/html; charset=utf-8"
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<h1>user update</h1>
	<form action="editservlet" method="post">
		<p>number:<input type="text" name="uid" readonly="readonly" value="${stu.sid}"/></p>
		<p>username:<input type="text" name="uname" value="${stu.sname}"/></p>
		<p>password:<input type="password" name="upwd" value="${stu.spwd}"/></p>
		<input type="submit" value="modify"/>
		
	</form>
</body>
</html>

web.xml

  <servlet>
    <servlet-name>updateservlet</servlet-name>
    <servlet-class>aaa.com.UpdateServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>updateservlet</servlet-name>
    <url-pattern>/updateservlet</url-pattern>
  </servlet-mapping>

SubServer

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class DeleteServlet
 */
@WebServlet("/DeleteServlet")
public class DeleteServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DeleteServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
//		response.getWriter().append("Served at: ").append(request.getContextPath());
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		int sid = Integer.parseInt(request.getParameter("sid"));
		Student stu=new Student();
		stu.setSid(sid);
		try {
			if(new StudentsDao().deleteStudent(sid)) {
				response.sendRedirect("queryAllServlet");
			}else {
				response.sendRedirect("error.jsp");
			}
		} catch (ClassNotFoundException | SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}

web.xml

  <servlet>
    <servlet-name> delserverlet</servlet-name>
    <servlet-class>aaa.com.DelServerlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>delserverlet</servlet-name>
    <url-pattern>/delserverlet</url-pattern>
  </servlet-mapping>

[Solved] Flowable Start Error: ClassCastException: java.time.LocalDateTime cannot be cast to java.lang.String

Springboot2 + MySQL integrated flowable6.6.0, failed to start

In liquibase.changelog.standardchangeloghistoryservice, there is such a code:

Object tmpDateExecuted = rs.get("DATEEXECUTED");
    Date dateExecuted = null;
    if (tmpDateExecuted instanceof Date) {
        dateExecuted = (Date)tmpDateExecuted;
    } else {
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            dateExecuted = df.parse((String)tmpDateExecuted);
        } catch (ParseException var24) {
    }
}

The dateexecuted field in the database is of timestamp type. When the version of the database driver package used is relatively new (8.0.23 is used here), the returned type is localdatetime. If it is strongly converted to string, an error will be reported

Modify the driver package version to 8.0.19, and the service starts normally