Development problem record 20230502

7 WebFlux integrates Swagger

7.1 Abnormal

2023-05-27 22:23:28,115 ERROR [traceId=, spanId=] 2023-05-27 22:23:28 [main] [ERROR] - Application run failed
java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration.propertySourcesPlaceholderConfigurer
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60)
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:193)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:153)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:129)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:343)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564)
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:63)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:782)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:774)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:339)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329)
at com.monkey.springboottemplate.SpringBootTemplateApplication.main(SpringBootTemplateApplication.java:20)
Caused by: java.lang.IllegalStateException: Failed to introspect Class [springfox.documentation.swagger2.configuration.Swagger2DocumentationConfiguration] from ClassLoader [sun.misc.Launcher A p p C l a s s L o a d e r @ 18 b 4 a a c 2 ] a t o r g . s p r i n g f r a m e w o r k . u t i l . R e f l e c t i o n U t i l s . g e t D e c l a r e d M e t h o d s ( R e f l e c t i o n U t i l s . j a v a : 481 ) a t o r g . s p r i n g f r a m e w o r k . u t i l . R e f l e c t i o n U t i l s . d o W i t h M e t h o d s ( R e f l e c t i o n U t i l s . j a v a : 358 ) a t o r g . s p r i n g f r a m e w o r k . u t i l . R e f l e c t i o n U t i l s . g e t U n i q u e D e c l a r e d M e t h o d s ( R e f l e c t i o n U t i l s . j a v a : 414 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . l a m b d a AppClassLoader@18b4aac2] at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:358) at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:414) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda AppClassLoader@18b4aac2]atorg.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481)atorg.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:358)atorg.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:414)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambdagetTypeForFactoryMethod 2 ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 747 ) a t j a v a . u t i l . c o n c u r r e n t . C o n c u r r e n t H a s h M a p . c o m p u t e I f A b s e n t ( C o n c u r r e n t H a s h M a p . j a v a : 1660 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . g e t T y p e F o r F a c t o r y M e t h o d ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 746 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . d e t e r m i n e T a r g e t T y p e ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 685 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . p r e d i c t B e a n T y p e ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 656 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . i s F a c t o r y B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 1670 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t L i s t a b l e B e a n F a c t o r y . d o G e t B e a n N a m e s F o r T y p e ( D e f a u l t L i s t a b l e B e a n F a c t o r y . j a v a : 570 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t L i s t a b l e B e a n F a c t o r y . g e t B e a n N a m e s F o r T y p e ( D e f a u l t L i s t a b l e B e a n F a c t o r y . j a v a : 542 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . a u t o c o n f i g u r e . c o n d i t i o n . O n B e a n C o n d i t i o n . c o l l e c t B e a n N a m e s F o r T y p e ( O n B e a n C o n d i t i o n . j a v a : 238 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . a u t o c o n f i g u r e . c o n d i t i o n . O n B e a n C o n d i t i o n . g e t B e a n N a m e s F o r T y p e ( O n B e a n C o n d i t i o n . j a v a : 231 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . a u t o c o n f i g u r e . c o n d i t i o n . O n B e a n C o n d i t i o n . g e t B e a n N a m e s F o r T y p e ( O n B e a n C o n d i t i o n . j a v a : 221 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . a u t o c o n f i g u r e . c o n d i t i o n . O n B e a n C o n d i t i o n . g e t M a t c h i n g B e a n s ( O n B e a n C o n d i t i o n . j a v a : 169 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . a u t o c o n f i g u r e . c o n d i t i o n . O n B e a n C o n d i t i o n . g e t M a t c h O u t c o m e ( O n B e a n C o n d i t i o n . j a v a : 144 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . a u t o c o n f i g u r e . c o n d i t i o n . S p r i n g B o o t C o n d i t i o n . m a t c h e s ( S p r i n g B o o t C o n d i t i o n . j a v a : 47 ) . . . 18 c o m m o n f r a m e s o m i t t e d C a u s e d b y : j a v a . l a n g . N o C l a s s D e f F o u n d E r r o r : o r g / s p r i n g f r a m e w o r k / w e b / s e r v l e t / H a n d l e r M a p p i n g a t j a v a . l a n g . C l a s s . g e t D e c l a r e d M e t h o d s 0 ( N a t i v e M e t h o d ) a t j a v a . l a n g . C l a s s . p r i v a t e G e t D e c l a r e d M e t h o d s ( C l a s s . j a v a : 2701 ) a t j a v a . l a n g . C l a s s . g e t D e c l a r e d M e t h o d s ( C l a s s . j a v a : 1975 ) a t o r g . s p r i n g f r a m e w o r k . u t i l . R e f l e c t i o n U t i l s . g e t D e c l a r e d M e t h o d s ( R e f l e c t i o n U t i l s . j a v a : 463 ) . . . 34 c o m m o n f r a m e s o m i t t e d C a u s e d b y : j a v a . l a n g . C l a s s N o t F o u n d E x c e p t i o n : o r g . s p r i n g f r a m e w o r k . w e b . s e r v l e t . H a n d l e r M a p p i n g a t j a v a . n e t . U R L C l a s s L o a d e r . f i n d C l a s s ( U R L C l a s s L o a d e r . j a v a : 387 ) a t j a v a . l a n g . C l a s s L o a d e r . l o a d C l a s s ( C l a s s L o a d e r . j a v a : 418 ) a t s u n . m i s c . L a u n c h e r 2(AbstractAutowireCapableBeanFactory.java:747) at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:746) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:685) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:656) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1670) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:570) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:542) at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:238) at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:231) at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:221) at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:169) at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:144) at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ... 18 common frames omitted Caused by: java.lang.NoClassDefFoundError: org/springframework/web/servlet/HandlerMapping at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.getDeclaredMethods(Class.java:1975) at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ... 34 common frames omitted Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.HandlerMapping at java.net.URLClassLoader.findClass(URLClassLoader.java:387) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher 2(AbstractAutowireCapableBeanFactory.java:747)atjava.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:746)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:685)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:656)atorg.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1670)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:570)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:542)atorg.springframework.boot.autoconfigure.condition.OnBeanCondition.collec tB e an N am es For T y p e ( O n B e an C o n d i t i o n . ja v a _:238)atorg.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:231)atorg.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:221)atorg.springframework.boot.autoconfigure.condition.OnBeanCondition.getM a t ching B e an s ( O ​​n B e an C o n d i t i o n . ja v a _ _:169)atorg.springframework.boot.autoconfigure.condition.OnBeanCondition.getM a t c h O u t come ( O n B e an C o n d i t i o n . ja v a _ _:144)atorg.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)...18commonframesomittedCausedby:java.lang.NoClassDefFoundError:org/springframework/web/servlet/HandlerMappingatjava.lang.Class.getDeclaredMethods0(NativeMethod)atjava.lang.Class.privateGetDeclaredMethods(Class.java:2701)atjava.lang.Class.getDeclaredMethods(Class.java:1975)atorg.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463)...34commonframesomittedCausedby:java.lang.ClassNotFoundException:org.springframework.web.servlet.HandlerMappingatjava.net.URLClassLoader.findClass(URLClassLoader.java:387)atjava.lang.ClassLoader.loadClass(ClassLoader.java:418)atsun.misc.LauncherAppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
… 38 common frames omitted
2023-05-27 22:24:50,130 ERROR [traceId=, spanId=] 2023-05-27 22:24:50 [main] [ERROR] - Application run failed

