Tag Archives: back-end

How to Remove “Devtools failed to parse sourcemap” Warning

Recently, in the process of developing with webpack-dev-server , the console has been reporting a warning: DevTools failed to parse SourceMap: webpack:///node_modules/[email protected]@sockjs-client/dist/sockjs.js.map. Here’s how to eliminate this warning:

Sourcemap Technology

Before dealing with this warning, it is important to understand what SourceMap is and what it is used for. When writing a website, if there are many javascript files, when rendering the content to the client browser, if we use a packaging tool like webpack, we can merge and compress those js files and remove the spaces and other elements from them, thus reducing the file size and improving the responsiveness of the page. However, the problem is that the js file cannot be debugged in the browser because the compressed file is compact, without spaces and line breaks.
In a nutshell, SourceMap is how to map compressed js code into formatted code. When you deploy code in the Production environment, along with the compressed and optimized js code, there is also a sourcemap file that contains the original js code. When Chrome, the client browser, receives this compressed js file, it automatically looks for the relevant sourcemap file on the server and converts the compressed js code into formatted js code.

Remove warning

Scheme 1: disable sourcemap browser function

First open DevTools of Chrome browser as follows:

uncheck Enable JavaScript Source maps

the warning disappears after disabling this function in the browser, but this does not fundamentally solve the problem.

Scheme 2: configure webpack

Add devtool: "inline-source-map" in webpack.config.js, as follows:

const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const htmlPlugin = new HtmlWebpackPlugin({
    template: path.join(__dirname, "./src/index.html"),
    filename: "index.html"
});

module.exports = {
    mode: "development",
    // mode: "production"
    plugins: [
        htmlPlugin
    ],
    module: {
        rules: [
            {
                test: /.js|jsx$/,
                use: "babel-loader",
                exclude: /node_modules/
            }
        ]
    },
    devtool: "inline-source-map"
};

Errorjava Compilation failed internal java compiler error [Solved]

Error phenomenon

When using idea to import a new project or upgrade idea or create a new project, the following exception message will appear:

Error:java: Compilation failed: internal java compiler error 

Cause of error

This error is mainly caused by the JDK version. There are two reasons: the compiled version does not match, and the current project JDK version does not support.

View the JDK of the project

File -> Project Structure-> Project Settings -> Project or use the shortcut Ctrl + Alt + Shift + s to open the JDK configuration of the project:

Check whether these two points are consistent with the target JDK.

View the JDK of the project

Click modules in the figure above to view the corresponding JDK version:

View java compiler version

When importing Java projects, the probability of this problem is high.

To solve this problem, reopening or modifying the contents of the pom file (Maven project) is likely to cause the JDK version to change back to 1.5. If the project is a pojd file, you can specify the relevant information:

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

Failed to restart redis-server.service Unit not found [How to Solve]

Failed to restart redis-server. service: Unit not found.

1. Problem description

Redis-5.0.5 is compiled and installed on CentOS 7.8. The port is 6579. The following error occurs when restarting:

# systemctl start redis
Redirecting to /bin/systemctl restart redis-server.service
Failed to restart redis-server.service: Unit not found.

2. Cause analysis

This is because during compilation and installation, redis registers the service name redis_6579, and the full service name is required for startup.

3. Correct startup mode

# systemctl start redis_6579
or
# service redis_6579 start

Android connection to cloud MySQL error: java.lang.NoClassDefFoundError Failed resolution of LjavasqlSQLType

The error information is as follows:

