Tag Archives: solution

Appium common error reports

(1) Appium service is not started

         [error message] urllib.error.urlerror: & lt; Urlopen error [winerror 10061] unable to connect because the target computer actively refused.

         [solution] after clicking the start appium button, the [appium] welcome to appium v1.7.2 prompt appears, and then run the script

(2) Session conflict

         Error: failed to start an appium session, err was: error: requested a new session but one was in progress

         [solution] restart the appium service, start the appium service, check the allow session override option in the advanced interface, restart the appium test, and add driver. Quit() in afterclass at the end of the test

(3) Device not connected

         [error message] selenium. Common. Exceptions. Webdriverexception: Message: an unknown server side error occurred while processing the command. Original error: could not find a connected Android device

         [solution] ADB ensure that the device is connected

(4) Java not installed or version problem

         [error message] selenium.common.exceptions.webdriverexception: Message: a new session could not be created. (original error: ‘Java – version’ failed. Error: command failed: C: \ windows \ system32 \ cmd.exe/S/C “Java – version”“

         [solution] check Java environment variables

(5) The launchable activity value is written incorrectly

         [error message] activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launching activity

         [solution]  correct the misspelling of launch activity.

(6) System permission problem

         [error message] failure [install_failed_user_restricted])

         [solution] 1. USB installation management permission limit. Just close it. 2. Turn on the option to allow unknown source app installation

(7) Appium service exception

         [error message] an unknown server side error occurred while processing the command “while opening the app

         [solution] restart appium service

(8) JRE environmental issues

         [error message] are you sure you have installed JDK/JRE?

         [solution] check whether there is JRE in the same level directory of JDK, and check the environment variable configuration of JDK

(9) Android SDK environment     

         [error message] no such file or directory “E: \ android_sdk”

         [solution] check the environment variable configuration of Android SDK, especially android_home

(10) Uiautomator error

         [error message] uiautomator version is too low/high

         [solution] add “automationname”: “uiautomator2” to the capability configuration information

Mobaxterm connects to Ubuntu server through SSH network error: software caused connection abort

Recently, mobaxterm is used to connect to the remote Ubuntu server through SSH. After not operating for a period of time, the connection will be broken and a prompt “network error: software caused connection abort” will be displayed.

You can modify the SSH configuration item in mobaxterm and check SSH keepalive to solve the problem of disconnection.

In addition, you need to modify the configuration file on the Ubuntu server side.

sudo vi /etc/ssh/sshd_config

1. Find tcpkeepalive yes and # remove the previous one;

2. Find the clientaliveinterval parameter, remove the previous #, and change the following 0 to 60, indicating that the request is sent every minute to maintain the connection.


Digression. To maintain the connection, you can use commands such as top to refresh the command line in real time.

[Solved] ERROR com.alibaba.druid.pool.DruidDataSource – init datasource error, url jdbcmysql

Error reporting when deploying an open source project

ERROR com.alibaba.druid.pool.DruidDataSource - init datasource error, url jdbcmysql://

Obviously, there is a database connection error

But after eliminating the error, I can find the real cause of the error

Database connection address error

Network problems

Wrong user name and password

Finally, it was found that there was a problem with the MySQL driver version of the open source project, which was inconsistent with the MySQL I installed

Solution:

Go to POM.XML and delete the version information of MySQL, which can be used by default, as shown below

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
</dependency>

error Expected indentation of 2 spaces but found 8

 

Originally, two spaces were needed, but there were actually eight. The appearance of eight spaces is generally caused by the tab key

Comment out this line:         ‘@ vue/standard’

It is important to note that after modifying the. Eslintrc.js file, it can take effect only after restarting
according to the startup command of your project: NPM run serve

NestedServletException, Handler dispatch failed; nested exception is java.lang.StackOverflowError [Solved]

After setting up the spring security oauth2 environment, conduct interface test with postman:

Postman returned an error message:

The idea console outputs the following warnings:

WARN 4344 — [nio-8082-exec-1] o.s.s.o.provider.endpoint.TokenEndpoint  : Handling error: NestedServletException, Handler dispatch failed; nested exception is java.lang.StackOverflowError

After investigation, it is found that a method in the spring security configuration class securityconfiguration written by myself is wrong and written as: AuthenticationManager. The correct method name should be authenticationmanagerbean.

The complete and correct method is:

@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
      return super.authenticationManagerBean();
}

Retest after modification and return the correct result:

If you encounter any problems during browsing, please leave me a message in the comment area below.

[Solved] Github Push Codes Error: “error:RPC failed;curl 56 OpenSSL SSL_read:SSL_ERROR_SYSCALL,errno 10054”