7.2 Reasons

Swagger2.9.2 does not support WebFlux.

7.3 Scheme

Use Swagger3.0.0.
Visit:
http://localhost:9121/swagger-ui/index.html

6 Win11 fails to install WSL2 and Ubuntu

insert image description here

Installing, this may take a few minutes…
WslRegisterDistribution failed with error: 0x80370114
Error: 0x80370114 ???

plan

Administrator execution terminal: Win+X-"terminal administrator
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

insert image description here
Execute again, the installation is successful.
insert image description here
View version:

wsl -l -v

insert image description here

5 git owner exception

An exception prompt appears when committing:
Check the log as follows:
(fastapi-py310) PS D:\projects\py\python-tutorial> git log
fatal: detected dubious ownership in repository at 'D:/projects/py/python-tutorial'
' D:/projects/py/python-tutorial' is owned by:
'S-1-5-21-2994888592-1342716116-403010676-500'
but the current user is:
'S-1-5-21-2994888592-1342716116 -403010676-1001'
To add an exception for this directory, call:

    git config --global --add safe.directory D:/projects/py/python-tutorial

(fastapi-py310) PS D:\projects\py\python-tutorial>

5.1 Reasons

The notebook cannot be connected to the Internet, reinstall win11,
change the operating system user, and the git project does not change the user, resulting in inconsistent users.

5.2 Scheme

The user who modifies the git project folder.
Find the project folder, in order: right click -> Properties -> Security -> Advanced -> Change, etc. as shown in the figure below.
Note: The account I configured is a personal account, not admin, which varies depending on the current user of the system.
insert image description here
insert image description here
insert image description here
insert image description here