E/AndroidRuntime: FATAL EXCEPTION: Thread-4
    Process: com.example.NCEPU, PID: 19597
    java.lang.NoClassDefFoundError: Failed resolution of: Ljava/sql/SQLType;
        at com.mysql.cj.jdbc.DatabaseMetaData.getInstance(DatabaseMetaData.java:746)
        at com.mysql.cj.jdbc.ConnectionImpl.getMetaData(ConnectionImpl.java:1170)
        at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:447)
        at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
        at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197)
        at java.sql.DriverManager.getConnection(DriverManager.java:580)
        at java.sql.DriverManager.getConnection(DriverManager.java:218)
        at com.example.NCEPU.Utils.MySQLUtil$1.run(MySQLUtil.java:20)
        at java.lang.Thread.run(Thread.java:929)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "java.sql.SQLType" on path: DexPathList[[zip file "/data/app/com.example.NCEPU-ONfkLzQBKVHb0mVXKR3p5g==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.NCEPU-ONfkLzQBKVHb0mVXKR3p5g==/lib/arm64, /data/app/com.example.NCEPU-ONfkLzQBKVHb0mVXKR3p5g==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64, /hw_product/lib64, /system/product/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at com.mysql.cj.jdbc.DatabaseMetaData.getInstance(DatabaseMetaData.java:746) 
        at com.mysql.cj.jdbc.ConnectionImpl.getMetaData(ConnectionImpl.java:1170) 
        at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:447) 
        at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) 
        at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197) 
        at java.sql.DriverManager.getConnection(DriverManager.java:580) 
        at java.sql.DriverManager.getConnection(DriverManager.java:218) 
        at com.example.NCEPU.Utils.MySQLUtil$1.run(MySQLUtil.java:20) 
        at java.lang.Thread.run(Thread.java:929) 
W/libEGL: EGLNativeWindowType 0x6f3882b950 disconnect failed
I/Process: Sending signal. PID: 19597 SIG: 9

Problem analysis: the jar package version of MySQL is too high. I used the latest version: mysql-connector-java-8.0.21.jar, loading driver:

Class.forName("com.mysql.cj.jdbc.Driver");
String url = "jdbc:mysql://yourip:port/sheetname?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC";
connection = DriverManager.getConnection(url, user, password);

Problem solved: jar version lower, here I used the official website to download mysql-connector-java-5.1.49.jar, note that after changing to a lower version to load the driver to become.

Class.forName("com.mysql.jdbc.Driver");

mybatis “case when” Error: Failed to process, please exclude the tableName or statementId.

Encountered when using case when in mybatis for condition filtering judgment

Failed to process, please exclude the tableName or statementId.

Such error messages are syntax errors
but I have no problem running SQL statements on the MySQL command line

//case when
WHERE dept.type = 1
AND 
(
CASE agent.dept_type
WHEN "agent" THEN dept.id=30
END
)
//When the agent's dept_type is "agent", the judgment that dept.id = 30 will be added

There is no problem running this SQL statement on the command line, but an error will be reported if it is executed on mybatis

//Modified
WHERE dept.type = 1
AND dept.id=
(
CASE agent.dept_type
WHEN "agent" THEN 30
END
)

Later, put dept.id outside to solve this problem

20190718 – Supplementary record: another problem is encountered. If the dept table is associated query, there may be no data. When the dept has no data, we can’t assign any parameters to dept.id and can’t affect the query of the data in the original table. I changed it to the following:

//Modified
WHERE dept.type = 1
AND (dept.id=
(
CASE agent.dept_type
WHEN "agent" THEN 30
ELSE 0
END
) or dept.id is null)

Add the judgment that dept.id is empty
(there are many ways to solve it in MySQL statements, but an error will be reported on mybatis – – |)

2019-7-30-supplementary notes:
if it is an empty string, you can’t use "" but change it to single quotation mark ''

CASE WHEN *** THEN ***
ELSE ""  =>Need to change to=> ELSE''

[Solved] Springboot Error: Error creating bean with name ‘xxxController‘

Problem description

