Error Message: AttributeError: module 'asyncio' has no attribute 'run'
Solution:
pip uninstall uvicorn
pip install uvicorn==0.16.0
Error Message: AttributeError: module 'asyncio' has no attribute 'run'
Solution:
pip uninstall uvicorn
pip install uvicorn==0.16.0
The above is the error reported by the endpoint accessing oauth2, mainly because the configuration is not well configured, and the configuration before modification:
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
Modified configuration:
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication()
.dataSource(dataSource)
.passwordEncoder(new BCryptPasswordEncoder());
}
1. Maybe the host file localhost is not bound to 127.0.0.1
Solution:
Under windows, you can see the
host
file through the directoryC:\Windows\System32\drivers\etc
, copy it to the desktop, edit it with Notepad, write127.0.0.1 localhost
, and then overwrite the previous host file.
2. The path is not written correctly
Solution:
Remove the contents in the red box and then switch to home. After the home switch is completed, reset the JDK here
error at ::0 formal unbound in pointcut
This error was reported when using aop’s @before for log prenotification
Error code here
@Before(value = "webLogAspect()")
public void logBefore(JoinPoint joinPoint,Object ret) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
//在attribute中加入开始时间
request.setAttribute("time",System.currentTimeMillis());
}
Then, after I remove the second parameter, it is normal
@Before(value = "webLogAspect()")
public void logBefore(JoinPoint joinPoint) {
Explain that other operations are required when multiple parameters are used, otherwise an error will be reported
@Before(value = "webLogAspect() && args(ret)")
public void logBefore(JoinPoint joinPoint, Object ret) {
Problem-solving
Htmlemail uses QQ corporate email to send problem summary
After the local mail sending test is passed according to the parameter information on htmlemail, deploy the service on the ECs to test the mail sending. The first error is reported:
Sending the email to the following server failed : smtp.exmail.qq.com:25
Ping smtp.com directly on the ECS exmail. qq. COM domain name found that the external network on the server is not connected. After opening the external network permission, the above error still exists.
browse the document and try to switch smtpport to port 465:
HtmlEmail.setSmtpPort(465);
Error still reported:
Sending the email to the following server failed : smtp.exmail.qq.com:465
Could not connect SMTP host:smtp.exmail.qq.com, port 465, response: -1
It is found that sslonconnect needs to be set to true when switching to port 465
HtmlEmail.setSSLOnConnect(true);
After modification, the error information is changed to:
Invalid address
Finally, switch smtpport to 587:
HtmlEmail.setSmtpPort(587);
Finally, no error is reported. Record it for review later.
Description:
When using springboot to integrate swagger2config, an error is reported. The error information is as follows:
Analysis:
I am using Springboot 2.6.3, Spring Boot 2.6.X uses PathPatternMatcher to match paths, the path matching used by Springfox referenced by Swagger is based on AntPathMatcher, so it needs to be configured.
Solution:
Add the following configuration to the YML configuration file:
spring:
mvc:
pathmatch:
matching-strategy: ANT_PATH_MATCHER
The specific codes are as follows:
package main
import (
"fmt"
"time"
)
var m = make(map[int]int, 10)
func solution(n int){
res := 1
for i:=1; i<=n; i++{
res = res * i
}
m[n] = res
}
func main(){
for i:=1; i<=200; i++{
go solution(i)
}
time.Sleep(time.Second*10)
for ind, val := range m{
fmt.Printf("[%d] = %d \n", ind, val)
}
}
The following error occurred:
fatal error: concurrent map writes
fatal error: concurrent map writes
runtime.mapassign_fast64(0x10b7760, 0xc00001e1b0, 0x12, 0x0)
/usr/local/go/src/runtime/map_fast64.go:176 +0x325 fp=0xc000106fa0 sp=0xc000106f60 pc=0x1010bc5
main.solution(0x12)
/Users/lcq/go/src/go_base/gochanneldemo/channeldemo.go:15 +0x65 fp=0xc000106fd8 sp=0xc000106fa0 pc=0x10a88a5
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1374 +0x1 fp=0xc000106fe0 sp=0xc000106fd8 pc=0x1062c41
created by main.main
/Users/lcq/go/src/go_base/gochanneldemo/channeldemo.go:20 +0x58
The main reason is because map is not thread-safe, so it is not safe to use map in case of concurrency.
Solution.
Problem overview
Today, when learning the vector container, I found that clion threw such an error, as shown in the following figure
this problem still exists after compiling with clang
~/Documents/Clion_Project/Learning/L11.cpp:12:1: error: expected unqualified-id
for (int i = 0; i < v.size(); i++)
^
1 error generated.
reason:
The main function is not written
Solution:
#include <vector>
using namespace std;
int main()
{
struct Vertex
{
int a;
float b;
};
vector<Vertex> v;
for (int i = 0; i < v.size(); i++)
{
}
}
preface
when setting up the python 3 environment on your own server, the PIP version is too low, the upgrade pip is still invalid and falls into a dead circle. After reading many blogs on the Internet, there is no solution
1. Solution
# Download get-pip.py
wget https://bootstrap.pypa.io/2.7/get-pip.py
python get-pip.py
Today, I installed Nacos locally and reported the error creating bean with name ‘grpcclusterserver’ at startup. When I went to search for the cause of the error, I saw that a blogger said it would be better to try several more times. I didn’t know the specific reason, so I shut down and restarted directly and started again successfully
screenshot of error reporting:
screenshot of success:
When Java uses POI to read Excel files with XLS suffix, an error is reported:
Your InputStream was neither an OLE2 stream, nor an OOXML stream
Error code:
Workbook wb = WorkbookFactory.create(is);
Click the Create method to see the source code of POI:
public static Workbook create(InputStream inp) throws IOException, InvalidFormatException {
if (!((InputStream)inp).markSupported()) {
inp = new PushbackInputStream((InputStream)inp, 8);
}
if (POIFSFileSystem.hasPOIFSHeader((InputStream)inp)) {
return new HSSFWorkbook((InputStream)inp);
} else if (POIXMLDocument.hasOOXMLHeader((InputStream)inp)) {
return new XSSFWorkbook(OPCPackage.open((InputStream)inp));
} else {
throw new IllegalArgumentException("Your InputStream was neither an OLE2 stream, nor an OOXML stream");
}
}
The haspoofshade and hasooxmlreader in the two IFS are to read the first 8 bytes of the excel file stream to determine the file information. If it is not an excel type file or a binary type file, the exception “your InputStream was neither an ole2 stream, nor an OOXML stream” will be thrown directly
Analysis:
open the problematic XLS file with sublime text text editor or Notepad + +, which is XML in text form:
Open other normal XLS files with sublime text text editor as follows, which are binary:
Reason for the problem:
the XLS file in question is actually an office openxml file, also known as spreadsheetml format (XML format of Excel). Its suffix should be XML instead of XLS. It is not a standard excel file, so it will report an error when reading with POI.
Solution:
use Excel to open the problematic XLS file, as follows:
select Yes, then save the file as XLS format, and then use POI analysis to avoid reporting errors