Tag Archives: HTTP

[Solved] Arthas failed to bind telnet or http port! Telnet port: 3658, http port: 8563;Error creating bean

[Arthas failed to bind telnet or http port! Telnet port: 3658, http port: 8563; Error creating bean with name ‘documentationPluginsBootstrapper’ defined in URL; Error creating bean with name ‘webMvcRequestHandlerProvider’ defined in URL]

Cause analysis:

Error will be reported when two identical items are started: port conflict!!! (Even if the ports of the two projects are different in the yml file, an error will be reported.)
Arthas failed to bind telnet or http port! Telnet port: 3658, http port: 8563


Solution:

Comment out the arthas in two projects.

<!--        Monitor system performance: do not allow two identical projects to run; comment to enable two  -->
<!--        <dependency>-->
<!--            <groupId>com.taobao.arthas</groupId>-->
<!--            <artifactId>arthas-spring-boot-starter</artifactId>-->
<!--            <version>3.6.0</version>-->
<!--        </dependency>-->

Arthas is an online monitoring and diagnosis product. It can view the status information of application load, memory, gc, and threads in real time from a global perspective, and diagnose business problems without modifying the application code, including checking the access parameters and exceptions of method calls, time-consuming monitoring method execution, class loading information, etc., greatly improving the efficiency of online problem troubleshooting.

Error 1

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'documentationPluginsBootstrapper' defined in URL 
[jar:file:/D:/JAVA1/scm-repository/io/springfox/springfox-spring-web/3.0.0/springfox-spring-web-3.0.0.jar!/springfox/documentation/spring/web/plugins/DocumentationPluginsBootstrapper.class]: 
Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
 Error creating bean with name 'webMvcRequestHandlerProvider' defined in URL 
 [jar:file:/D:/JAVA1/scm-repository/io/springfox/springfox-spring-webmvc/3.0.0/springfox-spring-webmvc-3.0.0.jar!/
 springfox/documentation/spring/web/plugins/WebMvcRequestHandlerProvider.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException:
  Error creating bean with name 'webEndpointServletHandlerMapping' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.class]: 
  Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate 
  [org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping]: Factory method 'webEndpointServletHandlerMapping' threw exception;
   nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'arthasEndPoint': Unsatisfied dependency expressed through field 'arthasAgent'; nested exception is 
   org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arthasAgent' defined in class path resource 
   [com/alibaba/arthas/spring/ArthasConfiguration.class]: Bean instantiation via factory method failed; nested exception is 
   org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.taobao.arthas.agent.attach.ArthasAgent]: Factory method 'arthasAgent' threw exception; nested exception is java.lang.IllegalStateException: 
   java.lang.reflect.InvocationTargetException


Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webMvcRequestHandlerProvider' defined in URL 
[jar:file:/D:/JAVA1/scm-repository/io/springfox/springfox-spring-webmvc/3.0.0/springfox-spring-webmvc-
3.0.0.jar!/springfox/documentation/spring/web/plugins/WebMvcRequestHandlerProvider.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'webEndpointServletHandlerMapping' defined in class path resource 
[org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping]: Factory method 'webEndpointServletHandlerMapping' threw exception;
 nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'arthasEndPoint': Unsatisfied dependency expressed through field 'arthasAgent'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arthasAgent' defined in class path resource 
[com/alibaba/arthas/spring/ArthasConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: 
Failed to instantiate [com.taobao.arthas.agent.attach.ArthasAgent]: Factory method 'arthasAgent' threw exception; nested exception is java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping]: Factory method 'webEndpointServletHandlerMapping' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'arthasEndPoint': Unsatisfied dependency expressed through field 'arthasAgent'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arthasAgent' defined in class path resource [com/alibaba/arthas/spring/ArthasConfiguration.class]: Bean instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[com.taobao.arthas.agent.attach.ArthasAgent]: Factory method 'arthasAgent' threw exception; nested exception is java.lang.IllegalStateException: 
java.lang.reflect.InvocationTargetException

	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
	
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
	... 57 common frames omitted
	
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'arthasEndPoint': Unsatisfied dependency expressed through field 'arthasAgent'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arthasAgent' defined in class path resource 
[com/alibaba/arthas/spring/ArthasConfiguration.class]: Bean instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.taobao.arthas.agent.attach.ArthasAgent]: 
Factory method 'arthasAgent' threw exception; nested exception is java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arthasAgent' defined in class path resource 
[com/alibaba/arthas/spring/ArthasConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.taobao.arthas.agent.attach.ArthasAgent]: Factory method 'arthasAgent' threw exception; nested exception is java.lang.IllegalStateException: 
java.lang.reflect.InvocationTargetException