Today, we are integrating mybatis with springboot, and an error is reported at runtime:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [E:\IDEA Project\demo\target\classes\com\example\demo\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.16.jar:5.3.16]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.16.jar:5.3.16]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.4.jar:2.6.4]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) [spring-boot-2.6.4.jar:2.6.4]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) [spring-boot-2.6.4.jar:2.6.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-2.6.4.jar:2.6.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) [spring-boot-2.6.4.jar:2.6.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) [spring-boot-2.6.4.jar:2.6.4]
	at com.example.demo.DemoApplication.main(DemoApplication.java:18) [classes/:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [E:\IDEA Project\demo\target\classes\com\example\demo\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656) ~[spring-beans-5.3.16.jar:5.3.16]
	... 20 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [E:\IDEA Project\demo\target\classes\com\example\demo\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1534) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1417) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656) ~[spring-beans-5.3.16.jar:5.3.16]
	... 34 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1519) ~[spring-beans-5.3.16.jar:5.3.16]
	... 45 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.16.jar:5.3.16]
	... 58 common frames omitted
Caused by: org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
	at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:595) ~[mybatis-plus-extension-3.4.0.jar:3.4.0]
	at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.afterPropertiesSet(MybatisSqlSessionFactoryBean.java:431) ~[mybatis-plus-extension-3.4.0.jar:3.4.0]
	at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.getObject(MybatisSqlSessionFactoryBean.java:628) ~[mybatis-plus-extension-3.4.0.jar:3.4.0]
	at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration.sqlSessionFactory(MybatisPlusAutoConfiguration.java:214) ~[mybatis-plus-boot-starter-3.3.1.jar:3.3.1]
	at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration$$EnhancerBySpringCGLIB$$1a37b21a.CGLIB$sqlSessionFactory$2(<generated>) ~[mybatis-plus-boot-starter-3.3.1.jar:3.3.1]
	at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration$$EnhancerBySpringCGLIB$$1a37b21a$$FastClassBySpringCGLIB$$a0eb9858.invoke(<generated>) ~[mybatis-plus-boot-starter-3.3.1.jar:3.3.1]
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.16.jar:5.3.16]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.16.jar:5.3.16]
	at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration$$EnhancerBySpringCGLIB$$1a37b21a.sqlSessionFactory(<generated>) ~[mybatis-plus-boot-starter-3.3.1.jar:3.3.1]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_322]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_322]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_322]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_322]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.16.jar:5.3.16]
	... 59 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:123) ~[mybatis-3.5.5.jar:3.5.5]
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:95) ~[mybatis-3.5.5.jar:3.5.5]
	at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:593) ~[mybatis-plus-extension-3.4.0.jar:3.4.0]
	... 72 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
	at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118) ~[mybatis-3.5.5.jar:3.5.5]
	at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:76) ~[mybatis-3.5.5.jar:3.5.5]
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:138) ~[mybatis-3.5.5.jar:3.5.5]
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:131) ~[mybatis-3.5.5.jar:3.5.5]
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:121) ~[mybatis-3.5.5.jar:3.5.5]
	... 74 common frames omitted
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
	at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120) ~[mybatis-3.5.5.jar:3.5.5]
	at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149) ~[mybatis-3.5.5.jar:3.5.5]
	at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116) ~[mybatis-3.5.5.jar:3.5.5]
	... 78 common frames omitted
Caused by: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
	at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:200) ~[mybatis-3.5.5.jar:3.5.5]
	at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89) ~[mybatis-3.5.5.jar:3.5.5]
	at org.apache.ibatis.io.Resources.classForName(Resources.java:261) ~[mybatis-3.5.5.jar:3.5.5]
	at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:116) ~[mybatis-3.5.5.jar:3.5.5]
	... 80 common frames omitted

Cause analysis:

When I first saw this error report, I guessed that the bean was not successfully created. I also searched various answers on the Internet. Some said that @ service might not be added to the service layer. I looked at it for no reason, so I began to read the error information

