Category Archives: How to Fix

Using the TP framework, an error is reported sqlstate [08004] [1040] too many connections

Use
when MySQL inserts a large amount of data and needs to compare and duplicate          Db($table)-> where($where)-> find();

In this case, an error will be reported: sqlstate [08004] [1040] too many connections

This is mainly due to too many database connections

resolvent:

        Introduce DB class

                 use think\Db;

        The query statement is changed to:

                 Db::table($table)-> where($where)-> find();

That’s it

Solution to the problem of failure to elect leaders when offline service is reported in Nacos

Problem description

When there are multiple instances of a micro service in the Nacos registry, click an instance to go offline and report an error

caused: errCode: 500, errMsg: do metadata operation failed ;
caused: com.alibaba.nacos.consistency.exception.ConsistencyException: com.alibaba.nacos.core.distributed.raft.exception.NoLeaderException: The Raft Group [naming_instance_metadata] did not find the Leader node;
caused: com.alibaba.nacos.core.distributed.raft.exception.NoLeaderException: The Raft Group [naming_instance_metadata] did not find the Leader node;

Solution

Nacos uses the raft algorithm to calculate the leader and will record the cluster address started last time. Therefore, when the IP address of our own server changes (especially the students started locally when we study, because sometimes our network environment will change… WiFi, so the IP address often changes), the cluster address recorded by raft will become invalid, If there is a problem with the selected leader, just delete the protocol folder under the data folder under the root directory of Nacos.

The Vue project is packaged and deployed to tomcat, and an Error 404 is reported as soon as it is refreshed

The reason is that the history mode is used   HTML5 history mode | Vue router

I didn’t find a solution

So we changed the routing to hash mode

I use cli3

It was

import {createRouter, createWebHistory} from 'vue-router'

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

Change to

import {createRouter, createWebHashHistory} from 'vue-router'

const router = createRouter({
  model:'hash',
  history: createWebHashHistory(),
  routes
})

It’s normal after modification

Vs2019 + QT parses the XML file and reports an error at doc.setcontent (& file)

Vs2019 + QT parses the XML file and reports an error at doc.setcontent

Made a very low-level mistake. Record the process.

A QT project was established long ago. Now to add a function of parsing XML files using the qdom class, there is always an error in the sentence doc.setcontent (& amp; file) , and there is no error message. The relevant C + + codes are as follows:

QString error;
int line, column;
if (doc.setContent(&file, &error, &line, &column)) {
    qDebug() << doc.toString(4);
}
else {
    qDebug() << "Error:" << error << "in line " << line << "column" << column;
}
file.close();

When doc.setcontent (& amp; file, & amp; error, & amp; line, & amp; column) , critical error detected c00000374 is displayed

The first reaction is that the XML file is incorrectly written. For example, there is no space in the space, Chinese punctuation is entered, or the two sides of the tag are inconsistent
after repeatedly confirming that the XML file is correct, the stackoverflow search said that the relative path cannot be used, but the absolute path must be used… Another attempt of the absolute path is useless.

Create a new project and run it with the same code without error. Through careful comparison, it is found that in the new project, I added the XML class library

but not in the original project!

So far, add $(qtdir) \ include \ qtxml in the C/C + + include directory, add qt5xmld.lib [debug mode] and qt5xml. Lib [release mode] in the linker, and the operation is successful!

Finally, I found that if the XML file is written incorrectly, the above program can locate the error location. Direct reporting of fatal error/critical error or unresolved external symbols like this__ declspec(dllimport) public: __ Cdecl , the probability is that the Lib file link is wrong rather than the code problem. You need to check whether the environment is configured correctly.

A simple question has been wordy for a long time… Mainly to warn yourself that you must think more and think more about ways to expose the problem when you encounter a problem that has no solution on the Internet!

This dependency was not found:* vue-editor-bridge

Error reporting result:

When the project is running, a compilation error occurs suddenly and the dependency cannot be found. Follow the prompt to execute NPM install — save Vue editor bridge, or an error is reported

This dependency was not found:

* vue-editor-bridge in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Test.vue?vue&type=script&lang=js&

To install it, you can run: npm install --save vue-editor-bridge
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'

Cause finding:

After finding similar error reports, it is found that vscode automatically adds a line of import, as if it entered func when entering function, and vscode imported func as a component by default (you don’t have to be so smart?)

import func from 'vue-temp/vue-editor-bridge'

Solution:

Just delete this line of code

After switching the tidb database, an error could not commit JDBC transaction appears from time to time

1. Exception description

org.springframework.transaction.TransactionSystemException: Could not commit JDBC transaction; nested exception is java.sql.SQLException: Write conflict, txnStartTS=426985930345676879,

After switching the tidb database, the above error reports occur from time to time;

2. Problem analysis

It is found that there is a write conflict by searching the online data according to the error content. The optimistic lock is used by default under version 3.0 of tidb database. This problem will occur in the case of multiple concurrent modifications;

3. Solution

(1) Add & amp; database connection; sessionVariables=tidb_ txn_ Change mode = pessimistic to pessimistic lock

(2) Break big things apart

4. Subsequent optimization selection

Gradlew compilation error: mips64el Linux Android strip

Known configuration

ndk.dir=/home/.../Sdk/ndk-bundle  
sdk.dir=/home/.../Sdk  

Gradlew compilation error

Execution failed for task ':app:transformNativeLibsWithStripDebugSymbolForxxxxx'.
> A problem occurred starting process 'command '\
<sdk.dir>/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64/bin/mips64el-linux-android-strip''

View Android/SDK installation path

