Author Archives: Robins

[Solved] appium Error: A new session could not be created

Error reported in appium:

selenium. common. exceptions. SessionNotCreatedException: Message: A new session could not be created. (Original error: Command failed: C:\\WINDOWS\\system32\\cmd.exe /s /c “D:\\tools\\Android\\android-sdk\\platform-tools\\adb.exe -s 127.0.0.1:62001 shell “ps ‘uiautomator'””

Execute the command in the error message in CMD:

The error message reported is: bad PID ‘uiautomator’

Solution:

1. Find ADB. In the appium installation directory JS file, directory:\appium\node_modules\appium\node_Modules\appium-ADB\lib
2. Open ADB.JS, find the following code:

ADB.prototype.shell = function (cmd, cb) {
  if (cmd.indexOf('"') === -1) {
    cmd = '"' + cmd + '"';
  }
  var execCmd = 'shell ' + cmd;
  this.exec(execCmd, cb);
};

3. Add the following code below the above code

//add
ADB.prototype.shell_grep = function (cmd, grep, cb){
    if (cmd.indexOf('"') == -1){
        cmd = '"' + cmd + '"';
    }
    var execCmd = 'shell' + cmd + '| grep ' + grep;
    this.exec(execCmd, cb);
};

4. Find the following code:

ADB.prototype.getPIDsByName = function (name, cb) {
  logger.debug("Getting all processes with '" + name + "'");
  this.shell("ps '" + name + "'", function (err, stdout) {
    if (err) return cb(err);
    stdout = stdout.trim();
    var procs = [];
    var outlines = stdout.split("\n");
    _.each(outlines, function (outline) {
      if (outline.indexOf(name) !== -1) {
        procs.push(outline);
      }
    });
    if (procs.length < 1) {
      logger.debug("No matching processes found");
      return cb(null, []);
    }
    var pids = [];
    _.each(procs, function (proc) {
      var match = /[^\t ]+[\t ]+([0-9]+)/.exec(proc);
      if (match) {
        pids.push(parseInt(match[1], 10));
      }
    });
    if (pids.length !== procs.length) {
      var msg = "Could not extract PIDs from ps output. PIDS: " +
                JSON.stringify(pids) + ", Procs: " + JSON.stringify(procs);
      return cb(new Error(msg));
    }
    cb(null, pids);
  });
};

4. Comment out the above code, start with/* and end with */comment

5. Replace with the following code

//replace
ADB.prototype.getPIDsByName = function (name, cb) {
  logger.debug("Getting all processes with '" + name + "'");
  this.shell_grep("ps", name, function (err, stdout) {
    if (err) {
      logger.debug("No matching processes found");
      return cb(null, []);
    }
    var pids = [];
    _.each(procs, function (proc) {
    var match = /[^\t ]+[\t ]+([0-9]+)/.exec(proc);
    if (match) {
    pids.push(parseInt(match[1], 10));
    }
    });
    if (pids.length !== procs.length) {
      var msg = "Could not extract PIDs from ps output. PIDS: " +
      JSON.stringify(pids) + ", Procs: " + JSON.stringify(procs);
      return cb(new Error(msg));
    }
    cb(null, pids);
  });
};

6. Restart appium

[Solved] reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response

Jetty service used by backend

report errors

2022-01-11 17:20:24.362  WARN 4784 --- [ctor-http-nio-3] r.netty.http.client.HttpClientConnect    : [id: 0x3eaaea4e, L:0.0.0.0/0.0.0.0:58790 ! R:localhost/127.0.0.1:8090] The connection observed an error

reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response

2022-01-11 17:20:24.362 ERROR 4784 --- [ctor-http-nio-3] a.w.r.e.AbstractErrorWebExceptionHandler : [31e53fe7-21772]  500 Server Error for HTTP GET "/status"

reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
	|_ checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
	|_ checkpoint ⇢ HTTP GET "/status" [ExceptionHandlingWebHandler]
Stack trace:

explain

Call the back-end service jetty through the gateway service spring cloud gateway and report an exception

reason

The back-end service automatically disconnects after the socket timeout, and the gateway service takes the disconnected connection from the httpclient connection pool to request

Reappearance

Spring Cloud GateWay : 2.2.1.RELEASE

Spring Cloud : Hoxton.SR1

Spring Boot : 2.3.4.RELEASE

Server uses springboot emulation

GateWay

spring:
  application:
    name: gateway
  cloud:
    gateway:
      httpclient:
        pool:
          max-idle-time: 60000ms
      routes:
      - id: dev
        uri: ${service-url.dev-service}/status
        predicates:
        - Path=/status
service-url:
  dev-service: http://localhost:8080
server:
  port: 8098

Server

spring:
  application:
    name: dev
server:
  tomcat:
    connection-timeout: 100ms

Jmeter

Threads:300
period seconds:5
Loop Count:20

explain:

Max idle time: maximum idle connection time

Connection timeout: timeout of socket read().

Gateway’s max idle time: the connection is released after 60000ms, and the connection timeout of the server is disconnected after 100ms. At this time, gateway will take the disconnected connection request from the connection pool, resulting in an error

 

Solution:

Because the server is the provider and the gateway is the consumer, try to ensure that the consumer disconnects before the provider, and the time for setting Max idle time is not greater than connection timeout

Jetty services

Jetty modified jetty.http.Idletimeout or http.timeout. Default 30000ms

 

[Solved] SpringBoot Access Redis Error: java.lang.NoSuchMethodError: redis.clients.jedis.JedisPoolConfig.setMinEvictableIdleTime

Complete error reporting information:

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed;
nested exception is java.lang.NoSuchMethodError: redis.clients.jedis.JedisPoolConfig.setMinEvictableIdleTime(Ljava/time/Duration;)V] with root cause

