Tag Archives: Exception handling

[Solved] Eclipse SVN Plug-in Submit Error: org.eclipse.team.svn.core.connector.SVNConnectorException…

Error Message:

org.eclipse.team.svn.core.connector.SVNConnectorException: svn: E175002: SSL handshake failed: 'The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]'

Solution:

Open Eclipse Setting:
Preference->Version Control(Team)->SVN
Check [SVN Connector] on the right tab
Inside the SVN Connector dropdown box to change an option, I am choosing Native Java HL 1.8… The problem was solved.

Error: error from slirp4netns while setting up port redirection: map[desc:bad request: add_hostfwd:

Causes: accidentally use kill -9 to delete the Podman container running java program process, start the container again with an error

Description of the problem: The problem is because the port is occupied, can not start

Solution: This is because the port is occupied, you can only find out which process is occupying the port through netstat (I am showing the PID/slirp4netns ), and then kill the process number of the occupied port PID with kill -9

How to Solve Junit Unit Test Error: “No runnable methods“

Abnormal

The errors reported by JUnit unit test are as follows:

java.lang.Exception: No runnable methods

	at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:191)
	at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:128)
	at org.junit.runners.ParentRunner.validate(ParentRunner.java:416)
	at org.junit.runners.ParentRunner.<init>(ParentRunner.java:84)
	at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:65)
	at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:10)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
	at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
	at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
	at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:36)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:50)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

error code

import org.junit.Test;

public class Test01 {

    @Test
    public void test(){
        System.out.println("hello world");
    }
}

reason

There is no problem with the code @ test annotation is placed on the method, and the @test annotation is also from the package org.junit.Test

Simulate the environment where the problem code occurs: Maven project, with a main/Java/test01.Java and test/Java/test01.Java class

main/java/Test01.java

import org.junit.Test;

public class Test01 {
    @Test
    public void test01() {
        System.out.println("hello world - main/java/Test01.java");
    }
}

test/java/Test01.java

public class Test01 {
    public static void main(String[] args) {
        System.out.println("hello world - test/java/Test01.java");
    }
}

To solve the above problems, the following conditions must be met:

1.The same path. It means that the path of the class must be at the same level. If the test/java/Test01.javaand mian/java/Test01.javais the same level, the test/java/Test01.javaand mian/java/hello/Test01.javais not the same level , and there will be no conflict.
2.Same class name. Refer to the same class name in the same path as test/java/Test01.javathe main/java/Test01.javasame path and is both the name of the same class, test/java/Test02.javawith the main/java/Test01.javaconflict although the same path but different class name, it will not happen.
3.Use @Testcomments or not. In the case where the path and class name are the same, if main/java/Test01.javathere is an @Testannotated method in it, and test/java/Test01.javathere must be no @Testannotated method in it, this conflict will occur. If there is an @Testannotated method and the method name is different, it will be reported to use Junit Unit test error “No tests found matching Method test01(Test01) from ClassRequest@5387f9e0” .

After the above conditions are met, the above error will be reported by executing the test method with @test annotation under main/Java .

Solution:

Make their class paths different.

Make their class names different

Under test/Java, there must be methods using @test annotations

In short, it is recommended not to write test methods with @test comments under main/Java, let alone conflict them.

The authentication server Configurate NoClassDefFoundError Error (store client information in a JDBC-based database)

1. Error reported: caused by: java.lang.noclassdeffounderror: org/springframework/JDBC/core/rowmapper

Problem reason: JDBC related dependencies are missing. Add the following dependencies:

<dependency>
  <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>

The detailed error reports are as follows:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-11-17 09:54:25.841 ERROR 18008 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot configure enpdoints
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:160) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:415) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE]
	at oauth.QriverAuthServerApplication.main(QriverAuthServerApplication.java:14) [classes/:na]
