Author Archives: Robins

[Solved] k8s-nfs pvc load error –nfs-client-provisioner

k8s mount nfs problem.

Error 1:
Please install on all k8s node nodes:
yum -y install nfs-utils
Error 2:
kubectl logs nfs-client-provisioner-59fd564b9b-zkpbn
Kubernetes PVC has been in Pending state
unexpected error getting claim reference: selfLink was empty, can’t make reference
Temporary solution:
1.20.4 version, solution
/etc/kubernetes/manifests/kube-apiserver.yaml add “–feature-gates=RemoveSelfLink=false”
Solution-use version v4.0.x
Use nfs-client-provisioner: v4.0.1 here
Related documents: https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/issues/25
Use easzlab/nfs-subdir-external-provisioner:v4.0.1 directly here

[Solved] jmeter Stress Test Error: java.net.BindException: Address already in use: connect

When JMeter} performs stress testing, the following errors will be reported when testing with high threads for a long time:

Troubleshooting:

First, check the server log and find that there are no errors.

Then check the nginx data. It is found that the number of requests is inconsistent with the number of requests sent by the test. The server receives less and thinks of losing requests.

Later, after searching the information, it was found that it was the problem of the windows machine,

Reason: Windows provides 1024-5000 ports for TCP/IP links, and it takes four minutes to recycle them, which causes us to fill up the ports when running a large number of requests in a short time, resulting in an error report.

Solution (operate on the server where JMeter is located):

1. Enter regedit command in CMD to open the registry;

2. In HKEY_LOCAL_Machine\system\currentcontrolset\services\TCPIP\parameters right-click parameters;

3. Add a new DWORD named maxuserport;

4. Double click maxuserport, enter 65534 numerical data, and select decimal base;

5. After completing the above operations, be sure to restart the machine and solve the problem.

PS: Although the normal test can be carried out, the same problem occurs after increasing the number of threads a few days. The following configuration is required:

After the third step above, add tcptimedwaitdelay, the value is 30-300, and select decimal.

You still need to restart your computer

[Solved] mapper.xml Error: java.lang.AbstractMethodError: Method oracle/jdbc/driver/OracleResultSetImpl.getNString(Ljava/lang/String;)Ljava/lang/String; is abstract,

Error: java.lang.AbstractMethodError: Method oracle/jdbc/driver/OracleResultSetImpl.getNString(Ljava/lang/String;)Ljava/lang/String; is abstract,
Problem: The jdbcType definition in the mapper.xml code is not consistent with the one in the database and the entity class.

Solution 1: violent solution, directly remove the jdbcType in the resultMap defined in mapper.xml , do not specify the data type
Solution 2: Check the data types in the entity class, database and resultMap one by one, all three should be consistent

Attachment: Default mapping of MySQL data types, JDBC data types, Java data types

