Tag Archives: development language

Message log output sbridge: Handling MCE memory error error

/The var/log/message system log is always output, causing the/partition disk to be full

sbridge: HANDLING MCE MEMORY ERROR
kernel: CPU 8: Machine Check Exception: o Bank 5: cc00020000010090
kernel: TSC O ADDR 2068ce8080 MISC 40109086 PROCESSOR O: 206d6 TIME 1634693540 SOCKET 1 APIC 20

resolvent:

 rmmod -v sb_edac

Error creating bean with name ‘org.springframework.security.oauth2.config.annotation.web.configurati

The following error occurs mainly because the configuration of the resource server is added, but the service is not identified as a resource server.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration': Post-processing of merged bean definition failed; nested exception is java.lang.TypeNotPresentException: Type javax.servlet.Filter not present
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) ~[spring-beans-5.3.5.jar:5.3.5]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.5.jar:5.3.5]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.5.jar:5.3.5]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.5.jar:5.3.5]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.5.jar:5.3.5]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.5.jar:5.3.5]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.5.jar:5.3.5]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.5.jar:5.3.5]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.5.jar:5.3.5]
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:63) ~[spring-boot-2.4.4.jar:2.4.4]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:769) [spring-boot-2.4.4.jar:2.4.4]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-2.4.4.jar:2.4.4]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) [spring-boot-2.4.4.jar:2.4.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) [spring-boot-2.4.4.jar:2.4.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1313) [spring-boot-2.4.4.jar:2.4.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) [spring-boot-2.4.4.jar:2.4.4]
	at com.zsh.GatewayApplication.main(GatewayApplication.java:16) [classes/:na]
Caused by: java.lang.TypeNotPresentException: Type javax.servlet.Filter not present
	at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117) ~[na:1.8.0_261]
	at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125) ~[na:1.8.0_261]
	at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) ~[na:1.8.0_261]
	at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68) ~[na:1.8.0_261]
	at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138) ~[na:1.8.0_261]
	at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) ~[na:1.8.0_261]
	at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:108) ~[na:1.8.0_261]
	at java.lang.Class.getGenericInterfaces(Class.java:913) ~[na:1.8.0_261]
	at org.springframework.core.ResolvableType.getInterfaces(ResolvableType.java:502) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.core.ResolvableType.as(ResolvableType.java:450) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.core.ResolvableType.as(ResolvableType.java:451) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.core.ResolvableType.as(ResolvableType.java:456) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.core.ResolvableType.as(ResolvableType.java:456) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1341) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1324) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1291) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1281) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.core.BridgeMethodResolver.isResolvedTypeMatch(BridgeMethodResolver.java:157) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.core.BridgeMethodResolver.isBridgeMethodFor(BridgeMethodResolver.java:141) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.core.BridgeMethodResolver.searchCandidates(BridgeMethodResolver.java:120) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.core.BridgeMethodResolver.findBridgedMethod(BridgeMethodResolver.java:82) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.lambda$buildResourceMetadata$1(CommonAnnotationBeanPostProcessor.java:390) ~[spring-context-5.3.5.jar:5.3.5]
	at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:324) ~[spring-core-5.3.5.jar:5.3.5]
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.buildResourceMetadata(CommonAnnotationBeanPostProcessor.java:389) ~[spring-context-5.3.5.jar:5.3.5]
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.findResourceMetadata(CommonAnnotationBeanPostProcessor.java:347) ~[spring-context-5.3.5.jar:5.3.5]
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:295) ~[spring-context-5.3.5.jar:5.3.5]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1098) ~[spring-beans-5.3.5.jar:5.3.5]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) ~[spring-beans-5.3.5.jar:5.3.5]
	... 16 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_261]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_261]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) ~[na:1.8.0_261]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_261]
	at java.lang.Class.forName0(Native Method) ~[na:1.8.0_261]
	at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_261]
	at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114) ~[na:1.8.0_261]
	... 43 common frames omitted