Caused by: java.lang.IllegalStateException: Cannot configure enpdoints
	at org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration.init(AuthorizationServerEndpointsConfiguration.java:81) ~[spring-security-oauth2-2.3.4.RELEASE.jar:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_281]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_281]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_281]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_281]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	... 19 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenServices' defined in class path resource [oauth/config/AuthorizationServerConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices]: Factory method 'tokenServices' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcClientDetailsService' defined in class path resource [oauth/config/AuthorizationServerConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.ClientDetailsService]: Factory method 'jdbcClientDetailsService' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/core/RowMapper
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:483) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.resolveBeanReference(ConfigurationClassEnhancer.java:362) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:334) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at oauth.config.AuthorizationServerConfig$$EnhancerBySpringCGLIB$$a1ad4a51.tokenServices(<generated>) ~[classes/:na]
	at oauth.config.AuthorizationServerConfig.configure(AuthorizationServerConfig.java:89) ~[classes/:na]
	at org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration.init(AuthorizationServerEndpointsConfiguration.java:79) ~[spring-security-oauth2-2.3.4.RELEASE.jar:na]
	... 26 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices]: Factory method 'tokenServices' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcClientDetailsService' defined in class path resource [oauth/config/AuthorizationServerConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.ClientDetailsService]: Factory method 'jdbcClientDetailsService' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/core/RowMapper
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	... 40 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcClientDetailsService' defined in class path resource [oauth/config/AuthorizationServerConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.ClientDetailsService]: Factory method 'jdbcClientDetailsService' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/core/RowMapper
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:483) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.resolveBeanReference(ConfigurationClassEnhancer.java:362) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:334) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at oauth.config.AuthorizationServerConfig$$EnhancerBySpringCGLIB$$a1ad4a51.jdbcClientDetailsService(<generated>) ~[classes/:na]
	at oauth.config.AuthorizationServerConfig.tokenServices(AuthorizationServerConfig.java:50) ~[classes/:na]
	at oauth.config.AuthorizationServerConfig$$EnhancerBySpringCGLIB$$a1ad4a51.CGLIB$tokenServices$1(<generated>) ~[classes/:na]
	at oauth.config.AuthorizationServerConfig$$EnhancerBySpringCGLIB$$a1ad4a51$$FastClassBySpringCGLIB$$991f75cc.invoke(<generated>) ~[classes/:na]
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at oauth.config.AuthorizationServerConfig$$EnhancerBySpringCGLIB$$a1ad4a51.tokenServices(<generated>) ~[classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_281]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_281]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_281]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_281]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	... 41 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.ClientDetailsService]: Factory method 'jdbcClientDetailsService' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/core/RowMapper
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	... 64 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/jdbc/core/RowMapper
	at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_281]
	at java.lang.ClassLoader.defineClass(ClassLoader.java:756) ~[na:1.8.0_281]
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_281]
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468) ~[na:1.8.0_281]
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74) ~[na:1.8.0_281]
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369) ~[na:1.8.0_281]
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363) ~[na:1.8.0_281]
	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_281]
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362) ~[na:1.8.0_281]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_281]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) ~[na:1.8.0_281]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_281]
	at org.springframework.security.oauth2.provider.client.JdbcClientDetailsService.<init>(JdbcClientDetailsService.java:83) ~[spring-security-oauth2-2.3.4.RELEASE.jar:na]
	at oauth.config.AuthorizationServerConfig.jdbcClientDetailsService(AuthorizationServerConfig.java:40) ~[classes/:na]
	at oauth.config.AuthorizationServerConfig$$EnhancerBySpringCGLIB$$a1ad4a51.CGLIB$jdbcClientDetailsService$0(<generated>) ~[classes/:na]
	at oauth.config.AuthorizationServerConfig$$EnhancerBySpringCGLIB$$a1ad4a51$$FastClassBySpringCGLIB$$991f75cc.invoke(<generated>) ~[classes/:na]
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at oauth.config.AuthorizationServerConfig$$EnhancerBySpringCGLIB$$a1ad4a51.jdbcClientDetailsService(<generated>) ~[classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_281]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_281]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_281]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_281]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	... 65 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.core.RowMapper
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_281]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_281]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) ~[na:1.8.0_281]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_281]
	... 89 common frames omitted

Node.js Error: “Error: EBUSY: resource busy or locked, stat“

abnormal

Error: EBUSY: resource busy or locked, stat 'C:\swapfile.sys'
    at Object.statSync (node:fs:1536:3)
    at D:\NodeJs\node-demo\demo\world.js:7:24
    at FSReqCallback.oncomplete (node:fs:188:23) {
  errno: -4082,
  syscall: 'stat',
  code: 'EBUSY',
  path: 'C:\\swapfile.sys'
}