java.lang.NoSuchMethodError: redis.clients.jedis.JedisPoolConfig.setMinEvictableIdleTime(Ljava/time/Duration;)V

Reason 1:

Other components in Maven depend on the old version of jedis and need to be excluded

Solution to cause 1:

In <dependency></dependency> Add and exclude the dependency of old jedis

<exclusions>
    <exclusion>
        <groupId>redis.clients</groupId>
        <artifactId>jedis</artifactId>
    </exclusion>
</exclusions>

Reload Maven’s dependent components and run them again.

Reason 2:

Jedispoolconfig and jedissentinelpool use Apache Commons-pool2 package for Commons

Although no error will be reported when compiling the code, the runtime will prompt that the package cannot be found. (suspected to be the reason for using reflection)

Solution to cause 2:

In POM XML <dependencies></dependencies> Add the following configuration to the:

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-pool2</artifactId>
    <version>2.11.1</version>
</dependency>

Reload Maven’s dependent components and run them again.

[Solved] Linux Start solr Error: Your Max Processes Limit is currently 31202. It should be set to 65000 to avoid operational disruption.

Execute the startup specification after entering the bin directory

./solr start

report errors

What should I do?

View system limits

 ulimit -a

Now you need to change the system limit and log in to the root account

Locate the file/etc/security/limits At the end of conf, add the following two lines [added by default in some systems]

* soft nofile 65535
* hard nofile 65535

Then locate the file/etc/security/limits d/20-nproc.conf

Change 4096 to 65535

Login again and take effect after modification

Matplotlib.pyplot Plug-in Chinses Font Error: RuntimeWarning: Glyph 26376 missing from current font

Using Matplotlib When drawing with pyplot, add a Chinese font, which indicates that the font cannot be found. The solution is as follows

1. Download simhei Ttf (BOLD) font file;

2. Copy to D:\Python38\Lib\site-packages\matplotlib\mpl-data\fonts\ttf (My Catalog)

3. Modify the file D:\Python38\Lib\site-packages\matplotlib\mpl-data\matplotlibrc

 font.family         : sans-serif   
 # remove the previous #     
 font.sans-serif     : SimHei, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif  
 # remove the previous #, and add SimHei after the colon
 axes.unicode_minus  : False
 # remove the previous #, and change the True to False

4. Add code

# set the font
plt.rcParams['font.sans-serif'] = ['KaiTi', 'SimHei', 'FangSong'] 
plt.rcParams['font.size'] = 12 
plt.rcParams['axes.unicode_minus'] = False

5. Delete the buffer directory of Matplotlib
in the python environment of the terminal, enter the following command to view the font cache path of Matplotlib:

import matplotlib
matplotlib.get_cachedir()

Then exit the python environment and delete the cache directory on the terminal using the RM - RF + path

6. The font configuration is completed and can be used normally

K8s binary deployment start API-server error: Error: unknown flag: –etcdservers

 systemctl status kube-apiserver  failed to startup

check the error in the log

cat /var/log/messages|grep kube-apiserver|grep -i error

Jan 11 11:22:44 m1 kube-apiserver: --logtostderr                      log to standard error instead of files
Jan 11 11:25:16 m1 kube-apiserver: Error: unknown flag: --etcdservers
Jan 11 11:25:16 m1 kube-apiserver: --alsologtostderr                  log to standard error as well as files
Jan 11 11:25:16 m1 kube-apiserver: --logtostderr    

【Error: unknown flag: --etcdservers】 that I wrote the wrong string.

I copied the pdf content of the textbook; --etcdservers copied out and pasted into notepad, and found that the [-] symbol was missing.

chrome browser copy pdf - line feed content to notepad++ less [-] symbol

so pay attention to the differences in copying content.

Successful startup after correction

[Solved] nginx Error: directory index of “/home/www/hexo/” is forbidden

Note: Recently, when setting up hexo, I finished all the work. I found that nginx reported 403 Forbidden. I checked the log of nginx

Log information is recorded as follows:

*481 directory index of “/home/www/hexo/” is forbidden~~~~~~

Solution: go to the configuration file nginx.conf in the nginx conf directory Conf plus configure autoindex on; Automatic indexing

Restart ngxin

docker pull Error: Get https://hub.xxx.com/v1/_ping: dial tcp 192.168.1.8:443: getsockopt: connection refused

This problem is encountered when building your own docker warehouse on the intranet because docker does not support HTTP registry by default,

vim /etc/docker/daemon.JSON {“secure registers”: [“hub.Zuobiao.Com”]}

Restart docker

systemctl restart docker. service

Harbor pull code, and you need to log in first:

docker login http://192.168.1.191/ -u username -p password

[Solved] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.6…

Error message:Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.6:generate (default-cli) on project hzl-vehicle: Communications link failure
Reason:MySQL needs to specify whether to connect to SSL in higher versions
The & symbol is recognized as a special character in the idea, so replace the &amp. with an escape character;
<! –> Database connection configuration –>
<jdbcConnection driverClass=”com.mysql.jdbc.Driver”
connectionURL=”jdbc:mysql://localhost:3306/hzl_repair?useUnicode=true&amp;useSSL=false”
userId=”hzl” password=”hzl_repair” />