Error description

At the weekend, I did something with my computer, installed GitHub again, and reported an error “error: RPC failed” when I made some changes to the cloning project and prepared to push it; curl 56 OpenSSL SSL_ read: SSL_ ERROR_ Syscall, errno 10054 “, searched various solutions on the Internet. It is found that the GIT upload file has a limited file size. Just set the cache size.

Solution

Use Git   Bash enter the code under the current project:

git config --global http.postBuffer 1048576000

Globally set the cache size to 1g, and the problem is solved. I guess this may be because I use HTTPS. I don’t encounter this problem with SSH transmission and pull code in my office.

[Solved] Error “incorrect padding” in decoding of Base64 module in Python

Problem description
decodes the field information encoded by Base64, which is normally decoded in the base64 encoding and decoding tool, but b64decode and A2B in the modules Base64 and binascii under python_ Decoding error in Base64 and other methods
the error information is as follows

---------------------------------------------------------------------------
Error                                     Traceback (most recent call last)
<ipython-input-11-787bc11958b4> in get_proxies(urls)
     14         try:
---> 15             raw = base64.b64decode(response)
     16         except Exception as r:

c:\program files\python3\lib\base64.py in b64decode(s, altchars, validate)
     86         raise binascii.Error('Non-base64 digit found')
---> 87     return binascii.a2b_base64(s)
     88 

Error: Incorrect padding

Solution

Base64 in Python is read in 4, so the field to be decoded should be a multiple of 4, not enough to add ‘=’

# The field a to be decoded is judged, and if it is a multiple of 4, it is unchanged, and if not, how much is missing, how much is made up
a = a + '=' * (4 - len(a) % 4) if len(a) % 4 != 0 else a

Hystrix fuse of spring cloud system

Problem phenomenon: continuous clicking causes the fusing of hystrix

The solution on the Internet is to adjust the maxqueuesize property. After the modification, the following error still appears. Why does the maxqueuesize property not work?Later, by checking the official documents, we found that hystrix also has a queuesizerejectionthreshold property, which controls the maximum threshold of the queue. By default, hystrix only has five, Therefore, even if we set the maxqueuesize value to be larger, it will not work. Both properties must be configured at the same time

could not be queued for execution and no fallback available

Solution

hystrix:
  threadpool:
    default:
      coreSize: 200 #Maximum number of threads for concurrent execution, default 10
      maxQueueSize: 1000 #Max queue size of BlockingQueue, default -1
      queueSizeRejectionThreshold: 800 #Even if maxQueueSize is not reached, the request will be rejected after reaching the value of queueSizeRejectionThreshold

Aspecj cannot intercept method annotations on an interface

Aspecj cannot intercept method annotations on an interface

Aspecj can’t intercept the method annotation on the interface, it can only act on the method of the implementation class. At this time, it needs to use methodinterceptor to implement.

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface AopTest {
}

Interface

public interface TestAOPI {
    @AopTest
    public String test();

}

Implementation class 1

@Service
public class TestAOPService implements TestAOPI{
    @Override
    public String test() {
        return "service";
    }
}

Implementation class 2

@Service
public class TestAOPService2 implements TestAOPI{
	@AopTest
    @Override
    public String test() {
        return "service";
    }
}

Aspecj (partially valid)

If and only if the @ aoptest annotation is added to the method of the implementation class, it will take effect (implementation class 2), but implementation class 1 will not

@Aspect
@Configuration
public class AopTestAspect {
  /**
     * Identifies the method annotated with OperationLog
     */
    @Pointcut("@annotation(com.example.demo1.config.AopTest)")
    public void methodHasAopTestAnnotation() {
    }
    
    @Around("methodHasAopTestAnnotation()")
    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("aop!!!");
        return joinPoint.proceed();
    }
}

Solution

It needs to be changed to the following way by manual

@Configuration
public class AopTestConfiguration {
	@Bean
    public Advisor methodPointcutAdvisor() {
        AopTestMethodPointcutAdvisor advisor = new AopTestMethodPointcutAdvisor();
        advisor.setAdvice(new AopTestInterceptor());
        return advisor;
    }

