Category Archives: JAVA

Mybatis Error: Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.

Error reporting in mybatis learning: cause: org.apache.ibatis.builder.builderexception: error creating document instance. Cause: com.sun.org.apache.xerces.internal.impl.io.malformedbytesequenceexception: byte 1 of 1-byte UTF-8 sequence is invalid.)

Error details solution

Error details

java.lang.ExceptionInInitializerError
	at com.yy.dao.UserDaoTest.test(UserDaoTest.java:16)
	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:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error building SqlSession.
### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 1 字节的 UTF-8 序列的字节 1 无效。
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:64)
	at com.yy.utils.MybatisUtils.<clinit>(MybatisUtils.java:20)
	... 23 more
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 1 字节的 UTF-8 序列的字节 1 无效。
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:260)
	at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:126)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:81)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:77)
	... 25 more
Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 1 字节的 UTF-8 序列的字节 1 无效。
	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:701)
	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:567)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1895)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanData(XMLEntityScanner.java:1375)
	at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanComment(XMLScanner.java:801)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment(XMLDocumentFragmentScannerImpl.java:1034)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2982)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:258)
	... 28 more


Process finished with exit code -1

When I taught mybatis by myself, I always reported this error because I wrote comments in two. XML files for easy learning

resolvent

Just delete all the Chinese comments in. XML

Just use this to record the error report, so as to avoid wasting time to find solutions when reporting errors again in the future.

[Solved] java.sql.SQLException: Unknown system variable cache query size

Recently, when I was learning springboot + MySQL + mybatis and doing a project with CSDN boss, I encountered an error when connecting to MySQL:

java.sql.SQLException: Unknown system variable 'query_cache_size'

Error reason:
the version of MySQL connector Java is too low, and the database driver version does not match the local MySQL version. Query cache has been out of date since MySQL 5.7.20, but it has been removed since MySQL 8.0
solution:
first, modify the driver name in the application. YML or application. Properties file

driver-class-name: com.mysql.cj.jdbc.Driver  #Linked Drivers for MySQL 8.0 onwards
com.mysql.jdbc.Driver #Older linked drivers

Then modify the driver version in the POM. XML file

<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>8.0.25</version>
			<scope>runtime</scope>
		</dependency>

The previous version here is 5. X. just change it to the actual MySQL version number. Mine is 8.0.25
remember to reload Maven’s dependencies after changing. Otherwise, it will still report an error:

Cannot load driver class:com.mysql.cj.jdbc.Driver

Click this icon to reload the dependency

perfect solution!

[Solved] com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure error

This error was encountered during the test of integrating mybatis with springboot

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 317 milliseconds ago.  The last packet sent successfully to the server was 314 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_181]
	。。。。
	followed by a long list of

The solution is to add usessl = false to the connection string
or change usessl = true to use = false
for example

 url: jdbc:mysql://localhost:3306/sqmb?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC


end!!

Continuous Error 404 in servlet operation [How to Solve]

When writing the project, the servlet has been unable to work normally. After consulting the data for many times, we found the following possibilities.

First, automatic editing is not turned on

In the top project option, check build automatically from the drop-down list

Second: the version of the top header in web.xml is too low

The author uses @ webservlet (urlpatterns =/xxservlet) mode, which does not need to configure servlet file in web.xml, but only version 3.0 or above supports this mode. Therefore, in web.xml, there must be version = 3.1.

You can directly copy the following code to use.

<?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/web-app_3_1.xsd" version="3.1">
  <display-name>Project Name</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

Third: Tomcat configuration problems

Remove Tomcat from the server and install Tomcat again according to the process.

1. Delete Tomcat

2. Select preference in the top window option. In the pop-up box, select server — runtime environment — and select the original Tomcat — remove

3. Then click Add to configure the Tomcat you downloaded.

I hope eclipse will work properly.

[Solved] Java XXX: unable to find topic engine in module path