insert image description here

insert image description here

4 Common Docker users have no permissions

Ordinary users execute the docker command prompt information:

docker images
docker ps -a

docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post “http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create?name=redis-module”: dial unix /var/run/docker.sock: connect: permission denied.

insert image description here

4.1 Reasons

The current user is not in the Docker user group.

4.2 Scheme

The current user is added to the user group. Since it is only a virtual machine operated by individuals, the current user is added to the docker user group.
$USER gets the current user, if it is another user use $your-username.

# 添加用户组
sudo groupadd docker
# 主机用户添加到docker用户组
sudo gpasswd -a $USER docker
# 更新用户组
newgrp docker

insert image description here

3 Ubuntu22.04 installs docker abnormally

Ubuntu22.04 installed Docker with the following exception,
because apt-get was used when installing the software last time, and the installation was interrupted midway.

sudo apt install docker.io

The exception information is as follows:
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is hWaiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1749 (unattended-upgr)
insert image description here
tried to delete the file: /var/lib/dpkg/lock-frontend
installed again, the exception information is as follows:

E: Could not get lock /var/cache/apt/archives/lock. It is held by process 1749 (unattended-upgr)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to lock directory /var/cache/apt/archives/
insert image description here

Delete related files again: /var/cache/apt/archives/lock
to install normally.

insert image description here

3.1 Reasons

The file is occupied by an interrupted thread/service, has not been freed, and cannot be read or written.

3.2 Scheme

delete locked files

sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/cache/apt/archives/lock

2 url content analysis

File “/app/src/utils/file_process_util.py”, line 66, in request_data_from_url
text = trafilatura.extract(source_data)
File “/usr/local/lib/python3.10/site-packages/trafilatura/core.py”, line 1050, in extract
signal(SIGALRM, timeout_handler)
File “/usr/local/lib/python3.10/signal.py”, line 56, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread of the main interpreter

2.1 Scheme

Online problem: ValueError: signal only works in main thread of the main interpreter appears in FastAPI and trafilatura
https://blog.csdn.net/Xin_101/article/details/130313353

1 SpringBoot startup exception

14-04-2023 17:07:53 CST model_task INFO - 2023-04-14 17:07:53,379 [WARN] [main] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘solrClient’ defined in class path resource [org/springframework/boot/autoconfigure/solr/SolrAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.solr.client.solrj.SolrClient]: Factory method ‘solrClient’ threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/solr/client/solrj/impl/HttpSolrClient$ Builder (org.springframework.context.annotation.AnnotationConfigApplicationContext(org.springframework.context.support.AbstractApplicationContext.refresh:557))
14-04-2023 17:07:53 CST model_task INFO - 2023-04-14 17:07:53,416 [ERROR] [rpc-server-4-7] Error while invoking RpcHandler#receive() for one-way message. (org.apache.spark.network.server.TransportRequestHandler(org.apache.spark.network.server.TransportRequestHandler.processOneWayMessage:276))
14-04-2023 17:07:53 CST model_task INFO - org.apache.spark.SparkException: Could not find CoarseGrainedScheduler.
14-04-2023 17:07:53 CST model_task INFO - at org.apache.spark.rpc.netty.Dispatcher.postMessage(Dispatcher.scala:178)
14-04-2023 17:07:53 CST model_task INFO - at org.apache.spark.rpc.netty.Dispatcher.postOneWayMessage(Dispatcher.scala:150)
14-04-2023 17:07:53 CST model_task INFO - at org.apache.spark.rpc.netty.NettyRpcHandler.receive(NettyRpcEnv.scala:690)
14-04-2023 17:07:53 CST model_task INFO - at org.apache.spark.network.server.TransportRequestHandler.processOneWayMessage(TransportRequestHandler.java:274)
14-04-2023 17:07:53 CST model_task INFO - at org.apache.spark.network.server.TransportRequestHandler.handle(TransportRequestHandler.java:111)

1.1 Reasons

Missing class:

1.2 Scheme

Starting SpringBoot is to exclude this class.

@SpringBootApplication(exclude = SolrAutoConfiguration.class)
public class SearchApplication extends SpringBootServletInitializer {
    
    
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
    
    
        return builder.sources(SearchApplication.class);
    }

    public static void main(String[] args) {
    
    
        SpringApplication.run(SearchApplication.class, args);
    }
}

Guess you like

Origin blog.csdn.net/Xin_101/article/details/130461577