Category Archives: Error

Feign declarative call service feign.codec.DecodeException: Error while extracting response for type [class **] and…

A few days ago, when I was working on a project, I encountered a garbled return from the feign call, which caused a program error. The reason is that the dependency version of cloud is too low, and feign does not support gzip decoding. Without upgrading the jar, a filter was added.

 

code show as below:

public class FeignResponseDecoder implements Decoder {
    private final Decoder delegate;
 
    public FeignResponseDecoder(Decoder delegate) {
        Objects.requireNonNull(delegate, "Decoder must not be null. ");
        this.delegate = delegate;
    }
 
    @Override
    public Object decode(Response response, Type type) throws IOException {
        Collection<String> values = response.headers().get(HttpEncoding.CONTENT_ENCODING_HEADER);
        if (Objects.nonNull(values) && !values.isEmpty() && values.contains(HttpEncoding.GZIP_ENCODING)) {
            byte[] compressed = Util.toByteArray(response.body().asInputStream());
            if ((compressed == null) || (compressed.length == 0)) {
                return delegate.decode(response, type);
            }
            //decompression part
            //after decompress we are delegating the decompressed response to default
            //decoder
            if (isCompressed(compressed)) {
                final StringBuilder output = new StringBuilder();
                final GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(compressed));
                final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(gis, StandardCharsets.UTF_8));
                String line;
                while ((line = bufferedReader.readLine()) != null) {
                    output.append(line);
                }
                Response uncompressedResponse = response.toBuilder().body(output.toString().getBytes()).build();
                return delegate.decode(uncompressedResponse, type);
            } else {
                return delegate.decode(response, type);
            }
        } else {
            return delegate.decode(response, type);
        }
    }
 
    private static boolean isCompressed(final byte[] compressed) {
        return (compressed[0] == (byte) (GZIPInputStream.GZIP_MAGIC)) && (compressed[1] == (byte) (GZIPInputStream.GZIP_MAGIC >> 8));
    }
}

 

Then inject this class as a bean:

@Bean
public Decoder GZIPResponseDecoder(ObjectFactory<HttpMessageConverters> messageConverters) {
    Decoder decoder = new FeignResponseDecoder(new SpringDecoder(messageConverters));
    return decoder;
}

Yaml is installed, and the error YAMLLoadWarning is reported as soon as the code runs: calling yaml.load() without Loader=… is deprecated, as the default Loader is unsafe.

Yaml is installed and the old code runs as soon as the error is reported
YAMLLoadWarning: calling yaml.load() without Loader=… is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details .

solve

You don’t need to change a lot of code and add a sentence. Just yaml.load(list, Loader=yaml.FullLoader) add Loader=yaml.FullLoader. But there are more usages. See below

Then no more errors

Redis cannot double-click redis-server.exe to start normally

Redis error: Creating Server TCP listening socket 127.0.0.1:6379: bind: No error shutdowncan not be solved

redis error message
First use redis-cli.exeand then use the shutdownfollowing error message and can not quit is:
(error) NOAUTH Authentication required.
this time redis need to enter the password set before.
127.0.0.1:6379> auth password
Enter after entering the correct password shutdownto
final execution exit
and then enter redis-server.exe redis.windows.conf to normal operation
image

fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include

fatal error C1189: #error: WINDOWS.H already included. MFC apps must not #include <windows.h>

About fatal error C1189: #error: WINDOWS.H already included. MFC apps must not #include

guitao_w 2010-03-18 21:55:00 3791 Collection
classification column: C/C++ Article Tags: mfc c
copyright
program has this problem:

fatal error C1189: #error: WINDOWS.H already included. MFC apps must not #include <windows.h>

 

The solution is as follows, under Mark

  1. Add in the stdafx.h file: #include “afx.h”  
  2. Delete in the stdafx.h file: #include <windows.h>  

Mybatis Error: Result Maps collection already contains value

1.Problem description

An inexplicable error occurred when mybatis started under idea

org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\idea_work\2021-04-06\xxxx\test-web\target\classes\mapper\demo\ExampleAsyncTreeMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [D:\idea_work\2021-04-06\xxxx\test-web\target\classes\mapper\demo\ExampleAsyncTreeMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.xxxx.web.test.mapper.ExampleAsyncTreeMapper.ExampleAsyncTreeResult
	at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:595)
	at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.afterPropertiesSet(MybatisSqlSessionFactoryBean.java:431)
	at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.getObject(MybatisSqlSessionFactoryBean.java:628)
	at com.xxxx.common.db.collector.SqlSessionFactoryCreator.createSqlSessionFactory(SqlSessionFactoryCreator.java:274)
	at com.xxxx.common.core.config.SqlSessionFactoryConfig.sqlSessionFactoryPrimary(SqlSessionFactoryConfig.java:46)
	at com.xxxx.common.core.config.SqlSessionFactoryConfig$$EnhancerBySpringCGLIB$$916ae73.CGLIB$sqlSessionFactoryPrimary$0(<generated>)
	at com.xxxx.common.core.config.SqlSessionFactoryConfig$$EnhancerBySpringCGLIB$$916ae73$$testClassBySpringCGLIB$$e60ba3c6.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
	at com.xxxx.common.core.config.SqlSessionFactoryConfig$$EnhancerBySpringCGLIB$$916ae73.sqlSessionFactoryPrimary(<generated>)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:635)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1509)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1404)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
	at com.xxxx.testApplication.main(testApplication.java:38)
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [D:\idea_work\2021-04-06\xxxx\test-web\target\classes\mapper\demo\ExampleAsyncTreeMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.xxxx.web.test.mapper.ExampleAsyncTreeMapper.ExampleAsyncTreeResult
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:123)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:95)
	at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:593)
	... 56 common frames omitted
Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.xxxx.web.test.mapper.ExampleAsyncTreeMapper.ExampleAsyncTreeResult
	at com.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap.put(MybatisConfiguration.java:429)
	at com.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap.put(MybatisConfiguration.java:399)
	at com.baomidou.mybatisplus.core.MybatisConfiguration.addResultMap(MybatisConfiguration.java:253)
	at org.apache.ibatis.builder.MapperBuilderAssistant.addResultMap(MapperBuilderAssistant.java:209)
	at org.apache.ibatis.builder.ResultMapResolver.resolve(ResultMapResolver.java:47)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:289)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:254)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:246)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:119)
	... 58 common frames omitted

