Java implements Python requests module linux reporting error

find a JAVA implementation Python requests module on the Internet (JAVA implements the Http request)

try {
            logger1.info("===============>>>>>" + Path + "------------>>" + headers);
            data= Requests.post(Path)
                    .headers(headers )
                    .requestCharset(cs)
                    .send()
                    .readToText();
        }catch (Exception e){
            e.printStackTrace();
            data = "error";
        }

where Charset cs = Charset.forName ("utf-8");

there is no problem for this code to run locally on window, but it will report an error when deployed to the server, and there is no problem with the parameters passed on the log printing. what is the reason for this?

Dec.08,2021

send the exception message


exception message print result: no exception message was seen before unknowhostException,. Just configure the domain name and ip under hosts

.
  • Does a single thread need a lock?

    < H2 > recently wrote a background management system based on springboot, which provides many interfaces to add, delete, modify and insert databases without manually creating any threads. I wonder if there will be problems if concurrency occurs < H2 ...

    Dec.08,2021
Menu