Tag Archives: not

Exception handling of httpmessage notwritableexception in springboot

preface:

First, post the error report log

Resolved [org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class com.test.dto.ResultBean]

If the log is similar, you can continue to look down.

1. Causes and Solutions

Restore the accident scene first (only show the core problem code)

Interface layer code:

@RestController
@RequestMapping("/client")
public class ControllerTest {

    @GetMapping("/test")
    public ResultBean name() {
        return ResultBean.success();
    }
}

ResultBean Code:

public class ResultBean {

    private String code;
    private String result;

    ResultBean(String code, String result) {
        this.code = code;
        this.result = result;
    }

    public static ResultBean success() {
        return new ResultBean("200", "success");
    }

}

The error log points to this   ResultBean. The big probability is that there is a problem with this bean. After careful analysis of the log, it probably means that it is impossible to get the value, so it is impossible to write. Get the value?Get method?It seems that ResultBean is missing the get method (Lombok annotation is forgotten). With the get method, the problem is solved

Tips: be sure to add get and set methods and try to write by hand; Lombok annotations are rarely used. There are holes in them. Occasionally, the default method for generating special fields cannot be recognized by other components.

Solution to the error code of 0x80040154 in COM / ole call

1. The background
In the project development, in order to make C# call the original C++ developed OLE interface program, the following method was adopted to establish C++CLI project as an intermediate DLL, with the following advantages:
(1) on the one hand, he can better use C++ to access OLE API functions, and the original C++ development of OLE programs better combination;
(2) on the other hand, C# can easily reference C++CLI DLL, so that the implementation of C# code on the old version of OLE program calls quickly;
(3) low coupling, easy to test, about the correctness of OLE interface and C++CLI, you can independently set up a test project to test.

Therefore, C# projects utilize the invocation relationship of C++ OLE as follows:
C # = = & gt; > > C + + the CLR = = & gt; > > C + +, OLE

Problem 2.
In the real project, the OLE program is developed by another TEAM, we just call it. But during the testing process, the call to OLE interface in the latest test environment failed. Debug finds that the C++CLI failed to initialize the specified OLE program when calling the OLE interface with the error code 0x80040154, which means the following:

OLE error code 0x80040154. Class is not registered.

The main online solution is to call the RegSVR32 command to register your program. The purpose of registration is to establish the mapping relationship between ProgramID and CLSID in the registry. In my understanding, ProgramID is equivalent to our name. When we use the API to call the COM/OLE interface, we pass a plain string called ProgramID, and the API internally operates on the CLSID based on the mapping stored in the registry. There is a subkey in the registry with CLSID as key and its name is LocalService32. The corresponding key value of this key stores the local full path of the final OLE program. Finally, it is found that this key value in our test environment is wrong and does not point to the real OLE program path, thus causing failure in the initialization of OLE program. Given the wrong program path, the loader must fail.

3. Solutions

Modify the CLSID stored in the OLE program full path.

Prompt “libevent not found” when installing tmux

Ubuntu installation tMUx tutorial

1. Tmux is a terminal split screen software, which can display different terminals in multiple areas on the same screen. The effects are as follows:

2. Ubuntu’s software warehouse is built with TMUx, which can be installed using the command Sudo Apt-get install Tmux, but the version in the warehouse is older. You can download the latest version of TMUX manually by going to tMUX official and the address is as follows:
https://github.com/tmux/tmux/releases

3. Download the source package, unzip, terminal into the tMUX unzip directory
4. Run terminal./configure
You might be prompted “Error: libEvent Not Found”
5. The solution is as follows. Run the following command respectively.
Skip step 6 if sudo Apt-get install libevent-dev #. If prompted for installation conflicts (XXXX conflicts libevent-2.0-5 XXXXX), perform the following steps:

Purge –force-depends libevent-2.0-5 Sudo DPKG — Purge — Force-depends libevent-2.0-5 Purge — 2.0-5 Purge — 2.0-5
Sudo apt-get install libevent-dev # skip step 6 if successful and do the following if unsuccessful
Sudo Apt-get Install – F # automatically fixes dependencies
Sudo Apt-get install libevent-dev # should be ready to install the libevent library
6. Run the terminal again./configure
7. Run make under the terminal
8. Run sudo make install
under terminal
9. At this point, tMUX can be successfully installed and then run tMUX under the terminal.
10. Some common tMUx shortcuts:
Tmux introduction articles – bole online http://blog.jobbole.com/87278/

Resources:
Linux – “libevent not found” error in Tmux-stack Overflow
http://stackoverflow.com/questions/21926202/libevent-not-found-error-in-tmux