Caused by: java.lang.IllegalStateException: Arthas failed to bind telnet or http port! Telnet port: 3658, http port: 8563

	at com.taobao.arthas.core.server.ArthasBootstrap.bind(ArthasBootstrap.java:448)
	at com.taobao.arthas.core.server.ArthasBootstrap.<init>
	(ArthasBootstrap.java:156)
	at com.taobao.arthas.core.server.ArthasBootstrap.getInstance(ArthasBootstrap.java:581)
	... 112 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:58928', transport: 'socket'


Error creating bean with name 'arthasEndPoint': Unsatisfied dependency expressed through field 'arthasAgent'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arthasAgent' defined in class path resource 
[com/alibaba/arthas/spring/ArthasConfiguration.class]: Bean instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.taobao.arthas.agent.attach.ArthasAgent]: 
Factory method 'arthasAgent' threw exception; nested exception is java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException

Error 2

2022-09-08 13:33:15 [main] INFO  c.b.d.d.DynamicRoutingDataSource
 - dynamic-datasource - add a datasource named [master] success
2022-09-08 13:33:15 [main] INFO  c.b.d.d.DynamicRoutingDataSource
 - dynamic-datasource initial loaded [2] datasource,primary datasource named [master]
Registered plugin: 'com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor@136cad3e'
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/PrCompanyMapper.xml]'
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysConfigMapper.xml]'
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysDeptMapper.xml]'
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysDeptRankMapper.xml]'
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysDictDataMapper.xml]'
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysDictTypeMapper.xml]'
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysLogininforMapper.xml]'
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysMenuMapper.xml]'
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysNoticeMapper.xml]'
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysOperLogMapper.xml]'
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysPostMapper.xml]'
Can not find table primary key in Class: "com.skeqi.manage.domain.SysRoleDept".
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysRoleDeptMapper.xml]'
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysRoleMapper.xml]'
Can not find table primary key in Class: "com.skeqi.manage.domain.SysRoleMenu".
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysRoleMenuMapper.xml]'
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysUserMapper.xml]'
Can not find table primary key in Class: "com.skeqi.manage.domain.SysUserPost".
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysUserPostMapper.xml]'
Can not find table primary key in Class: "com.skeqi.manage.domain.SysUserRole".
Parsed mapper file: 'URL [jar:file:/D:/JAVA1/scm-repository/com/skeqi/manage-service/1.0.1/manage-service-1.0.1.jar!/mybatisplus/system/SysUserRoleMapper.xml]'
 _ _   |_  _ _|_. ___ _ |    _ 
| | |\/|_)(_| | |_\  |_)||_|_\ 
    /              |         
                        3.4.3 
Disconnected from the target VM, address: '127.0.0.1:50626', transport: 'socket'

Process finished with exit code -1073740940 (0xC0000374)

[Solved] JAVA HttpClient Send Https request certificate error:PKIX path building failed:

Recently, when using httpclient to connect with the third-party SMS interface, a certificate invalidation error was reported during the local test.

1. Post request of Encapsulated HttpClient:

public static Map<String, Object> postReq(String URL, Map<String, Object> paramMap, Map<String, String> headers) throws Exception {
        Map<String, Object> map = new HashMap<String, Object>();

        RequestConfig requestConfig = RequestConfig.custom()
                .setConnectTimeout(2000) // Set the connection timeout, in milliseconds
                .setConnectionRequestTimeout(1000)
                .setSocketTimeout(5000) // timeout for requesting data, in milliseconds
                .build();
        HttpRequestRetryHandler myRetryHandler = new HttpRequestRetryHandler() {
            @Override
            public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
                return false;
            }
        };

        try (CloseableHttpClient client = HttpClients.custom()
                .setDefaultRequestConfig(requestConfig)
                .setRetryHandler(myRetryHandler)
                .build()) {

            HttpPost httpPost = new HttpPost(URL);
            if (paramMap != null) {
                JSONObject paramJson = new JSONObject(paramMap);
                StringEntity paramEntity = new StringEntity(paramJson.toString(), "UTF-8");
                paramEntity.setContentType("application/json; charset=utf-8");
                httpPost.setEntity(paramEntity);
            }
            httpPost.setConfig(requestConfig);

            if (headers != null && !headers.isEmpty()) {
                for (String key : headers.keySet()) {
                    String value = headers.get(key);
                    httpPost.setHeader(key, value);
                }
            }

            CloseableHttpResponse response = client.execute(httpPost);

            HttpEntity entity = response.getEntity();

            if (entity != null) {
                String responseStr = EntityUtils.toString(entity, "UTF-8");
                if (responseStr.isEmpty()) {
                    responseStr = "{}";
                }

                int statusCode = response.getStatusLine().getStatusCode();
                if (HttpServletResponse.SC_OK == statusCode) {
                    try {
                        JSONObject dataJson = (JSONObject) JSONObject.parse(responseStr);
                        map = new HashMap<>(dataJson);
                    } catch (Exception e) {
                        map.put("reponse", responseStr);
                    }
                } else {
                    return map;
                }
            }
            response.close();
        }
        return map;
    }