Node.js v17.1.0

error code

var fs = require('fs');

var rootPath = 'C:\\';
fs.readdir(rootPath, function (err, files) {
    for (var i = 0; i < files.length; i++) {
        var p = rootPath + files[i];
        var stats = fs.statSync(p);
        console.log(rootPath + 'Is it a directory:' + stats.isDirectory())
    }
});

Reason

Prompt error: EBUSY: resource busy or locked, stat indicates that the resource file is busy or locked, that is, the C:\swapfile.Sys file. But there is no such file in the C disk directory, even in the hidden file. But it can be found by opening everything software
is a system file.

Solution:

I don’t know how to solve it. The online solution seems to be invalid, so I can only block the file.

Correct code

var fs = require('fs');

var rootPath = 'C:\\';
fs.readdir(rootPath, function (err, files) {
    for (var i = 0; i < files.length; i++) {
        var p = rootPath + files[i];
        // Skip when encountering swapfile.sys file or System Volume Information directory
        if (p.endsWith('swapfile.sys') || p.endsWith('System Volume Information')) {
            continue;
        }
        var stats = fs.statSync(p);
        console.log(rootPath + 'Is it a directory:' + stats.isDirectory())
    }
});

[Solved] Keras Error: KeyError: ‘accuracy‘, KeyError: ‘val_acc‘, KeyError: ‘acc‘

Problem:
keyerror ‘ACC’ is reported when using keras

Reason:
this is a keras version problem. ACC and accuracy are intended to be the same, but different keras versions use different names, so they need to be replaced. val_ So is acc.

Solution:
Print history keyword
Print (history. History. Keys())
change the error part to the printed “K” and “V”“

Random number random reports an error. Illegalargumentexception: bound must be positive

error code

    private static Random RANDOM = new Random();
    private static Integer randomOnce(Integer max, Integer min) {
        return RANDOM.nextInt(max) % (max - min + 1) + min;
    }

Error message

java.lang.IllegalArgumentException: bound must be positive
	at java.util.Random.nextInt(Random.java:388)

Solution

private static Random RANDOM = new Random();
    private static Integer randomOnce(Integer max, Integer min) {
        if (max<=0)
            throw new IllegalArgumentException("Random positive must be greater than 0");
        return RANDOM.nextInt(max) % (max - min + 1) + min;
    }

Error reporting processing of pyinstaller packaging geopandas environment

Article catalog

1. Iteration error of geopandas occurs when executing exe. 2. Fiona cannot be found when executing exe_ Shim3. Cannot find fiona.shema4. Summary by executing exe

First, use pyinstaller – F main.py to package the code into an EXE with a black window. The following are some problems and solutions

1. The iteration error of geopandas occurs when executing exe

The error information is as follows:

(gis_data_process) D:\code\gis_data_processing>main.exe
Traceback (most recent call last):
  File "main.py", line 10, in <module>
    from gis_data_process import *
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
  File "gis_data_process.py", line 7, in <module>
    import geopandas
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
  File "geopandas\__init__.py", line 17, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
  File "geopandas\datasets\__init__.py", line 6, in <module>
StopIteration
[24328] Failed to execute script 'main' due to unhandled exception!

