Category Archives: Error

[Solved] hcitool Error: Set scan parameters failed: Operation not permitted

Set scan parameters failed: operation not allowed

The reason is that the function of hcitool tool is missing, and the lescan function needs to be supplemented

sudo apt-get install libcap2-bin
sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hcitool`
getcap !$

Execute again at this time

hcitool -i hci1 lescan

It is found that it can be scanned normally

[Solved] VScode Error: build constraints exclude all Go files in syscall\js

When developing golang webassembly in vscode, an error is reported when importing the package. The code is as follows:

// main.go
package main

import "syscall/js"

func main() {
	alert := js.Global().Get("alert")
	alert.Invoke("Hello World!")
}

The error information is as follows:

could not import syscall/js (cannot find package "syscall/js" in any of 
	E:\Go\src\syscall\js (from $GOROOT)
	F:\go\Gopath\src\syscall\js (from $GOPATH))
error while importing syscall/js: build constraints exclude all Go files in E:\Go\src\syscall\js

The solution is as follows:

Open setting and enter go tools env

Open settings.JSON file, write in the file:

{
  "go.toolsEnvVars": {
    "GOOS":"js",
    "GOARCH":"wasm"
  }
}

Then reopen vscode.

nacos Start Error: Error creating bean with name ‘grpcClusterServer’

Today, I installed Nacos locally and reported the error creating bean with name ‘grpcclusterserver’ at startup. When I went to search for the cause of the error, I saw that a blogger said it would be better to try several more times. I didn’t know the specific reason, so I shut down and restarted directly and started again successfully
screenshot of error reporting:

screenshot of success:

ROS Error: warning: “deprecated pixel format used“

Error log

[swscaler @ 0x28dace0] deprecated pixel format used, make sure you did set range correctly

Reason for error reporting
The above error occurs when using the ROS usb_cam package to call the camera, the error log is written clearly, that is, the video format used is deprecated. The error format is mjpg, after changing it to yuyv, the problem is solved.

Opencv c++ Read Video Error: capture.isOpened() Return false

#include<iostream>
#include<opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main()
{
    VideoCapture capture;
    Mat frame;
    const string source = "/home/gear/big_disk_c/wangjd/shipintest/789.mp4";
    // frame= capture.open("789.mp4");
    frame= capture.open(source);
    if(!capture.isOpened())
    {
        printf("can not open ...\n");
        return -1;
    }
    printf("1213131\n");
    // namedWindow("output", CV_WINDOW_AUTOSIZE);

    while (capture.read(frame))
    {
        imshow("output", frame);
        waitKey(10);
    }
    capture.release();
    return 0;
}

Reason: Path. I have a permission problem with this server, and it will report an error if I write the full path. And the executable file I generated and the video file are not in the same directory, …/789.mp4 will not be read, only the two put together to read. Later I found out that
The constructor of capture.open() passed in a const string, so I instantiated a const string source first, then I could write the full path, and then passed it in.

const string source = "/home/gear/big_disk_c/wangjd/shipintest/789.mp4";
frame= capture.open(source);

[Solved] react Error: Can‘t perform a React state update on an unmounted component

Warning: Can’t perform a React state update on an unmounted component. This is a no-op, but it indic

In the development of react, we may often encounter this warning:

Can't perform a React state update on an unmounted component.This is a no-op, but it indicates a memory leak in your application.

We cannot set state after the component is destroyed to prevent memory leakage

As for the above errors when switching routes in react, the actual reason is that after the component is mounted, you perform asynchronous operations, such as Ajax requests or setting timers, and you perform setstate operation in callback. When you switch routes, the component has been unmounted. At this time, the callback is still executing in the asynchronous operation, so the setstate does not get a value.

There are two solutions:

1. Clear all operations when uninstalling (e.g. abort your Ajax request or clear timer)

componentDidMount = () => {
    //1.ajax request
    $.ajax('Your request',{})
        .then(res => {
            this.setState({
                aa:true
            })
        })
        .catch(err => {})
    //2.timer
    timer = setTimeout(() => {
        //dosomething
    },1000)
}
componentWillUnMount = () => {
    //1.ajax request
    $.ajax.abort()
    //2.timer
    clearTimeout(timer)
}

2. Set a flag and reset it when unmount

componentDidMount = () => {
    this._isMounted = true;
    $.ajax('Your Request',{})
        .then(res => {
            if(this._isMounted){
                this.setState({
                    aa:true
                })
            }
        })
        .catch(err => {})
}
componentWillUnMount = () => {
    this._isMounted = false;
}

3. The simplest way (oil of gold)

componentDidMount = () => {
    $.ajax('Your Request',{})
    .then(res => {
        this.setState({
            data: datas,
        });
    })
    .catch(error => {
 
     });
}
componentWillUnmount = () => {
    this.setState = (state,callback)=>{
      return;
    };
}

[Solved] Compile Error: cannot open include file ‘afxres.h‘

Problem Description:

compilation error: cannot open include file ‘afxres h’


Cause analysis:

this is the header file of MFC class library</ font>


Solution 1:

If the MFC component is not installed, you can replace it with the next two lines

//#include "afxres.h"
#include <Windows.h>
#include <winres.h>
//Only one line winres.h is OK!

Solution 2:

Just install MFC components

<script setup> Error: ‘defineProps‘ is not defined [How to Solve]

Solution 1: in eslintrc. JS env add configuration

  env: {
    'vue/setup-compiler-macros': true // New
  }

An error may be reported when the development service is restarted after configuration:

Environment key “vue/setup-compiler-macros” is unknown

Recompile again and the error disappears.

Solution 2: add global configuration in eslintrc.js

  globals: {
    defineProps: "readonly",
    defineEmits: "readonly"
  }

[Solved] Error contacting service. It is probably not running.

First, check whether more than half of the servers start zookeeper. If yes, use the JPS command and find that the quorumpeermain main class is not started

[atguigu@Hadoop103 zookeeper-3.5.7]$ jps
14850 Jps

The most likely cause: Zookeeper decompression path in the conf folder zoo.cfg (I am here after changing the name) configuration when adding the content after the addition of a space and the creation of myid up and down there are empty lines or left and right spaces, enter the file deleted, and then check the jps

#######################cluster########################## 
server.2=hadoop102:2888:3888 
server.3=hadoop103:2888:3888 
server.4=hadoop104:2888:3888

[Solved] eclipse Error: org.apache.hadoop.hbase.NotServingRegionException:

Error1: org.apache.hadoop.hbase.NotServingRegionException:
Error 2: Can’t get master address from ZooKeeper; znode data == null

[root@hadoop01 bin]# sh hbase hbck
2022-01-29 16:48:49,797 INFO  [main] client.HConnectionManager$HConnectionImplementation: getMaster attempt 9 of 35 failed; retrying after sleep of 10044, exception=java.io.IOException: Can't get master address from ZooKeeper; znode data == null

Solution:

Stop HBase and go to the bin directory of HBase

sh stop-hbase.sh

Start the zookeeper client and delete the/HBase node

[root@hadoop01 bin]# sh zkCli.sh
[zk: localhost:2181(CONNECTED) 1] rmr /hbase

Restart HBase cluster

sh start-hbase.sh

[Solved] integrated swagger Start Error: Failed to start bean ‘documentationPluginsBootstrapper‘;

Today, I reported an error when I was going to learn something new and build a new project integration swagger.

org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.15.jar:5.3.15]
	at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.15.jar:5.3.15]
	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.15.jar:5.3.15]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_241]
	at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.15.jar:5.3.15]
	at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.15.jar:5.3.15]
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.15.jar:5.3.15]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.15.jar:5.3.15]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.3.jar:2.6.3]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) [spring-boot-2.6.3.jar:2.6.3]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:414) [spring-boot-2.6.3.jar:2.6.3]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) [spring-boot-2.6.3.jar:2.6.3]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) [spring-boot-2.6.3.jar:2.6.3]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) [spring-boot-2.6.3.jar:2.6.3]
	at com.hf.logisticsinfo.LogisticsInfoApplication.main(LogisticsInfoApplication.java:10) [classes/:na]
Caused by: java.lang.NullPointerException: null
	at springfox.documentation.spi.service.contexts.Orderings$8.compare(Orderings.java:112) ~[springfox-spi-2.9.2.jar:null]
	at springfox.documentation.spi.service.contexts.Orderings$8.compare(Orderings.java:109) ~[springfox-spi-2.9.2.jar:null]
	at com.google.common.collect.ComparatorOrdering.compare(ComparatorOrdering.java:37) ~[guava-20.0.jar:na]
	at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) ~[na:1.8.0_241]
	at java.util.TimSort.sort(TimSort.java:220) ~[na:1.8.0_241]
	at java.util.Arrays.sort(Arrays.java:1438) ~[na:1.8.0_241]
	at com.google.common.collect.Ordering.sortedCopy(Ordering.java:855) ~[guava-20.0.jar:na]
	at springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider.requestHandlers(WebMvcRequestHandlerProvider.java:57) ~[springfox-spring-web-2.9.2.jar:null]
	at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper$2.apply(DocumentationPluginsBootstrapper.java:138) ~[springfox-spring-web-2.9.2.jar:null]
	at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper$2.apply(DocumentationPluginsBootstrapper.java:135) ~[springfox-spring-web-2.9.2.jar:null]
	at com.google.common.collect.Iterators$7.transform(Iterators.java:750) ~[guava-20.0.jar:na]
	at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:47) ~[guava-20.0.jar:na]
	at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:47) ~[guava-20.0.jar:na]
	at com.google.common.collect.MultitransformedIterator.hasNext(MultitransformedIterator.java:52) ~[guava-20.0.jar:na]
	at com.google.common.collect.MultitransformedIterator.hasNext(MultitransformedIterator.java:50) ~[guava-20.0.jar:na]
	at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:249) ~[guava-20.0.jar:na]
	at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:209) ~[guava-20.0.jar:na]
	at com.google.common.collect.FluentIterable.toList(FluentIterable.java:614) ~[guava-20.0.jar:na]
	at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.defaultContextBuilder(DocumentationPluginsBootstrapper.java:111) ~[springfox-spring-web-2.9.2.jar:null]
	at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.buildContext(DocumentationPluginsBootstrapper.java:96) ~[springfox-spring-web-2.9.2.jar:null]
	at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:167) ~[springfox-spring-web-2.9.2.jar:null]
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.15.jar:5.3.15]
	... 14 common frames omitted

The general reason is that due to the springboot version problem, the default strategy for matching the request path after 2.6 and spring MVC processing mapping has been changed from antpathmatcher to pathpatternparser.

So the solution here is also very simple

The first solution is to set up spring according to the official prompts mvc.pathmatch.Matching strategy is ant path matcher, which is effective and available for personal testing;

spring:
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher

The second solution is to directly reduce the springboot version. I’ll try to reduce it to level 2.4 here. There’s no problem

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>