However, an error will be reported when accessing some self signed HTTPS requests. This problem is caused by the invalid link certificate, because the self signed certificate will be recognized as an unsafe link.

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

2. Solutions

  1. Set the security certificate of jdk according to the online method -> No work
  2. Set maven to ignore the certificate checksum -> no work
  3. Yml file configuration httpclient ignore SSL checksum, seems to have no effect.
  4. Finally used the method of modifying the code, the principle is also to ignore the certificate checksum, but the code produced the effect, it is estimated that the construction is related to the Httpclient.

 

Modify the original code

// Ignore SSL Security Certification
**SSLConnectionSocketFactory scsf = new SSLConnectionSocketFactory(
        SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build(),
        NoopHostnameVerifier.INSTANCE);**

try (CloseableHttpClient client = **HttpClients.custom().setSSLSocketFactory(scsf)**
        .setDefaultRequestConfig(requestConfig)
        .setRetryHandler(myRetryHandler)
        .build()) {

[Solved] “status“:405,“error“ Request method ‘POST‘ not supported“

“status“:405,“error“ Request method ‘POST‘ not supported“

Error Messages:

-“status”:405,“error”:“Method Not Allowed”,“exception”:“org.springframework.web.HttpRequestMethodNotSupportedException”,“message”:“Request method ‘POST’ not supported”

 

code:

@Controller
public class EmpController {

    @Autowired
    private EmpService empService;

    @GetMapping("/empadd")
    public String empAdd(Model model) {
        model.addAttribute("list",empService.showAll());
        return "emp-add";
    }

    @PostMapping("/add")
    public String add(Emp emp, MultipartFile file){
        empService.insert(emp,file);
        return "emp-add";
    }
}

 

Reason:
As it says in the Spring REST guide,

@RequestMapping maps all HTTP operations by default

but if, as they suggest, you added a specification of the allowable http methods:

@RequestMapping(method=GET)

then only GETs will be allowed. POSTs will be disallowed.
If you want to allow both GET and POST, but disallow all other http methods, then annotate your controller method thusly:

@RequestMapping(value = "/greeting", method = {RequestMethod.GET, RequestMethod.POST})
public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
    return new Greeting(counter.incrementAndGet(),
                        String.format(template, name));
}

When you start the application, all the request handler mappings are logged out. You should see a line like this in your log (in the IDE console or command line window):

s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/greeting],methods=[GET || POST]}" onto public hello.Greeting hello.GreetingController.greeting(java.lang.String)

Solution:

Modify

@GetMapping("/empadd")

to

@RequestMapping("/empadd")

[vite] http proxy error: Error: self signed certificate in certificate chain vite

In order to prevent cross domain problems when requesting interfaces, vite proxy is used for configuration.

For example, the address of the request interface is https://172.1.1.0:8080 , the vite configuration information is as follows:

...

server: {
        host: '0.0.0.0',
        port: 12000,
        proxy: {
            '/local/': {
                target: 'https://172.1.1.0:8080',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/local\//, ''),
            },
        },
},

...

Local requests are all interfaces. You only need to add a prefix -/local /. For example, the login interface is’/local/Login ‘.

So I went to request and found that the error was reported directly. The error information is as follows:

[vite] http proxy error: Error: self signed certificate

The certificate is wrong.

Solution: add a configuration – secure: false The overall configuration code is as follows:

proxy: {
            '/local/': {
                target: '',
                

                // Add
                secure: false,
                // End




                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/local\//, ''),
            },
        },

Then try again. Sure enough, there’s no problem.

Opentelemetry + Jaeger Python Version Cross Service Call Example