The solution is as follows:

    comment geopandas\__ init__. Py line 17 code “import geopandas. Datasets # noqa” delete the build, dist and spec files generated by packaging and reuse pyinstaller – f main. Py packaging

    2. Execute exe and cannot find Fiona_ shim

    The error information is as follows:

    (gis_data_process) D:\code\gis_data_processing>main.exe
    Unhandled exception in thread started by <bound method GISDataProcess.generate_file_execute of <__main__.GISDataProcess object at 0x0000021A0C5D8DC8>>
    Traceback (most recent call last):
      File "main.py", line 156, in generate_file_execute
        generate_shapefile(file_path, shape_path)
      File "gis_data_process.py", line 172, in generate_shapefile
        kml_to_shapefile(kml_path, shape_path)
      File "gis_data_process.py", line 417, in kml_to_shapefile
        geojson_to_shapefile(geojson_path, shape_path)
      File "gis_data_process.py", line 220, in geojson_to_shapefile
        geometry = geopandas.read_file(geojson_path)
      File "geopandas\io\file.py", line 166, in _read_file
      File "geopandas\io\file.py", line 81, in _check_fiona
    ImportError: the 'read_file' function requires the 'fiona' package, but it is not installed or does not import correctly.
    Importing fiona resulted in: No module named 'fiona._shim'
    

    The solution is as follows:

      find the. Spec file generated by packaging, find hiddenimports, add “Fiona. _shim”, delete the build and dist directories generated by packaging, and use pyinstaller main.spec to package and generate exe

      3. Fiona.shema cannot be found by executing exe

      The error information is as follows:

      (gis_data_process) D:\code\gis_data_processing>main.exe
      Unhandled exception in thread started by <bound method GISDataProcess.generate_file_execute of <__main__.GISDataProcess object at 0x00000220B655B5E8>>
      Traceback (most recent call last):
        File "main.py", line 156, in generate_file_execute
          generate_shapefile(file_path, shape_path)
        File "gis_data_process.py", line 172, in generate_shapefile
          kml_to_shapefile(kml_path, shape_path)
        File "gis_data_process.py", line 417, in kml_to_shapefile
          geojson_to_shapefile(geojson_path, shape_path)
        File "gis_data_process.py", line 220, in geojson_to_shapefile
          geometry = geopandas.read_file(geojson_path)
        File "geopandas\io\file.py", line 166, in _read_file
        File "geopandas\io\file.py", line 81, in _check_fiona
      ImportError: the 'read_file' function requires the 'fiona' package, but it is not installed or does not import correctly.
      Importing fiona resulted in: No module named 'fiona.schema'
      

      The solution is as follows:

        find the. Spec file generated by packaging, find hiddenimports, add “Fiona. Schema”, delete the build and dist directories generated by packaging, and use pyinstaller main.spec to package and generate exe

        4. Summary

        After the above three steps are completed, you can successfully package into exe, but opening exe has a black window. You can change console = true to console = false in the spec file, and then use pyinstaller main.spec to package and generate exe, so that there is no black window

ERROR: JAVA_HOME is not set and could not be found.

ERROR: JAVA_ HOME is not set and could not be found.

Background

    attempting to operate on HDFS namenode as root, but there is no HDFS_ NAMENODE_ USER defined. Aborting

Solution

    in $Hadoop_ Add the location of the JDK in the home/etc/Hadoop directory. Note that it is distributed to other machines in the cluster

    export JAVA_HOME=/opt/module/jdk1.8
    

Git push Submit to Remote Error: “remote: Support for password authentication was removed on August 13, 2021.“

Abnormal

Error reporting for remote submission:

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://github.com/xxx.git/': The requested URL returned error: 403

reason

From August 13, 2021, GitHub no longer supports submitting codes with passwords.

 

Solution:

Step 1: generate SSH key.

I use a Windows system. Usually, the SSH directory is C: \ users \ administrator \. SSH. If SSH is configured, there will be the following files, where id_ RSA is the private key, ID_ Rsa.pub is the public key.

If SSH is not configured, execute the following command in Git bash to generate SSH key.

ssh-keygen -t rsa -b 4096 -C "Your GitHub Email"

For the options that appear, just default. The first option is the SSH save directory, which can be used by default; In the second option, if you are prompted that SSH already exists, enter y to overwrite and N to not overwrite; The third option is to enter the private key password. If you don’t want to log in with the private key, the private key password is blank. Press enter directly. Press enter twice because the password will be confirmed. After successful generation, you can see the generated key file in the directory.

Step 2: configure to GitHub.

Will ID_ Copy the content in rsa.pub to the newly created SSH keys on GitHub.

Now you can use SSH to clone code and copy SSH links

Git push submission is still unsuccessful

Therefore, it is very important to use SSH link to re clone the warehouse. You need to re clone a remote warehouse to the local.

Just use remote commit again

Reference link: GitHub no longer supports password authentication solution: SSH password free and token login configuration

[Solved] “Field pet in XXX.HelloController required a bean of type ‘XXX.Pet‘ that could not be found.“