# title1
(java:xxx):gtk -WARNING-:16:33:41.114:Unable to find the theme engine in the module path:“pixmap"
# method
sudo apt-get install gtk2-engines-pixbuf

# title2
(java:xxx):gtk -WARNING-:16:33:41.114:Unable to find the theme engine in the module path:“murrine"
# method
sudo apt-get install gtk2-engines-murrine

# title3
(java:xxx):gtk -WARNING-:16:3:41.115:Unable to find the theme engine in the module path:“adwaita”
# method
sudo apt-get install gnome-themes-standard

Springboot startup error “No bean named’org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry’ available”

1. Problem

springboot startup error

"D:\Program Files\Java\jdk-11\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx. enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\lib\idea_rt.jar=59473:D:\Program Files \JetBrains\IntelliJ IDEA 2019.1.2\bin" -Dfile.encoding=UTF-8 -classpath D:\workroomMy\demoSpring\out\production\classes;D:\workroomMy\demoSpring\out\production\resources;C:\ Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-web\2.3.0.RELEASE\459a5d406c56770d9616c5b272bae9fbc777a994\spring-boot-starter-web-2.3.0 .RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.mybatis.spring.boot\mybatis-spring-boot-starter\2.1.2\724ae339bf7d1087612c7186133ed9701f103ddd\mybatis-spring-boot-starter-2.1.2.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter- json\2.3.0.RELEASE\dfdd3336ee920e4bc75f4ed726c3894c7821c31b\spring-boot-starter-json-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework. boot\spring-boot-starter-jdbc\2.3.0.RELEASE\ddc9ee3da589998143de4cada9d5e3aa1dc39f83\spring-boot-starter-jdbc-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\ files-2.1\org.springframework.boot\spring-boot-starter\2.3.0.RELEASE\7b65ef478cf4d21ec70432e11055c2c83371b305\spring-boot-starter-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\ modules-2\files-2.1\org.springframework.boot\spring-boot-starter-tomcat\2.3.0.RELEASE\a8038c9ce2beb7bd3c1980ecadd79f65f36d9311\spring-boot-starter-tomcat-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.mybatis.spring.boot\mybatis-spring-boot-autoconfigure\2.1.2\f322930f6a0d07c78481853e6625ffb779bcdeb7\mybatis-spring- boot-autoconfigure-2.1.2.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\2.3.0.RELEASE\63e909ec18045377f5bcbedbf29f54691dc54ba0\ spring-boot-autoconfigure-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\2.3.0.RELEASE\ 52fabd810811f5352ebf6a0a7049550f7d4ec1b9\spring-boot-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\2.3. 0.RELEASE\fe2b3809c5763dd7fe02ab174ebe5ee9ed708fbe\spring-boot-starter-logging-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework\spring-webmvc\5.2.6.RELEASE\fc54ea95c4c96cd0ab5272319905d4da5d632383\spring-webmvc-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework. boot\spring-boot-devtools\2.3.0.RELEASE\e13dced857910467ff468bba0656a3857deda524\spring-boot-devtools-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\ org.springframework\spring-web\5.2.6.RELEASE\8cc2dbd266eb8f02d2df0895c8e887269e8aed88\spring-web-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org. mybatis\mybatis\3.5.4\83853443357d61258d2634758079f355a0db69ee\mybatis-3.5.4.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.mybatis\mybatis-spring\2.0.4\ 3771548c4d9f78789be33bed01f42d6592757fe1\mybatis-spring-2.0.4.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.11.0\168b2d0e11478b9f0a1bfccd62d6b5e8547b1e6f\jackson-datatype-jsr310-2.11.0.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.fasterxml. jackson.core\jackson-annotations\2.11.0\c626020ae55d19c690d25cb51c1532ba76e5890f\jackson-annotations-2.11.0.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson. datatype\jackson-datatype-jdk8\2.11.0\cca91d6375258fd7ff2a6abb7bf91eef492bd606\jackson-datatype-jdk8-2.11.0.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.fasterxml. jackson.module\jackson-module-parameter-names\2.11.0\950a1e9a7c1093e7ffd92b216d5a0667f1e39058\jackson-module-parameter-names-2.11.0.jar;C:\Users\admin\.gradle\caches\modules-2\files- 2.1\com.fasterxml.jackson.core\jackson-core\2.11.0\f84302e14648f9f63c0c73951054aeb2ff0b810a\jackson-core-2.11.0.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.11.0\8f5aaf3878b0647ff3a16610af53b1a5c05d9f15\jackson-databind-2.11.0.jar;C:\Users\admin\.gradle\ caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.13.2\7e2845170ed4fdeb87f1fdc9131b743c61645da3\log4j-to-slf4j-2.13.2.jar;C:\Users\admin\. gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.13.2\567ea514dedd8679c429c5b5b39b0d67b6464c3c\log4j-api-2.13.2.jar;C:\Users\admin\.gradle\ caches\modules-2\files-2.1\org.springframework\spring-context\5.2.6.RELEASE\f8f4420f268b054db12bf0dc7128adc09ab39a7\spring-context-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\ modules-2\files-2.1\org.springframework\spring-aop\5.2.6.RELEASE\84fffb7cad5816763683a3f251f942aa9f667a7e\spring-aop-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules- 2\files-2.1\org.springframework\spring-jdbc\5.2.6.RELEASE\43747a50376e662c2d889ce7b3cd5b9204962ff3\spring-jdbc-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\ org.springframework\spring-tx\5.2.6.RELEASE\965726c96c42025eedeec047c2afad884203145a\spring-tx-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org. springframework\spring-beans\5.2.6.RELEASE\d1b4c338e52dac001a48e29a605bb8f73572ad84\spring-beans-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework\ spring-expression\5.2.6.RELEASE\ae0bc9fdf6cf08d885b9aee26c21efa24245d46c\spring-expression-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework\spring- core\5.2.6.RELEASE\5533695a01f5a1163428932abf6c5ba70e837a2d\spring-core-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jcl\5.2.6.RELEASE\47b092c5c7a97ad330ae29d84d64e42c63a11b7a\spring-jcl-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.glassfish\ jakarta.el\3.0.3\dab46ee1ee23f7197c13d7c40fce14817c9017df\jakarta.el-3.0.3.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.zaxxer\HikariCP\3.4.5\ aa1a2c00aae8e4ba8308e19940711bb9525b103d\HikariCP-3.4.5.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\jakarta.annotation\jakarta.annotation-api\1.3.5\59eb84eecd0d6163332ffkarta065f616\jakarta. api-1.3.5.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.2.3\7c4f3c474fb2c041d8028740440937705ebb473a\logback-classic-1.2. 3.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.2.3\864344400c3d4d92dfeb0a305dc87d953677c03c\logback-core-1.2.3.jar; C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\1.7.30\d58bebff8cbf70ff52b59208586095f467656c30\jul-to-slf4j-1.7.30.jar; C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.30\b5a4b6d16ab13e34a88fae84c35cd5d68cac922c\slf4j-api-1.7.30.jar;C:\Users\admin \.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.26\a78a8747147d2c5807683e76ec2b633e95c14fe9\snakeyaml-1.26.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\ org.projectlombok\lombok\1.18.12\48e4e5d60309ebd833bc528dcf77668eab3cd72c\lombok-1.18.12.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat- embed-websocket\9.0.35\62ab2d7d7d029ea728ea8f8d3151ba93882b52ca\tomcat-embed-websocket-9.0.35.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\ tomcat-embed-core\9.0.35\8a99064fce4b152a7dc9bea1798ba828a2cecf0f\tomcat-embed-core-9.0.35.jar com.example.demo.DemoApplication

  . ____ _ __ _ _
 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