2021-10-31 18:29:13.998  WARN 8204 --- [       Thread-8] c.a.n.common.http.HttpClientBeanHolder   : [HttpClientBeanHolder] Start destroying common HttpClient
2021-10-31 18:29:13.998  WARN 8204 --- [       Thread-8] c.a.n.common.http.HttpClientBeanHolder   : [HttpClientBeanHolder] Destruction of the end

Process finished with exit code 1

There are two main solutions to this problem

First: remove the configuration of the resource server
Second: add the @ enableresourceserver annotation on the startup class

Start again to succeed!

Could not find method causes verifyerror, which in turn causes crash

On Android 5.0 and below, sometimes the course not find method causes verifyerror, which leads to crash. The writing method is as follows:

 

As shown in the figure above, calling static method test1 on Android 4.4 mobile phone will report the following error:

  10-28 16:02:40.913 2792-2792/com.example.myapplication I/dalvikvm: Could not find method com.bumptech.glide.Glide.with, referenced from method com.example.myapplication.TestKt.test2
10-28 16:02:40.913 2792-2792/com.example.myapplication W/dalvikvm: VFY: unable to resolve static method 4: Lcom/bumptech/glide/Glide;. with (Landroid/content/Context;)Lcom/bumptech/glide/RequestManager;

The reason is that Android 5 is a delvikvm virtual machine before, and then other static methods will be loaded when the static method is invoked. So when the test1 is called, the Glide in test2 will be loaded, but at this time it will be found that the with method can not find the method, so the problem can not be found, which will lead to the explosion of VerifyError error.

Solution: Although compileonly is intentionally written above, brand differentiation may occur on mobile phones of different brands, and then some brands do not rely on relevant classes to report errors. Therefore, you can change the places in test2 that need to be called to the dynamic loading mode, that is, the reflection mode, so that test2 will be loaded when test1 is called, However, the reflection method must be called to load the class, that is, the problem of calling test1 and then failing to find the method will not occur.

Examples of solutions are as follows:

public fun test2(context:Context) {
    try {
        Log.e("Test", "test1")
        val clazz = Class.forName("com.bumptech.glide.Glide")
        val getMethod: Method = clazz.getMethod("with", context.javaClass)
        getMethod.invoke(null, context)
    } catch (e: Exception) {
        Log.e("Test","test1 e "+e.message)
    }
}

Note: the above error is OK on Android 5.0 and above phones. It should be the difference between dalvikvm and artvm

numpy.core._exceptions.MemoryError: Unable to allocate xxx GB

This error was reported during the training of 15W pieces of data recently, but I only used 60% of my local memory. After solving it, record it.

After checking, it should be the problem of Python bits. At first, my local is 32 bits.  

If your Python is 32-bit, your pandas and numpy can only be 32-bit. When your memory usage exceeds 2G, the memory will be automatically terminated

Later, it was changed to 64 bit, and there was no error

[Solved] Console error: syntax error: illegal return statement

Problem Description:

When you run the code containing the return statement directly in the script tag or in the browser console, an error is reported:

SyntaxError: Illegal return statement

if (!NaN) {
	console.log('went into the conditional statement')
	return "Ollie gives!"
}

reason:

In JavaScript, the return statement can only be placed in the function, otherwise the following error will pop up.

SyntaxError: Illegal return statement

Solution:
package the modified code block in function.

(function () {
	if (!NaN) {
		console.log('went into the conditional statement')
	return "Ollie gives!"
	}
})()

// Run results 
It goes into the conditional statement
"Ollie gives!"

How to Solve Mybatis error: invalid bound statement (not found)

Solve the mybatis error invalid bound statement (not found)

Reason for this error

1. XML file does not exist

2. The XML file and mapper are not mapped

Namespace specifies the path of mapper. The error ID is inconsistent with the method name in mapper