The returned error message: caused by: Java. Lang. illegalargumentexception: result maps collection already contains value for has been explained, there are duplicate!

2.Solutions

Global search of this class, there are indeed two, delete the irrelevant one on the line! Or clear it and recompile it

</ div>

.NETproject compilation error. Type or namespace name could not be found. Visual studio automatically introduces dependency package (shortcut key)

Intro

Using visual studio to compile a. Net MVC project, many errors are reported in the following form:

CS0246	The type or namespace name 'xxx' could not be found (are you missing a using directive or an assembly reference?)
CS0246	Typ- oder Namespace-Name "xxx" nicht gefunden (fehlender Verwendungshinweis oder Assembly-Referenz?)

Screenshot:

Similar to in Java, if you directly use some class definitions without importing related packages, a similar error will be reported.

CS 0246 official document of error code: compiler error cs0246 | Microsoft docs

solve

In the above screenshot, the solution has been given:

is actually to add the correct class path using XXX .

However, in different versions of visual studio, does not introduce the same shortcut keys in the namespace where the class is located.

There are three ways to try:

Alt+Enter
Ctrl+.
Shift+Alt+F10

Of course, if you don’t know the shortcut key, but you know the full path (namespace, classname) of the class you are using, you should add using XXX at the beginning of the source code is OK.

Proguard Packaging Error: You have to specify ‘-keep‘ options if you want to write out kept elements with ‘-print

1.Problem description

Using Proguard to obfuscate the code and execute the package command, the following error is reported:

 [proguard] Error: You have to specify '-keep' options if you want to write out kept elements with '-printseeds'.
 [proguard] Note: you're ignoring all warnings!

2.Solutions

This is because when performing obfuscation in Proguard, you must specify a – keep. If you want to obfuscate all, fill in a nonexistent package name

<option>-keep public class com.aaaa.* {
  public protected *;
  }
</option>

How to Solve error C2039: “to_ String “: not a member of” STD “

To_string is a function only available in C++11. This error is probably the reason why it was used in older versions of C++Solutions:

#include <string>
#include <sstream>

template <typename T>
std::string to_string(T value)
{
	std::ostringstream os ;
	os << value ;
	return os.str() ;
}

int main()
{
	std::string perfect = to_string(5) ;
}

“//./root/CIMV2” because of error 0x80041003. Events cannot be delivered through this filter until t…

windows system log error messages:

Event filter with query “SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA “Win32_Processor” AND TargetInstance. LoadPercentage > 99″ could not be reactivated in namespace “//. /root/CIMV2” because of error 0x80041003. Events cannot be delivered through this filter until the problem is corrected.

Solution:

On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
X = 0
T = True
While T
    Input = InputBox("Filename Lowercase Batch Convertor" & vbCrLf & vbCrLf & _
    "Please input the destination folder name. e.g. C:\Webmaster" & vbCrLf & vbCrLf & _
    "Note: Do NOT add '\' in the end of folder name!","FLowercase Convertor","C:\")
    If Input = "" Then
        MsgBox"Folder name is empty!",48,"Error!"
        T = True
    Else T = False
    End If
WEnd
MsgBox"All files names of " & Input & " will be converted to lowercase now...",64,"Note"
fold(Input)
MsgBox"Done! Total " & X & " file(s) were converted to lowercase.",64,"Done"
Sub fold(Path)
    Set f = fso.GetFolder(Path)
    Set rf = fso.GetFolder(Path).files
    Set fc = f.SubFolders
    For Each fff In rf
        lcf1 = LCase(fso.GetAbsolutePathName(fff))
        fso.MoveFile fff, lcf1
        X = X + 1
    Next
    For Each f1 In fc
        fold(f1)
        Set file = fso.GetFolder(f1).files
        For Each ff In file
            lcf = LCase(fso.GetAbsolutePathName(ff))
            fso.MoveFile ff,lcf
        Next
    Next
End Sub

Error while trying to run project:unable to start debugging.the debugger is not properly installed. run setup to install or repa

Error while trying to run project:unable to start debugging. the debugger is not properly installed. run setup to install or repair the debugger。

Solution 1: Run the Visual Studio .NET Add/Remove feature from “Control Panel > Add or Remove Programs”, by selecting the correct version of Visual Studio and clicking on “Change/Repair” button. In my case this solution did not fix the problem.

Solution 2: Reinstall .NET Framework debugging services.

Open command prompt
Type “cd /d %windir%/Microsoft.NET/Framework/”
regsvr32.exe mscordbi.dll
Unfortunately, this solution did not fix my problem either.

Solution 3: Manually register mdm.exe.

Open command prompt
Type “%CommonProgramFiles%/Microsoft Shared/VS7Debug/mdm. exe” /regserver
This solution did not work for me either.