Category Archives: Error

[Solved] Flag + pyinstaller runs error after packaging: SystemError

Cause: the company has a requirement to package flash as exe without displaying the terminal window

Process: try packaging with pyuninstaller first. Without – W parameter, everything is normal when packaging and running;

Problem: after trying to add the – W parameter (hide the terminal window), an error systemerror is found when running

Analysis: tracing the exception stack, it is found that the log output of flask is realized by writing the standard output. When the terminal window is not created, flask will fail to call the write method because it cannot obtain the expected standard output instance (expected to be: _io. Textiowrapper), thus throwing systemerror

Solution: explicitly redirect standard output before flash initialization

import sys
import os

sys.stdout = open(os.devnull, "w")  # Does not retain any standard output

# ------- The following is the original code -------
app = Flask(__name__)  # ...

Finally: Please note that this will invalidate all functions (Methods) that depend on standard output, which may include logs, Therefore, it is best to write to a file when there is little output or define a class or method to encapsulate when there is much output

ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy [How to Solve]

Build a new springcloud project, create a module (producer), build Eureka, and start with an error

Cause of problem:

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-netflix-eureka-server</artifactId>
        </dependency>

Should read:

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </dependency>

[Solved] nmon Startup Error: -bash: /usr/bin/nmon: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

nmon startup error: -bash: /usr/bin/nmon: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

Cause: Missing plugins.
Solution: yum install glibc.i686
Second, again prompted for exceptions. cannot open shared object file: No such file or directory

Reason: Still missing plug-ins
Solution:yum install ncurses-devel.i686

[Solved] Mybatis Mapping Error: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘id’ in ‘class java.lang.String

Problem code:

    <select id="selectIstars" parameterType="java.lang.String" resultType="java.lang.String">
        SELECT stars FROM book
        WHERE 1 = 1
        <if test="id != null">
            AND id = #{id,jdbcType=VARCHAR}
        </if>
    </select>

This is the problem with the final positioning code, which has been roughly understood by many online references:

There is a difference between the judgment of single parameter and multi parameter. When our input parameter is an entity class or map, there is no problem using the if parameter.

But when our input parameter is java.lang.integer or java.lang.string, we need to pay attention to some things

For integer type input parameters, add this

#{id,jdbcType=integer}

There is a problem with the input parameter of string type. I also added it

#{id,jdbcType=VARCHAR}

It still reported an error. Finally, the if judgment was deleted and the problem was solved, but it was still confused. If a big man understands it, please give me some advice

[Solved] Docker/k8s use Arthas to generate flame diagram Error: Perf events unavailable. See stderr of the target process.

Arthas generate flame diagram command

profiler start

Error message

Perf events unavailable. See stderr of the target process.

reason:

Officials listed the following reasons:

/proc/sys/kernel/perf_event_Paranoid is set to restricted mode (>= 2) (usually for this reason)

seccomp disables perf_event_Open API in a container (seccomp disables perf_event_open API in the container.)

OS runs under a hypervisor that does not virtualize performance counters

perf_event_Open API is not supported on this system, e.g. WSL

Solution:

Docker

Modify docker-compose.yml and add

    cap_add:
        - SYS_ADMIN

For example:

version: '1'
services:
  xxx:
    container_name: xxx
    hostname: xxx
    image: xxx
    ...
    # Make it possible to print flame maps in arthas
    cap_add:
        - SYS_ADMIN

k8s

Modify SVC configuration file and add

    securityContext:
      capabilities:
        add:
        - SYS_ADMIN

For example:

metadata:
  labels:
    service: hello-world
spec:
  containers:
  - image: "alpine:3.4"
    command: ["/bin/echo", "hello", "world"]
  
    # Make it possible to print flame maps in arthas
    securityContext:
      capabilities:
        add:
        - SYS_ADMIN

[Solved] handycontrol: numericupdown Fail to display custom error

The latest version seems to be 3.2

The errorstr property is set for the numericupdown control. The set string will not take effect regardless of whether it is with HC namespace or not. After looking at the source code, modify a sentence in numericupdown.cs as follows:

Official source code