3. The XML file is in the Java directory instead of the resource directory, so there is no XML in the generated target

Scene

When using the mybatis plus framework, when customizing the mapper interface and XM file, because the MP automatic code generation plug-in is used, the mapper interface and XML file are in the Java directory. During compilation, the XML file under the Java path will not be automatically compiled, and the compilation will only identify the. Java file, Only XML files under resource can be compiled when packaged.

The following figure shows the XML and mapper directories of the MP auto generated code plug-in (no longer in the resource)

The compiled target directory is as follows:

Solution:

1. Add in POM file

    <build>
        <!-- The *.xml file in the java directory will also be packaged when the project is packaged -->
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>
    </build>

2. Manually move the XML file in the Java directory to the resource directory and add it to the configuration file in spring boot

mybatis-plus:
	mapper-locations: classpath:**/*.xml //After the classpath add the directory of your xml file

The directory in mapper locations must be consistent with the directory where you place XML files, otherwise this error will occur even if there are XML files in target!!!

[Local Precompilation Error] do not set execute permissions for source files

1. Problem occurrence scenario

I created three new files under the project file. When submitting the code, I precompiled the script locally, and three errors occurred: do not set execute permissions for source files. Each file corresponds to one such error.

2. Understanding of error reporting

Do not set execute permissions for source files: do not set executable permissions for source files
understanding: you need to change the permission of the file to non-executable
for the understanding of file permissions, see how to understand file permission settings in this blog – 644 755 777, etc

3. Solution

1) On the console, after entering the file directory, enter
LS – L
to view the current permissions of the file. It is found that the file has “executable permissions”: X (generally 755)

2) Enter Chmod < File permission type, generally changed to 644><File name>

How to Solve Client-go Mod Error

Error message:

E:\github\client-go>go mod tidy
go: finding module for package k8s.io/client-go/kubernetes
go: finding module for package k8s.io/client-go/tools/clientcmd
go: finding module for package k8s.io/apimachinery/pkg/apis/meta/v1
go: found k8s.io/apimachinery/pkg/apis/meta/v1 in k8s.io/apimachinery v0.22.2
go: finding module for package k8s.io/client-go/kubernetes
go: finding module for package k8s.io/client-go/tools/clientcmd
client-go imports
        k8s.io/client-go/kubernetes: module k8s.io/client-go@latest found (v1.5.2), but does not contain package k8s.io/client-go/kubernetes
client-go imports
        k8s.io/client-go/tools/clientcmd: module k8s.io/client-go@latest found (v1.5.2), but does not contain package k8s.io/client-go/tools/clientcmd

Solution:
always specify three files in the go.mod file

require (
    ...
    k8s.io/api v0.19.0
    k8s.io/apimachinery v0.19.0
    k8s.io/client-go v0.19.0
    ...
)

How to Solve JVM Common Errors: outofmemoryerror & stackoverflowerror

OutOfMemoryError

Error cause: java.lang.outofmemoryerror: Java heap space heap memory overflow
solution: adjust the size of the heap memory

// -Xms1m -Xmx10m -XX:+PrintGCDetails
		List<Object> listObject = new ArrayList<>();
		for (int i = 0; i < 10; i++) {
			System.out.println("i:" + i);
			Byte[] bytes = new Byte[1 * 1024 * 1024];
			listObject.add(bytes);
		}
		System.out.println("Added successfully...");

StackOverflowError

Cause of error: java.lang.stackoverflowerror is expressed as stack overflow, which generally occurs in recursive calls
solution: set the maximum thread call depth, which is 1m by default

//-Xss5m Set the maximum call depth
public class StackTest {
	private static int count;
	public static void count(){
		try {
			count++;
			count(); 
		} catch (Throwable e) {
			System.out.println("the maximum depth:"+count);
			e.printStackTrace();
		}
	}
	public static void main(String[] args) {
			 count();
	}
}