Opentelemetry Python version cross service invocation example

When calling opentelemetry across services, you need to import opentelemetry-instrumentation-requests, and then use request to cross service requests. (note that aiohttp-client should be used if it is asynchronous)
I use Jaeger on the server, which is deployed directly through the docker of all-in-one. The code is as follows:

docker run -d --name jaeger \
  -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
  -p 5775:5775/udp \
  -p 6831:6831/udp \
  -p 6832:6832/udp \
  -p 5778:5778 \
  -p 16686:16686 \
  -p 14250:14250 \
  -p 14268:14268 \
  -p 14269:14269 \
  -p 9411:9411 \
  jaegertracing/all-in-one:1.32

After starting Jaeger, visit the following page: http://localhost:16686

Python needs to start two services to demonstrate cross service invocation. The framework I use is fastapi, so I need to install opentelemetry-instrumentation-fastapi
call service 1 by service 2
Service 1:

import fastapi
from opentelemetry import trace
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
from fastapi import Body
from pybase.lib.tracer.jaeger_ import register_to_jaeger
from pydantic import BaseModel

app = fastapi.FastAPI()


class UserInfo(BaseModel):
    name: str


tracer = trace.get_tracer(__name__)


@app.post("/server")
async def server(userinfo: str = Body(...), name: str = Body(..., )):
    return {"message": f"hello {userinfo},{name}"}



FastAPIInstrumentor.instrument_app(app)
if __name__ == '__main__':
    register_to_jaeger("fastapi-jaeger-server", "localhost")
    import uvicorn

    uvicorn.run(app,port=8001)

Service 2

import fastapi
import requests
from opentelemetry import trace
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
from fastapi import Body
from opentelemetry.instrumentation.requests import RequestsInstrumentor
RequestsInstrumentor().instrument()
from pybase.lib.tracer.jaeger_ import register_to_jaeger
from pydantic import BaseModel

app = fastapi.FastAPI()


class UserInfo(BaseModel):
    name: str


tracer = trace.get_tracer(__name__)


@app.post("/foobar")
async def foobar(userinfo: str = Body(...), name: str = Body(..., )):
    with tracer.start_as_current_span("foo"):
        with tracer.start_as_current_span("bar"):
            with tracer.start_as_current_span("baz"):
                print("Hello world from OpenTelemetry Python!")
    return {"message": f"hello {userinfo},{name}"}
@app.post("/foobar2")
async def foobar2(userinfo: str = Body(...), name: str = Body(..., )):
    return {"message": f"hello {userinfo},{name}"}

@app.post("/client")
def client(userinfo: str = Body(...), name: str = Body(..., )):

    res=requests.post("http://127.0.0.1:8001/server",json={
        "userinfo":userinfo,"name":name
    })
    return res.json()


FastAPIInstrumentor.instrument_app(app)
if __name__ == '__main__':
    register_to_jaeger("fastapi-jaeger", "localhost")
    import uvicorn

    uvicorn.run(app)

A function that depends on register_ to_ jaeger:

from opentelemetry import trace
from opentelemetry.exporter.jaeger.thrift import JaegerExporter
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor


def register_to_jaeger(service_name: str, jaeger_host: str, jaeger_port: int = 6831):
    """
    Register the service to jaeger so that tracer-related information can be sent to the jaeger server
    Args:
        service_name: the registered service name
        jaeger_host: jaeger address
        jaeger_port:

    Returns: TracerProvider

    """
    provider = TracerProvider(
        resource=Resource.create({SERVICE_NAME: service_name})
    )
    trace.set_tracer_provider(
        provider
    )

    # create a JaegerExporter
    jaeger_exporter = JaegerExporter(
        agent_host_name=jaeger_host,
        agent_port=jaeger_port,
    )

    # Create a BatchSpanProcessor and add the exporter to it
    span_processor = BatchSpanProcessor(jaeger_exporter)

    # add to the tracer
    trace.get_tracer_provider().add_span_processor(span_processor)

Then execute:

curl -X 'POST' \
  'http://127.0.0.1:8000/client' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "userinfo": "string",
  "name": "string"
}'

You can get the following results:
if you have any questions, please correct them.

org/sqlite/native/Mac/aarch64 Error [How to Solve]

Problem Description:
When building a project with m1 chip, if you use room, you will get the following error because the sqlite jar package is not compatible with arm.