public virtual bool VerifyData()
        {
            OperationResult<bool> result;

            if (VerifyFunc != null)
            {
                result = VerifyFunc.Invoke(_textBox.Text);
            }
            else
            {
                if (!string.IsNullOrEmpty(_textBox.Text))
                {
                    if (double.TryParse(_textBox.Text, out var value))
                    {
                        if (value < Minimum || value > Maximum)
                        {
                            result = OperationResult.Failed(Properties.Langs.Lang.OutOfRange);
                        }
                        else
                        {
                            result = OperationResult.Success();
                        }
                    }
                    else
                    {
                        result = OperationResult.Failed(Properties.Langs.Lang.FormatError);
                    }
                }
                else if (InfoElement.GetNecessary(this))
                {
                    result = OperationResult.Failed(Properties.Langs.Lang.IsNecessary);
                }
                else
                {
                    result = OperationResult.Success();
                }
            }

            SetCurrentValue(ErrorStrProperty, result.Message);
            SetCurrentValue(IsErrorProperty, ValueBoxes.BooleanBox(!result.Data));
            return result.Data;
        }

After modification

public virtual bool VerifyData()
        {
            OperationResult<bool> result;

            if (VerifyFunc != null)
            {
                result = VerifyFunc.Invoke(_textBox.Text);
            }
            else
            {
                if (!string.IsNullOrEmpty(_textBox.Text))
                {
                    if (double.TryParse(_textBox.Text, out var value))
                    {
                        if (value < Minimum || value > Maximum)
                        {
                            result = OperationResult.Failed($"范围{Minimum}-{Maximum}");
                        }
                        else
                        {
                            result = OperationResult.Success();
                        }
                    }
                    else
                    {
                        result = OperationResult.Failed(Properties.Langs.Lang.FormatError);
                    }
                }
                else if (InfoElement.GetNecessary(this))
                {
                    result = OperationResult.Failed(Properties.Langs.Lang.IsNecessary);
                }
                else
                {
                    result = OperationResult.Success();
                }
            }

            SetCurrentValue(ErrorStrProperty, result.Message);
            SetCurrentValue(IsErrorProperty, ValueBoxes.BooleanBox(!result.Data));
            return result.Data;
        }

[Modified] Multi input/output stream coders are not yet supported (org.apache.commons.compress)

java.io.IOException: Multi input/output stream coders are not yet supported
	at org.apache.commons.compress.archivers.sevenz.SevenZFile.buildDecoderStack(SevenZFile.java:1796)
	at org.apache.commons.compress.archivers.sevenz.SevenZFile.reopenFolderInputStream(SevenZFile.java:1669)
	at org.apache.commons.compress.archivers.sevenz.SevenZFile.buildDecodingStream(SevenZFile.java:1625)
	at org.apache.commons.compress.archivers.sevenz.SevenZFile.getNextEntry(SevenZFile.java:414)
	at reyo.sdk.utils.file.zip.compress.ZipUtils.read7zFile(ZipUtils.java:148)
	at reyo.sdk.utils.file.zip.compress.ZipUtils.main(ZipUtils.java:270)

Previous code:

while ((entry = zIn.getNextEntry()) != null) {}

Correction:

for (SevenZArchiveEntry entry : zIn.getEntries()) {}

[Err] 1055 – Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c

[Err] 1055 – Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
Solution:
1.mysql -u  root -p login mysql
2.show variables like ‘%sql_mode%’;
3.set global sql_mode=(select replace(@@sql_mode,’ONLY_FULL_GROUP_BY’,”));
4.exit;
Restart Navicat and you will not get this error anymore.

[Solved] json.decoder.JSONDecodeError: Expecting ‘,‘ delimiter: line xx column xx (char xxx)

1. Core source code

# Convert string JSON to JSON object

dataJson=json.loads(jsonStr, strict=False)

2. Cause of problem:

  Error copying and pasting a string as a string literal into Python source code.

3. Solution:

In this case, \n is interpreted as a single character (newline character). You can fix it by using the original string text (R ”, use three quotation marks R ” ”… ” ‘to avoid escaping the’ ‘quotation marks in the string text)