MySQL DATA TYPE JDBC TYPE(getColumnTypeName) The default JAVA type returned(getColumnClassName)
BIT(1) (new in MySQL-5.0) BIT java.lang.Boolean
BIT( > 1) (new in MySQL-5.0) BIT byte[]
TINYINT TINYINT java.lang.Boolean if the configuration property tinyInt1isBit is set to true (the default) and the storage size is 1, or java.lang.Integer if not.
BOOLBOOLEAN TINYINT See TINYINT, above as these are aliases for TINYINT(1), currently.
SMALLINT[(M)] [UNSIGNED] SMALLINT [UNSIGNED] java.lang.Integer (regardless of whether it is UNSIGNED or not)
MEDIUMINT[(M)] [UNSIGNED] MEDIUMINT [UNSIGNED] java.lang.Integer (regardless of whether it is UNSIGNED or not)
INT,INTEGER[(M)] [UNSIGNED] INTEGER [UNSIGNED] java.lang.Integer, if UNSIGNED java.lang.Long
BIGINT[(M)] [UNSIGNED] BIGINT [UNSIGNED] java.lang.Long, if UNSIGNED java.math.BigInteger
FLOAT[(M,D)] FLOAT java.lang.Float
DOUBLE[(M,B)] DOUBLE java.lang.Double
DECIMAL[(M[,D])] DECIMAL java.math.BigDecimal
DATE DATE java.sql.Date
DATETIME DATETIME java.sql.Timestamp
TIMESTAMP[(M)] TIMESTAMP java.sql.Timestamp
TIME TIME java.sql.Time
YEAR[(2|4)] YEAR If yearIsDateType configuration property is set to false, then the returned object type is java.sql.Short. If set to true (the default), then the returned object is of type java.sql.Datewith the date set to January 1st, at midnight.
CHAR(M) CHAR java.lang.String (unless the character set for the column is BINARY, then byte[] is returned.
VARCHAR(M) [BINARY] VARCHAR java.lang.String (unless the character set for the column is BINARY, then byte[] is returned.
BINARY(M) BINARY byte[]
VARBINARY(M) VARBINARY byte[]
TINYBLOB TINYBLOB byte[]
TINYTEXT VARCHAR java.lang.String
BLOB BLOB byte[]
TEXT VARCHAR java.lang.String
MEDIUMBLOB MEDIUMBLOB byte[]
MEDIUMTEXT VARCHAR java.lang.String
LONGBLOB LONGBLOB byte[]
LONGTEXT VARCHAR java.lang.String
ENUM('value1','value2',...) CHAR java.lang.String
SET('value1','value2',...) CHAR java.lang.String

MySQL JDBC allows conversions between different data types: the conversion table is as follows

MySQL DATA TYPE JAVA types that can be converted
CHAR, VARCHAR, BLOB, TEXT, ENUM, and SET java.lang.String, java.io.InputStream, java.io.Reader, java.sql.Blob, java.sql.Clob
FLOAT, REAL, DOUBLE PRECISION, NUMERIC, DECIMAL, TINYINT, SMALLINT, MEDIUMINT, INTEGER, BIGINT java.lang.String, java.lang.Short, java.lang.Integer, java.lang.Long, java.lang.Double, java.math.BigDecimal
DATE, TIME, DATETIME, TIMESTAMP java.lang.String, java.sql.Date, java.sql.Timestamp

 

Pycharm Connect MySQL to Find Sheet Error: RuntimeError: ‘cryptography’ package is required for sha256_password or caching_sha2_password auth methods

When linking MySQL database through pycharm, the query report will give an error prompt:

RuntimeError: ‘cryptography’ package is required for sha256_password or caching_sha2_password auth methods

Method 1: restart MySQL

① As an administrator, enter the command line “net start MySQL 80” in CMD (the service name of MySQL 80 is different here according to the installed version) to start mysql

② Enter “MySQL” to enter mysql.

③ pycharm runs again without reporting an error.

Method 2: install the cryptography package

Error: runtimeerror: ‘cryptography’ package is required for sha256_ password or caching_ sha2_ password auth methods

The error message means: sha256_Password and caching_sha2_ Password two encryption methods require cryptography.

Therefore, you only need to install the cryptography package: PIP install cryptography

① First, if you see mysql running in task manager.

② After opening cmd, enter the command "pip install cryptography", after successful installation, run pycharm again, no error is reported.

[Solved] mybatis-plus getById() Method Error: Expected one result (or null) to be returned by selectOne(), but found: 2

Error:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2

	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:440)
	at com.sun.proxy.$Proxy153.selectOne(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:159)
	at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:90)
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148)
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)
	at com.sun.proxy.$Proxy156.selectById(Unknown Source)
	at com.baomidou.mybatisplus.extension.service.IService.getById(IService.java:199)
	at com.baomidou.mybatisplus.extension.service.IService$$FastClassBySpringCGLIB$$f8525d18.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:685)
	at cn.com.chnsys.eleac4.sys_common.service.impl.ConfigRuleDetailServiceImpl$$EnhancerBySpringCGLIB$$4e131247.getById(<generated>)
	at cn.com.chnsys.eleac4.rule.RuleApplicationTests.test3(RuleApplicationTests.java:91)
	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.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:125)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:132)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:124)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:74)
	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:104)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:62)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:43)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:35)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:202)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:198)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at java.util.ArrayList.forEach(ArrayList.java:1249)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at java.util.ArrayList.forEach(ArrayList.java:1249)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
	at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
	at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
	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.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:80)
	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.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
	... 75 more

SQL query log:

Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@140fa482] was not registered for synchronization because synchronization is not active
JDBC Connection [HikariProxyConnection@2027818863 wrapping com.mysql.jdbc.JDBC4Connection@3b063aaf] will not be managed by Spring
==>  Preparing: SELECT ID,ZONGTPZID AS configTotalId,ZONGTPZLX AS configTotalType,ZONGTPZMC AS configTotalName,XUNCXMC AS configRuleDetailName,ZHUCID AS registrId,JISGZ AS calRule,BEIYZFC8 AS ReservedString8,BEIYZFC7 AS ReservedString7,BEIYZFC6 AS ReservedString6,BEIYZFC5 AS ReservedString5,BEIYZFC4 AS ReservedString4,BEIYZFC3 AS ReservedString3,BEIYZFC2 AS ReservedString2,BEIYZFC1 AS ReservedString1,BEIYZT5 AS ReservedInt5,BEIYZT4 AS ReservedInt4,BEIYZT3 AS ReservedInt3,BEIYZT2 AS ReservedInt2,BEIYZT1 AS ReservedInt1 FROM eleac_guizpz WHERE ID=?
==> Parameters: 4(Integer)
<==    Columns: ID, configTotalId, configTotalType, configTotalName, configRuleDetailName, registrId, calRule, ReservedString8, ReservedString7, ReservedString6, ReservedString5, ReservedString4, ReservedString3, ReservedString2, ReservedString1, ReservedInt5, ReservedInt4, ReservedInt3, ReservedInt2, ReservedInt1
<==        Row: 4, 4, 4, Full, 2, <<BLOB>>, null, null, null, null, null, null, null, null, null, null, null, null, null
<==        Row: 4C56B386-8257-4991-A6BF-29D2EEFBF299, 1, 1, 1, <<BLOB>>, null, null, null, null, null, null, null, null, null, null, null, null, null
<==      Total: 2
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@140fa482]