(()\___ |'_ |'_| |'_ \/ _` | \ \ \ \
 \\/ ___)| |_)| | | | | || (_| |))))
  '|____| .__|_| |_|_| |_\__, | / / / /
 ==========|_|==============|___/=/_/_/_/
 :: Spring Boot :: (v2.3.0.RELEASE)

2020-05-29 09:42:41.536 INFO 6888 --- [restartedMain] com.example.demo.DemoApplication: Starting DemoApplication on A01 with PID 6888 (D:\workroomMy\demoSpring\out\production\classes started by admin in D:\workroomMy\demoSpring)
2020-05-29 09:42:41.540 INFO 6888 --- [restartedMain] com.example.demo.DemoApplication: No active profile set, falling back to default profiles: default
2020-05-29 09:42:41.592 INFO 6888 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor: Devtools property defaults active! Set'spring.devtools.add-properties' to'false' to disable
2020-05-29 09:42:41.593 INFO 6888 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor: For additional web related logging consider setting the'logging.level.web' property to'DEBUG'
2020-05-29 09:42:42.120 WARN 6888 --- [restartedMain] omsmapper.ClassPathMapperScanner: No MyBatis mapper was found in'[com.example.demo]' package. Please check your configuration.
2020-05-29 09:42:42.453 INFO 6888 --- [restartedMain] osbwembedded.tomcat.TomcatWebServer: Tomcat initialized with port(s): 8080 (http)
2020-05-29 09:42:42.461 INFO 6888 --- [restartedMain] o.apache.catalina.core.StandardService: Starting service [Tomcat]
2020-05-29 09:42:42.461 INFO 6888 --- [restartedMain] org.apache.catalina.core.StandardEngine: Starting Servlet engine: [Apache Tomcat/9.0.35]
2020-05-29 09:42:42.529 INFO 6888 --- [restartedMain] oaccC[Tomcat].[localhost].[/]: Initializing Spring embedded WebApplicationContext
2020-05-29 09:42:42.529 INFO 6888 --- [restartedMain] osweb.context.ContextLoader: Root WebApplicationContext: initialization completed in 936 ms
2020-05-29 09:42:42.665 INFO 6888 --- [restartedMain] ossconcurrent.ThreadPoolTaskExecutor: Initializing ExecutorService'applicationTaskExecutor'
2020-05-29 09:42:42.753 WARN 6888 --- [restartedMain] ConfigServletWebServerApplicationContext: Exception encountered during context initialization-cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource ]: Factory method'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2020-05-29 09:42:42.753 INFO 6888 --- [restartedMain] ossconcurrent.ThreadPoolTaskExecutor: Shutting down ExecutorService'applicationTaskExecutor'
2020-05-29 09:42:42.755 INFO 6888 --- [restartedMain] o.apache.catalina.core.StandardService: Stopping service [Tomcat]
2020-05-29 09:42:42.766 INFO 6888 --- [restartedMain] ConditionEvaluationReportLoggingListener: 