    class AopTestInterceptor implements MethodInterceptor {
        @Override
        public Object invoke(MethodInvocation invocation) throws Throwable {
            String name = invocation.getMethod().getName();
            System.out.println("==============" + name + " before ================");
            Object result = invocation.proceed();
            System.out.println("==============" + name + " after ================");
            return result;
        }
    }
    public class AopTestMethodPointcutAdvisor extends StaticMethodMatcherPointcutAdvisor {
        @Override
        public boolean matches(Method method, Class<?> targetClass) {
        	// Implementing a class method with a target annotation on it
            if(method.isAnnotationPresent(AopTest.class)){
                return true;
            }
            // The method has a corresponding interface method and the interface method is annotated
            Class<?>[] interfaces = method.getDeclaringClass().getInterfaces();
            for (int i = 0; i < interfaces.length; i++) {
                Method[] methods = interfaces[i].getMethods();
                for (int j = 0; j < methods.length; j++) {
                    if(methods[j].getName().equals(method.getName())){
                        return methods[j].isAnnotationPresent(AopTest.class);
                    }
                }
            }
            return false;
        }
    }
}

After Nacos started, the client worker log was printed all the time

After Nacos started, the client worker log was printed all the time

Phenomenon

Print the clientworker log all the time

2020-08-24 00:57:30.977 INFO  [12932] --- [.cn_8848-public] c.a.n.client.config.impl.ClientWorker    : [fixed-nacos.itlym.cn_8848-public] [data-received] dataId=common.yml, group=DEFAULT_GROUP, tenant=public, md5=8c191cace81179b01fb745b5d027c1c8, content=xxx
2020-08-24 00:57:30.989 INFO  [12932] --- [.cn_8848-public] c.a.n.client.config.impl.ClientWorker    : [fixed-nacos.itlym.cn_8848-public] [data-received] dataId=sms-center.yml, group=DEFAULT_GROUP, tenant=public, md5=f12bc945ba0c1d39f3dea2e0977db712, content=xxx
...

Cause analysis

Root cause

Having seen the source code of Nacos before, Nacos will check whether the configuration items are consistent with the server configuration items every 10ms. If not, it will pull the latest configuration from the server therefore, if the MD5 algorithms of Nacos client and Nacos server are different, it will lead to misjudgment, thus constantly refreshing and printing the client worker logs.

Direct cause

My Nacos server is 1.3, and the client uses spring cloud Alibaba. Version . Click to find that the Nacos client version is 1.2

			<dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>2.2.1.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

Here, the spring-cloud-alibaba-dependencies‘s official website and warehouse have not been updated for a long time, which is easy to make complaints about users and waste a lot of investigation time.

Other possible reasons

The public is set in the namespace. See the Nacos GitHub

At this time, the best way to solve this problem is not to set the namespace. Otherwise, when Nacos releases a new version, it may be 1.4

Solution

Method 1:

Change the version of client and Nacos server to the same, as follows

client:
<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>${spring-cloud-alibaba.version}</version>
    <type>pom</type>
    <scope>import</scope>
    <exclusions>
    <exclusion>
        <artifactId>com.alibaba.nacos</artifactId>
        <groupId>nacos-client</groupId>
    </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>com.alibaba.nacos</groupId>
    <artifactId>nacos-client</artifactId>
    <version>1.3.2</version>
</dependency>

Method 2:

Because spring cloud Alibaba dependencies leaves the gap of properties specified version (default < nacos.client.version> 1.2.1)
so you only need to add

<properties>
	<nacos.client.version>1.2.1</nacos.client.version>
</properties>

Note: if spring cloud starter Nacos config is introduced, it can’t be avoided by this scheme, because ‘spring cloud Alibaba dependencies’ has hard coding problems. When importing, you should actively specify the version.

			 <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
                <version>1.3.0</version>
            </dependency>

Method 3 (middleware upgrade scheme suitable for existing system):

Download the Nacos client Version 1.2.1 code, modify its md5util package path to a new one, and then re publish it to the local or private warehouse.

How to Solve Spring Cloud Error context has been closed already

Context has been closed already solution

Error code

With such a piece of code, the context has been closed already error may occur during running, and once it occurs, it will make an error every time it runs in the future.

@Component
public class SpringContextUtil implements ApplicationContextAware {

    private static ApplicationContext context = null;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        ApplicationContextExt.context = applicationContext;
    }

	/**
	 * This static method allows you to retrieve the desired bean from the Spring context.
	 */
	public static <T> T getBean(Class<T> cls) {
        if (context == null)
            throw new IllegalStateException("no application context aviliable.");
        try {
            return (T) context.getBean(cls); // Wrong!
        } catch (BeansException e) {
			throw new RuntimeException(e);
        }
        return (T) null;
    }
}    

Cause analysis

However, when spring cloud context. Jar is included in the classpath, because the contextrefresher class will close the old context when the context is refreshed, so that the context in the static class has been closed, so this error will occur.

Trigger exploration

Find out the direct reason. Find out that a jar that you depend on listens to a notification from MQ. When you hear the message to be refreshed, you will refresh the context, which leads to this phenomenon.