$ ll <sdk.dir>/ndk-bundle/toolchains/
drwxrwxrwx  3 lily lily 4096 aarch64-linux-android-4.9/
drwxrwxrwx  3 lily lily 4096 arm-linux-androideabi-4.9/
drwxrwxrwx  3 lily lily 4096 llvm/
lrwxrwxrwx  1 lily lily   25 mips64el-linux-android-4.9 -> aarch64-linux-android-4.9/
lrwxrwxrwx  1 lily lily   25 mipsel-linux-android-4.9 -> arm-linux-androideabi-4.9/
drwxrwxrwx  3 lily lily 4096 renderscript/
drwxrwxrwx  3 lily lily 4096 x86-4.9/
drwxrwxrwx  3 lily lily 4096 x86_64-4.9/

I downloaded an extra version of NDK R15, android-ndk-r15c

To change to

$ ll <sdk.dir>/ndk-bundle/toolchains/
drwxrwxrwx  3 lily lily 4096 aarch64-linux-android-4.9/
drwxrwxrwx  3 lily lily 4096 arm-linux-androideabi-4.9/
drwxrwxrwx  3 lily lily 4096 llvm/
lrwxrwxrwx  1 lily lily 84 mips64el-linux-android-4.9 -> <sdk.dir>/ndk/android-ndk-r15c/toolchains/mips64el-linux-android-4.9/
lrwxrwxrwx  1 lily lily 82 mipsel-linux-android-4.9 -> <sdk.dir>/ndk/android-ndk-r15c/toolchains/mipsel-linux-android-4.9/
drwxrwxrwx  3 lily lily 4096 renderscript/
drwxrwxrwx  3 lily lily 4096 x86-4.9/
drwxrwxrwx  3 lily lily 4096 x86_64-4.9/

In this way, there is no error in compilation

No toolchains found in the NDK toolchains folder for ABI with prefix

Invalid bound statement (not found) of custom SQL in mybatisplus

1、 Mybatisplus only configures mapper in YML, and the path scanning is not enough

mapper-locations: classpath:com/jack/shale_porosity/mapper/xml/*.xml

In this way, only the basemapper provided by mybatis can be used. The mapper file is not loaded in the target file.

2、 Configure the mapper file scanning path again in the pom.xml file

 <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>

In this way, you can successfully use custom SQL and SQL in basemapper.

The springboot integration CXF calls WebService and reports an error: cannot create a secure xmlinputfactory

The springboot integration CXF calls WebService and reports an error:

javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ ERROR: java.lang.RuntimeException: Cannot create a secure XMLInputFactory。

As shown below:

The final reason is that wstx-asl-3.2.6.jar package is introduced into the project. This package is the same as many classes of woodstox-core-asl-4.4.1.jar, resulting in jar package conflict.

Solution steps:

  1. View Maven dependencies:

mvn dependency:tree

  Package structure comparison:

2. Maven dependency excludes wstx-asl-3.2.6.jar package dependency

Find the location where the dependency is introduced and exclude wstx ASL:

 

  Reference document: WebService problem, urgent- CSDN forum WebService problem, urgent!!! https://bbs.csdn.net/topics/390491260

Port out of range: – 1 for Tomcat startup in idea

Port out of range: – 1 for Tomcat startup in idea

The reason for this may be that the port number of your configuration file is – 1

how to solve it
first, let’s find the configuration file in conf under your Tomcat installation path

Mine is here

Open with Notepad

Change the port number to another number at this position. Make it larger. Here I change it to 1001

OK, it’s normal

An error is reported when Clickhouse is started. The error log information is: structure needs cleaning

0. std::__1::system_error::system_error(std::__1::error_code, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x158ebc6f in ?
1. ?@ 0x1587f49f in ?
2. ?@ 0x1587eeb6 in ?
3. ?@ 0x1587d018 in ?
4. std::__1::__fs::filesystem::directory_iterator::directory_iterator(std::__1::__fs::filesystem::path const&, std::__1::error_code*, std::__1::__fs::filesystem::directory_options) @ 0x1587ce40 in ?
5. DB::DiskLocalDirectoryIterator::DiskLocalDirectoryIterator(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0xfee57cf in /usr/bin/clickhouse
6. DB::DiskLocal::iterateDirectory(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0xfedffc5 in /usr/bin/clickhouse
7. DB::MergeTreeIndexGranularityInfo::getMarksExtensionFromFilesystem(std::__1::shared_ptr<DB::IDisk> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x10d84f8d in /usr/bin/clickhouse
8. DB::MergeTreeData::createPart(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::MergeTreePartInfo const&, std::__1::shared_ptr<DB::IVolume> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::IMergeTreeDataPart const*) const @ 0x10ca13c0 in /usr/bin/clickhouse
9. ?@ 0x10cdf50d in /usr/bin/clickhouse
10. ThreadPoolImpl<ThreadFromGlobalPool>::worker(std::__1::__list_iterator<ThreadFromGlobalPool, void*>) @ 0x8fd8f18 in /usr/bin/clickhouse
11. ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&, void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()&&...)::'lambda'()::operator()() @ 0x8fdaabf in /usr/bin/clickhouse
12. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0x8fd61ff in /usr/bin/clickhouse
13. ?@ 0x8fd9ae3 in /usr/bin/clickhouse
14. start_thread @ 0x7ea5 in /usr/lib64/libpthread-2.17.so
15. clone @ 0xfe9fd in /usr/lib64/libc-2.17.so

Cannot print extra info for Poco::Exception (version 21.8.4.51 (official build))
2021.09.18 10:46:22.375009 [ 16809 ] {} <Error> Application: filesystem error: in directory_iterator::directory_iterator(...): Structure needs cleaning [/var/lib/clickhouse/store/61d/61d588d9-1562-4435-a1d5-88d91562a435/202109_84030_84496_322/]

The error log indicates that the directory should be deleted, but the directory cannot be deleted. Just remove the directory to another directory and start it again