Error starting ApplicationContext. To display the conditions report re-run your application with'debug' enabled.
2020-05-29 09:42:42.769 ERROR 6888 --- [restartedMain] osbdLoggingFailureAnalysisReporter: 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource:'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
    If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

2020-05-29 09:42:42.780 WARN 6888 --- [restartedMain] osboot.SpringApplication: Unable to close ApplicationContext

org.springframework.beans.factory.BeanCreationException: Error creating bean with name'org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:603) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:409) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:245) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:197) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:134) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:81) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:67) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:167) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:978) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:814) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at com.example.demo.DemoApplication.main(DemoApplication.java:12) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.3.0.RELEASE.jar:2.3.0.RELEASE]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:603) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:409) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:91) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:109) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:94) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:76) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:347) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:299) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:431) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    ... 33 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:814) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1282) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor.postProcessBeforeInitialization(ConfigurationClassPostProcessor.java:456) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    ... 56 common frames omitted


Process finished with exit code 0

 

2. Solution

Authentication see error prompt

Consider the following:
    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
    If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

 

The error may be due to the lack of configuration database related information. If the project does not need to configure the database, you can add it to the startup class:

(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})

 

 perfect!

[Solved] Spring AOP Error creating bean with name

When learning the AOP configuration of spring, I encountered an error as follows:

Warning: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/jeremy/service/userServiceImpl (wrong name: com/jeremy/service/UserServiceImpl)

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/jeremy/service/userServiceImpl (wrong name: com/jeremy/service/UserServiceImpl)

An error occurred when creating the bean because the class NoClassDefFoundError could not be found

Cause of the problem: the class name of pointcut configured in execution is filled in lowercase by mistake, so an error is reported
solution: change the class name to the correct uppercase

    <aop:config>
        <aop:pointcut id="pointcut" expression="execution(* com.jeremy.service.userServiceImpl.*(..))"/>

        <aop:advisor advice-ref="afterLog" pointcut-ref="pointcut"/>
        <aop:advisor advice-ref="beforeLog" pointcut-ref="pointcut"/>
    </aop:config>

Change to

 <aop:config>
     <aop:pointcut id="pointcut" expression="execution(* com.jeremy.service.UserServiceImpl.*(..))"/>

     <aop:advisor advice-ref="afterLog" pointcut-ref="pointcut"/>
     <aop:advisor advice-ref="beforeLog" pointcut-ref="pointcut"/>
 </aop:config>

RabbitMQ The channelMax limit is reached. Try later. [How to Solve]

Anomaly interpretation

In a high concurrency scenario, the number of channels reaches the limit, so they cannot continue to be created

Self-built rabbitmq solution

1. Custom configuration

@Configuration
@Slf4j
public class RabbitMQConfig {


    @Bean
    public RabbitTemplate rabbitTemplate(final ConnectionFactory connectionFactory) {
        CachingConnectionFactory cachingConnectionFactory = (CachingConnectionFactory) connectionFactory;
        // set ChannelMax as 4095
        cachingConnectionFactory.getRabbitConnectionFactory().setRequestedChannelMax(4095);
        final RabbitTemplate rabbitTemplate = new RabbitTemplate(cachingConnectionFactory);
        rabbitTemplate.setMessageConverter(jackson2MessageConverter());
        rabbitTemplate.setMandatory(true);
        rabbitTemplate.setConfirmCallback((correlationData, b, s) -> {
            if(!b){
                log.error("confirmCallBack Sending failed data: {}",correlationData);
                log.error("confirmCallBack Confirmation status: {}",b);
                log.error("ConfirmCallBack Reason for sending failure: {}",s);
            }
        });
        rabbitTemplate.setReturnCallback((message, i, s, s1, s2) -> {
            log.error("returnCallBack message: {}",message);
            log.error("returnCallBack response code: {}",i);
            log.error("returnCallBack response message: {}",s);
            log.error("returnCallBack Switch: {}",s1);
            log.error("returnCallBack Routing Key.{}",s2);
        });
        return rabbitTemplate;
    }

    @Bean
    public Jackson2JsonMessageConverter jackson2MessageConverter() {
        return new Jackson2JsonMessageConverter();
    }
}

2. Modify the configuration of MQ server synchronously
rabbitmq.conf

## Set the max permissible number of channels per connection.
## 0 means "no limit".
##In the configuration file, just enter the following parameters and the value you want to set, if you don't use 2047, then you don't need to configure
# channel_max = 128

Rabbitmq solution for cloud services

For paid versions of MQ cloud services, you can try the following to configure rabbitMq connection caching

springBoot 2.3+

  rabbitmq:
    cache:
      connection:
        size: 1000
      channel:
        size: 64

[Solved] Failed to convert value of type ‘java.lang.String‘ to required type ‘java.util.Date‘;