error analysis

Viewing the entity object, it is found that the primary key ID data type is string and the database primary key type is varcher

The parameter of SQL is integer, which is different from the entity data type. It is related to the underlying principle of mybayis plus and will not be analyzed here.

Error resolution: modify the query parameter to string,

Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@439047ef] was not registered for synchronization because synchronization is not active
JDBC Connection [HikariProxyConnection@2114163679 wrapping com.mysql.jdbc.JDBC4Connection@301b2259] will not be managed by Spring
==>  Preparing: SELECT ID,ZONGTPZID AS configTotalId,ZONGTPZLX AS configTotalType,ZONGTPZMC AS configTotalName,XUNCXMC AS configRuleDetailName,ZHUCID AS registrId,JISGZ AS calRule,BEIYZFC8 AS ReservedString8,BEIYZFC7 AS ReservedString7,BEIYZFC6 AS ReservedString6,BEIYZFC5 AS ReservedString5,BEIYZFC4 AS ReservedString4,BEIYZFC3 AS ReservedString3,BEIYZFC2 AS ReservedString2,BEIYZFC1 AS ReservedString1,BEIYZT5 AS ReservedInt5,BEIYZT4 AS ReservedInt4,BEIYZT3 AS ReservedInt3,BEIYZT2 AS ReservedInt2,BEIYZT1 AS ReservedInt1 FROM eleac_guizpz WHERE ID=?
==> Parameters: 4(String)
<==    Columns: ID, configTotalId, configTotalType, configTotalName, configRuleDetailName, registrId, calRule, ReservedString8, ReservedString7, ReservedString6, ReservedString5, ReservedString4, ReservedString3, ReservedString2, ReservedString1, ReservedInt5, ReservedInt4, ReservedInt3, ReservedInt2, ReservedInt1
<==        Row: 4, 4, 4, Full, 2, <<BLOB>>, null, null, null, null, null, null, null, null, null, null, null, null, null
<==      Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@439047ef]

[Solved] Project compile error After Install less-loader: Typeerror: this getOptions is not a function

Error:
TypeError: this.getOptions is not a function

Analysis of problems:

In fact, the version of less loader is too high and incompatible with getoptions function methods, so it is necessary to downgrade less loader

Problem-solving:

Uninstall the original version of less loader through the NPM uninstall less loader command,

Then install less through NPM- [email protected] Command to download the downgraded version of less loader. This problem can be solved

[Solved] Startup Error: Failed to start bean ‘documentationPluginsBootstrapper’

The error is spring boot version 2.6 or above and springfox swagger version 3.0 Compatibility issues with 0

Solution:

  • Downgrade springboot to 2.5.X and below
  • In the configuration in the spring configuration file: spring.mvc.pathmatch.matching-strategy=ant_path_matcher
  • However, the springfox bug has lasted for a long time and the team has not resolved it. So I suggest you use spring doc as a replacement

[Solved] codeblocks Error: ‘to_string’ was not declared in this scope

“To_string ‘was not declared in this scope” is sometimes encountered when using CodeBlocks (the compiler adopts MinGW) under windows Code blocks, to_ String and so on, which only introduces the parts and solutions related to this problem
first, to_String is a new function introduced by C + + 11, which may not be supported by the old compiler, so “C + + 11” compilation support should be added to the compiler: open Settings -> Compiler

Check the C + + 11 standard here
of course, you should also check your code for problems. to_String is contained in string, and string is contained in space STD, so your code should include header file and related space introduction, for example:

#include <iostream>
#include <string> //std::string std::to_string

using namespace std;

int main()
{
    int a = 123;
    cout << "a = " << to_string(a) <<endl; // If you don't add namespaces you can use std::to_string here

    return 0;
}

[Solved] maven Project Compile Error: was cached in the local repository, resolution will not be reattempte

The error contents are as follows: was cached in the local repository, resolution will not be reatempted until the update interval of central has elapsed or updates are forced

Solution: Go to the pom.xml of the compile project to check if there are duplicate dependencies. If it is duplicated, just delete one.