abnormal

2021-06-22 14:10:56.860 ERROR 17884 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Field pet in com.demo.springboot.controller.HelloController required a bean of type 'com.demo.springboot.bean.Pet' that could not be found.

The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Autowired(required=true)

The following candidates were found but could not be injected:
	- Bean method 'pet' in 'MyConfig' not loaded because @ConditionalOnBean (names: user01; SearchStrategy: all) did not find any beans named user01


Action:

Consider revisiting the entries above or defining a bean of type 'com.demo.springboot.bean.Pet' in your configuration.

reason

Let’s analyze the printed error log

Let’s look at the hellocontroller class, in which the bean component of pet type is injected, but an error is reported that the injection is not successful

Then, we click the arrow icon on the left to go to the method of injecting this component. We find that it is the pet () method of the myconfig class, where the @ bean annotation is used to inject the pet component.

However, we use @ conditionalonbean (name = user01) annotation above the @ bean annotation, which means that a component named “user01” must exist in the container before the pet component can be injected, otherwise it will not be injected.

solve

Cancel the @ conditionalonbean (name = user01) annotation, or inject a component named “user01”.

But what is the reason for this mistake?Note that the bean component to be used by the @ conditionalonbean annotation condition should be declared above the annotation, not below.

[Solved] RuntimeError: Trying to backward through the graph a second time…

RuntimeError: Trying to backward through the graph a second time, but the buffers have already been freed. Specify retain_graph=True when calling backward the first time.
torch.autograd.backward

torch.autograd.backward(tensors, grad_tensors=None, retain_graph=None, create_graph=False, grad_variables=None)

retain_ graph (bool, optional) – If False, the graph used to compute the grad will be freed. Note that in nearly all cases setting this option to True is not needed and often can be worked around in a much more efficient way.Defaults to the value of create_ graph.create_ graph (bool, optional) – If True, graph of the derivative will be constructed, allowing to compute higher order derivative products.Defaults to False.

retain_ graph = True (when to use it?)

retain_ Graph is a parameter that we can’t use in ordinary times, but we will use it in special cases

    1. when there are two outputs in a network that need to be backwarded respectively: output1. Backward(), output2. Backward(). When there are two losses in a network that need to be backwarded respectively: loss1. Backward(), loss1. Backward(). </ OL> when there are two outputs in a network that need to be backwarded respectively

Take case 2. For example,
if the code is written like this, the parameter at the beginning of the blog will appear:

loss1.backward()
loss2.backward()

Correct code:

loss1.backward(retain_graph=True) #Keep the intermediate arguments after backward.
loss2.backward() # All intermediate variables are freed for the next loop
optimizer.step() # update parameters

retain_ The graph parameter is true to keep the intermediate parameter, so that the backward() of two loss will not affect each other.

Supplement: when two losses of two networks need to be backwarded respectively for backhaul: loss1. Backward(), loss1. Backward()

#The case of two networks requires defining separate optimizers for each of the two networks
optimizer1= torch.optim.SGD(net1.parameters(), learning_rate, momentum,weight_decay)
optimizer2= torch.optim.SGD(net2.parameters(), learning_rate, momentum,weight_decay)
.....
#train Part of the loss return processing
loss1 = loss()
loss2 = loss()

optimizer1.zero_grad() #set the grade to zero
loss1.backward(retain_graph=True) #Keep the intermediate parameters after backward.
optimizer1.step()

optimizer2.zero_grad() #set the grade to zero
loss2.backward()
optimizer2.step()

scheduler = torch.optim.lr_ Scheduler. Steplr (
appendix:

Step explanation

optimizer.zero_ grad()

Initialize the gradient to zero
(because the derivative of loss of a batch with respect to weight is the sum of the derivative of loss with respect to weight of all samples)
corresponding to d_ weights = [0] * n

output = net(inputs)

The predicted value is obtained by forward propagation

loss = Loss(outputs, labels)

Ask for loss

loss.backward()

Back propagation for gradient
corresponding D_ weights = [d_ weights[j] + (label[k] – output ) * input[k][j] for j in range(n)]

optimizer.step()

Update all parameters
corresponding weights = [weights [k] + alpha * D_ weights[k] for k in range(n)]