Look directly at the error reported in the first line, because the first line is likely to be the main reason for the error:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [E:\IDEA Project\demo\target\classes\com\example\demo\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version

I’ll take this long paragraph wrong and look at it in pieces
at first, I thought it was the problem of userController, then carefully check whether it was not, and then look back:

nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl'

I went to see userServiceImpl again and didn’t find any problems, so I was wondering if I understood the error in this paragraph, so I searched the meaning of nest. It turned out that there was nesting besides nesting! That is to say, the error reporting in this paragraph is actually an exception nested with another exception ! In other words, it is the innermost error that causes the error of each layer above, thus throwing an exception! So I went straight to the back part:

nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version

Found to be VersionMapper.xml has a problem because of Error resolving class, That is to say, there is a problem with one class. Look at the last: Cannot find class: com.libv.entity.Version.
I went to see XML again:

<mapper namespace="com.libv.mapper.VersionMapper">
    <insert id="release" parameterType="com.libv.entity.Version">
        insert into version(id,version,download_url,release_time)
        values (#{id},#{version},#{downloadUrl},NOW())
    </insert>
</mapper>

Now I understand, because I don’t have com.libv.entity this bag! That is, the wrong path of my Version class leads to errors in XML, resulting in layer-by-layer exceptions.


Solution:

Change the directory path of the corresponding class of parameterType in XML

<mapper namespace="com.example.demo.mapper.VersionMapper">
    <insert id="release" parameterType="com.example.demo.Entity.Version">
        insert into version(id,version,download_url,release_time)
        values (#{id},#{version},#{downloadUrl},NOW())
    </insert>
</mapper>

Run again, success!

How to Solve Assert error (IDEA Package Imported)

When using the MyBatis-Plus starter project, we found that no matter which package under IDEA is imported, Assert will report an error, indicating that the suitable package is not downloaded from maven, and then we have to go to the maven repository ourselves to download the required package Junit.

Open the maven repository, https://mvnrepository.com/, and search for junit will appear many, I will generally choose the number of people using.



How to Solve the Primary Key of mybatisPlus Inserted Data is too Large Issue

Solve the problem that the primary key of mybatisplus inserted data is suddenly large

1. Enter the corresponding database in the administrator window, and then enter the following instructions:

alter table sys_user AUTO_INCREMENT=30;

​sys_user is the name of the data table to be modified, and 30 is to modify the self increment starting value to 30

In this way, the primary key value of the data table will return to normal

2. In the entity class of the project, add a @Tableid annotation to the primary key of the class

package baocms.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "sys_user")
public class User {
    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;
    private String username;
    private String password;
    private String nickname;
    private String email;
    private String phone;
    private String address;
}

Tp6 Cannot enable error [How to Solve]

tp6 open error, you need to copy the root directory of .example.env, save it as .env, then modify the header to APP_DEBUG=true, and then directory config/app.php modify ‘show_error_msg’ => fales.

If the pdo still reports an error after starting php.ini again, log out the .env file

[DATABASE]
TYPE=mysql
HOSTNAME=host.docker.internal
DATABASE=easyadmin
USERNAME=root
PASSWORD=root
HOSTPORT=3306
CHARSET=utf8
DEBUG=true
PREFIX=ea_

 

Python Error: OSError: cannot open resource [How to Solve]

Question:

  File "D:\Windows_DL_Environment\anaconda3\envs\py37\lib\site-packages\PIL\ImageFont.py", line 852, in freetype
    return FreeTypeFont(font, size, index, encoding, layout_engine)
  File "D:\Windows_DL_Environment\anaconda3\envs\py37\lib\site-packages\PIL\ImageFont.py", line 212, in __init__
    font, size, index, encoding, layout_engine=layout_engine
OSError: cannot open resource

This class is a common font problem. In Windows environment, fonts are generally located in the C:\windows\fonts folder. In this folder, users can check whether the font specified in the python program exists.

fnt = ImageFont.truetype('Pillow/Tests/fonts/FreeMono.ttf', 50)

Solution 1:

Change the font that exists on the computer

ImageFont.truetype("Pillow/Tests/fonts/arial.ttf", 50)

Solution 2:

Found no freemono in the computer Ttf font, so you need to download
https://fontmeme.com/ziti/freemono-font/

After downloading, unzip it into the fonts folder

finally. Restart the computer to execute.