Caused by: java.lang.Exception: No native library is found for os.name=Mac and os.arch=aarch64. path=/org/sqlite/native/Mac/aarch64
    at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:333)
    at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:64)
    at androidx.room.verifier.DatabaseVerifier.<clinit>(DatabaseVerifier.kt:68)
    ... 50 more

Solution:
To update the room version, you don’t need to add org.xerial:sqlite-jdbc:3.34.0 as the web says, just update the room directly as shown below.

    def room_version = "2.4.0-beta01"  
    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"
    implementation "androidx.room:room-rxjava2:$room_version"

Git Push Error: error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413

Crime scene

When using git to push the local code to the remote warehouse, the push fails (using the HTTP protocol). The error message is as follows:

$ git push 
Enumerating objects: 3383, done.
Counting objects: 100% (3383/3383), done.
Delta compression using up to 8 threads
Compressing objects: 100% (1216/1216), done.
Writing objects: 100% (3383/3383), 6.96 MiB | 81.92 MiB/s, done.
Total 3383 (delta 2303), reused 3007 (delta 2034), pack-reused 0
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date

Solution:

The data size of this push is 17m.

1. To solve the problem from the perspective of GIT, you can add the size of http.postBuffer

git config http.postBuffer 524288000

2. Because my Gitlab service is using Nginx as a domain proxy, it is possible that the client_max_body_size of nginx is limited and can be adjusted as follows.

client_max_body_size 1024m;

Python requests Error: ConnectionError: (‘Connection aborted.‘, error(104, ‘Connection reset by peer‘))

Python requests error

ConnectionError: (‘Connection aborted.’, error(104, ‘Connection reset by peer’))

There are two possible causes

1. Requests are too frequent, resulting in requests being rejected

Solution:

Set a sleep time for each request, such as
time sleep(1)

2. The interface has authentication or anti crawling mechanism. It is recognized that it is accessed by Python terminal, and the access is rejected

Solution:

Set user agent in request header to bypass authentication

as

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko',"Content-Type": "application/json"}

[nltk_data] Error loading wordnet_ic: HTTP Error 404: Not Found

Error loading XXXX: http Error 404: not found
XXXX can be WordNet or nltk_ Any package in data

Solution:

    1. 1. local download

    Find the package you need → copy the corresponding address → download → unzip to “your nltk_data path \nltk_data\corpora”
    For example: “wordnet_ic” “https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/packages/corpora/ wordnet_ic.zip”

    <package id="wordnet_ic" 
    name="WordNet-InfoContent" 
    version="3.0" 
    webpage="http://wn-similarity.sourceforge.net" 
    unzip="1" 
    unzipped_size="34220359" 
    size="12056682" 
    checksum="25f0185b31693fa11ea898e4feda528c" 
    subdir="corpora" 
    url="https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/packages/corpora/wordnet_ic.zip" />
    

    2. Unzip directly
    when we install nltk, XXX.Zip will be included in “your nltk_data path\nltk_data\corpora”. We can first search to see if the package you need exists in the corpora directory. If so, just unzip it directly. Easy.

[Solved] SpringBoot Error: org.springframework.http.converter.HttpMessageNotReadableException

SpringBoot Error: org.springframework.http.converter.HttpMessageNotReadableException

 


org.springframework.http.converter.HttpMessageNotReadableException:
Required request body is missing: * * * * *
at.org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:161)
	

After careful investigation, I found that there are no errors in my other codes. Finally, the parameter submission method is wrong, because the @requestbody annotation is mainly used to accept JSON data in post and put methods, so @postmapping should be used here. It’s a perfect solution. I’m really getting farther and farther on the road of rookie

SpringBoot :Error parsing HTTP request header [How to Solve]

Most of these problems are container problems. There are two solutions:

1. Maybe the header cache in Tomcat is not enough

  tomcat:
    # URI encoding of tomcat
     uri-encoding: UTF-8
     # tomcat maximum number of threads, the default is 200
     max-threads: 800
     # Tomcat starts the number of threads to initialize, the default value is 25
    min-spare-threads: 30
    max-http-form-post-size: 2MB
    max-http-header-size: 8096

2. If it hasn’t been solved

@Configuration
public class TomcatConfigurer {

    @Bean
    public TomcatServletWebServerFactory webServerFactory() {
        TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
        factory.addConnectorCustomizers((Connector connector) -> {
            connector.setProperty("relaxedPathChars", "\"<>[\\]^`{|}");
            connector.setProperty("relaxedQueryChars", "\"<>[\\]^`{|}");
        });
        return factory;
    }

}