Add a method to Java controller to solve the problem

    /**
     * Solution: Failed to convert value of type 'java.lang.String' to required type 'java.util;
     * The main reason for this error is that the required type in the Controller class is Date, but the type passed on the page side is String, which eventually leads to this error.
     */
    @InitBinder
    public void initBinder(WebDataBinder binder, WebRequest request) {
        //convert the date Note that the conversion here should always be in the same format as the string passed in, e.g. 2015-9-9 should be yyyy-MM-dd
        DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));// CustomDateEditor is a custom date editor
    }

Error creating bean with name [How to Solve]

I ran into a bug today

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'skuController'


The solution:

1. Maybe the implementation class didn’t add @servcie annotation. After you add it, click start, and the error still exists. Heartbreak X1 2. It may be that @mapperscan (“com. XXX. Mapper”) is not added to the startup class. After you add it, click start, and the error still exists. Heartbreak x2 3. Maybe the Dao package in serviceimpl is not imported into @ Autowired. After you add it, click start, and the error still exists. How about heartbreak X3
is it endless fun to be immortal and die? In the end, you have listed three possibilities, but you still need a note:
@ enable autoconfiguration

@The main functions of enable autoconfiguration are as follows:

Enable automatic configuration of the spring application context and try to guess and configure the beans you may need. Automatic configuration classes are usually based on class paths and defined bean applications. For example, if you have
tomcat-embedded.jar in your classpath, you may want a Tomcat embedded servletcontainerfactory (unless you define your own embedded servletcontainerfactory
bean). When using springbootapplication, automatic configuration of the context is automatically enabled and this annotation is added, so there is no extra effect
autoconfiguration tries to be as intelligent as possible and will be backed up when you define more of your own configurations. You can always manually exclude () any configuration you don’t want to apply (if you can’t access them). You can also exclude them through spring.
autoconfigure. Exclude attributes. After the user-defined bean is registered, auto configuration is always applied. Packages of classes annotated with @
enable autoconfiguration, usually through @
spring boot application, have special significance and are often used as “default”. For example, it will be used to scan the @ entity class. It is generally recommended to place @
enable autoconfiguration in the root package (if you do not use @ springbootapplication) so that you can search all subpackages and classes conditionalonclass and @ conditionalonsingbean).

The above explanations about @ enableautoconfiguration are copied from other places by bloggers. If it’s a bit difficult to understand, you just need to know that it’s Bean’s automatic assembly tool. Maybe you will ask, why do I do this?Can’t I use @ import directly in my project?Of course, since it is automatic configuration, of course, you want the project to start and load.

 

How to Solve Tomcat Error: Could not resolve view with name ‘xxx/xxxxxxx‘ in servlet with

Click the control to not receive the returned JSON object, Tomcat reports an error.

reason:

Because the return information is a JSON object, the annotation added to the entry class where the controller method is located is: @ controller

The @controller is not suitable for returning JSON content

Method 1: change the @ controller annotation to @restcontroller without affecting the use of other methods

Method 2: add @ ResponseBody annotation to the method that needs to request to return the JSON object

Some of the other methods in the class of this method in the project return to the specified page, so @restcontroller cannot be used to replace @ controller directly, so method 2 is adopted to solve the problem.

The difference between @controller and @restcontroller is as follows

@Restcontroller is a stereotype annotation that combines @ ResponseBody and @ controller.
it means:
@restcontroller annotation is equivalent to the combined function of @ ResponseBody + @controller.

1) If you only use @restcontroller to annotate the controller, the methods in the controller cannot return the JSP page, the configured view parser internalresourceviewresolver does not work, and the returned content is the content in return.

For example, if you should go to the success.jsp page, success.jsp will be displayed

2) If you need to return to the specified page, you need to use @ controller with the view parser internalresourceviewresolver
3) if you need to return JSON, XML or custom media type content to the page, you need to add @ ResponseBody annotation to the corresponding method