精华内容
下载资源
问答
  • MySQL nested exception is com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Invalid JSON text: "Invalid value." at position 1 in value for column

    前言

    网上没有现成答案解决这种json数据格式的

    ### SQL: INSERT  INTO `order`(`o_id`,`department_id`,`start_adress`,`end_adress`,`proposer`,`relevant_user_id`,`remarks`,`start_time`,`end_time`,`status`,`other`,`c_time`,`title`)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)
    ### Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Invalid JSON text: "Invalid value." at position 1 in value for column 'order.relevant_user_id'.
    ; Data truncation: Invalid JSON text: "Invalid value." at position 1 in value for column 'order.relevant_user_id'.; nested exception is com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Invalid JSON text: "Invalid value." at position 1 in value for column 'order.relevant_user_id'.
    
    

    解决

    在这里插入图片描述
    这种json类型传值 用斜杠转译 单引号无效
    在这里插入图片描述

    {
      
      "departmentId": "121",
      "endAdress": "广州东站",
      "endTime": "2020-11-11 14:30:30",
      "other": "【带两个】",
      "proposer": "0112119838",
      "relevantUserId": "[[\"0112119838\"]]",
      "remarks": "接送旅客",
      "startAdress": "白云机场",
      "startTime": "2020-11-11 18:30:30",
      "status": 0,
      "title": "测试"
    }
    
    展开全文
  • Unexpected end-of-input in VALUE_STRING

    千次阅读 热门讨论 2019-02-28 14:08:23
    org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected end-of-input in VALUE_STRING; nested exception is com.fasterxml.jackson.core.io....

    使用spring mvc的时候报了这个错误:

    org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected end-of-input in VALUE_STRING; nested exception is com.fasterxml.jackson.core.io.JsonEOFException: Unexpected end-of-input in VALUE_STRING
     at [Source: (PushbackInputStream); line: 1, column: 27]
    	at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:243) ~[spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.read(AbstractJackson2HttpMessageConverter.java:225) ~[spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:206) ~[spring-webmvc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:157) ~[spring-webmvc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:130) ~[spring-webmvc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:124) ~[spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:161) [spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:131) [spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) [spring-webmvc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891) [spring-webmvc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) [spring-webmvc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) [spring-webmvc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) [spring-webmvc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) [spring-webmvc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) [spring-webmvc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877) [spring-webmvc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851) [spring-webmvc-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) [druid-1.1.10.jar:1.1.10]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90) [spring-boot-actuator-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) [spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) [spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.springframework.cloud.sleuth.instrument.web.ExceptionLoggingFilter.doFilter(ExceptionLoggingFilter.java:48) [spring-cloud-sleuth-core-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at brave.servlet.TracingFilter.doFilter(TracingFilter.java:86) [brave-instrumentation-servlet-5.4.3.jar:?]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:155) [spring-boot-actuator-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:123) [spring-boot-actuator-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:108) [spring-boot-actuator-2.0.6.RELEASE.jar:2.0.6.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) [spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]
    	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.34.jar:8.5.34]
    	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
    Caused by: com.fasterxml.jackson.core.io.JsonEOFException: Unexpected end-of-input in VALUE_STRING
     at [Source: (PushbackInputStream); line: 1, column: 27]
    	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportInvalidEOF(ParserMinimalBase.java:594) ~[jackson-core-2.9.7.jar:2.9.7]
    	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportInvalidEOF(ParserMinimalBase.java:571) ~[jackson-core-2.9.7.jar:2.9.7]
    	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._loadMoreGuaranteed(UTF8StreamJsonParser.java:2340) ~[jackson-core-2.9.7.jar:2.9.7]
    	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishString2(UTF8StreamJsonParser.java:2425) ~[jackson-core-2.9.7.jar:2.9.7]
    	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishAndReturnString(UTF8StreamJsonParser.java:2405) ~[jackson-core-2.9.7.jar:2.9.7]
    	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.getText(UTF8StreamJsonParser.java:269) ~[jackson-core-2.9.7.jar:2.9.7]
    	at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer$Vanilla.deserialize(UntypedObjectDeserializer.java:672) ~[jackson-databind-2.9.7.jar:2.9.7]
    	at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:527) ~[jackson-databind-2.9.7.jar:2.9.7]
    	at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:364) ~[jackson-databind-2.9.7.jar:2.9.7]
    	at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:29) ~[jackson-databind-2.9.7.jar:2.9.7]
    	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013) ~[jackson-databind-2.9.7.jar:2.9.7]
    	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3084) ~[jackson-databind-2.9.7.jar:2.9.7]
    	at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:237) ~[spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    	... 74 more
    

    在错误信息中没有我自己写的代码,所以应该是请求数据出问题了,但是单单看这个错误又不知道数据到底出什么错了,所以我就写了一个拦截器,拦截所有的请求,

    public class DataInterceptor implements HandlerInterceptor {
    
        @Override
        public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
    
    
            ServletInputStream inputStream = request.getInputStream();
    
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    
            IOUtils.copy(inputStream, byteArrayOutputStream);
    
            byte[] bytes = byteArrayOutputStream.toByteArray();
            String body = new String(bytes, Charset.forName("UTF-8"));
    
            System.out.println("=======================" + body);
            return false;
        }
    
        @Override
        public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
    
        }
    
        @Override
        public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
    
        }
    }
    

    这个拦截器只做了一件事,拦截请求,读取post的数据(我的请求是post请求),结果发现读取到的请求数据是这样的:

    {"张三":"zhang
    

    明显数据读取出错了,因为之前读过http协议详解那本书,我记得书中说如果content-length和实际的数据不一致就会出现读取数据出错的问题,而恰好我发起请求方的代码通过filter统一修改了post请求的参数,但又没有重新设置content-length, 所以问题就清楚了,只要重新设置content-lenth就可以了。
    重新设置后,问题就没了。

    展开全文
  • 经验总结:Could not resolve placeholder ‘config.info’ in value "${config.info},对于这种无法注入问题,一定是配置文件出现问题,有几种可能: 1. 配置文件格式写错 2. 文件格式写错 3. 没有按照命名规范配置...

    经验总结:Could not resolve placeholder ‘config.info’ in value "${config.info},对于这种无法注入问题,一定是配置文件出现问题,有几种可能:

    1. 配置文件格式写错
    2. 文件格式写错
    3. 没有按照命名规范配置配置文件

    以下是报错信息:

    Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    2020-06-30 16:01:24.896 ERROR 32660 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed
    
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.nacosController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'config.info' in value "${config.info}"
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:359) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$568/11974505.getObject(Unknown Source) ~[na:na]
    	at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:389) ~[spring-cloud-context-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    	at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:186) ~[spring-cloud-context-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:356) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.cloud.context.scope.refresh.RefreshScope.eagerlyInitialize(RefreshScope.java:127) ~[spring-cloud-context-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    	at org.springframework.cloud.context.scope.refresh.RefreshScope.start(RefreshScope.java:118) ~[spring-cloud-context-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    	at org.springframework.cloud.context.scope.refresh.RefreshScope.onApplicationEvent(RefreshScope.java:112) ~[spring-cloud-context-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    	at org.springframework.cloud.context.scope.refresh.RefreshScope.onApplicationEvent(RefreshScope.java:66) ~[spring-cloud-context-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    

    造成的原因是小编不小心将配置文件命名方式写错

    Data ID: nacos-config-client.dev.yaml
    正确命名方式应该是:
    ${spring.application.name}-${spring.profile.active}.${spring.cloud.nacos.config.file-extension}
    

    重新按照命名方式创建即可

    nacos-config-client-dev.yaml
    
    展开全文
  • 今天参考spring cloud config配置写了一个service和client,启动...Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'foo' in value "${foo}" at org.springframework.util.Proper...

    今天参考spring cloud config配置写了一个service和client,启动client的时候报错:

     

    Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'foo' in value "${foo}"
    	at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174) ~[spring-core-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    	at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126) ~[spring-core-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    	at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:236) ~[spring-core-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    	at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    	at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$2.resolveStringValue(PropertySourcesPlaceholderConfigurer.java:172) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:831) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1086) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    	... 17 common frames omitted


    奇怪了,我和网上的demo写的差不多都一样啊,除了端口号还有一些其他的,然后下载他demo运行了一下,他的运行没问题,然后把我写的和他对比了一下,不会是端口号吧……把config-service的端口号改为8888,问题解决……

     

     

    个人感觉应该是client-conf客户端这块应该有些地方没配置,如果service-config那块端口号不是8888的话。

     

    补充一下,如果你的服务端的端口号写的是默认的8888的话,还有问题,那就可能是你client配置的端口号被占用了,window下cmd里命令netstat,查看端口号是否被占用

     

    如果有朋友知道上述问题的其他解决方案,希望留下你的解答

    展开全文
  • config client踩坑记录— Could not resolve placeholder* in value * 1.准备环境 ​ eureka server: 注册中心 ​ config server: 配置中心 ​ config client: 配置客户端 2、开始踩坑 eureka server搭建不用说,很...
  • Springboot多个类中引用配置文件中...)导致的报错:Couldnotresolveplaceholder′∗′invalue"{"xxx"})导致的报错:Could not resolve placeholder '*' in value ...
  • 在springboot的application.yml文件中配置了参数schedu,然后在业务中通过@Value(“${schedu}”)进行赋值,但是启动之后... Could not resolve placeholder 'schedu' in value "${schedu}"... 解...
  • 从SpringCloudConfig跳到Nacos做配置中心,结果今天遇到了一...Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'config.info' in value "${config.info}" at org.springframework....
  • 项目启动报错:Could not resolve placeholder ‘spring.datasource.url’ in value “${spring.datasource.url}” 项目在配置更改后要对maven进行clean,install的操作,清除以重新编译项目
  • Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'hello' in value "${hello}" 百度一下解决问题,感觉网上说的不是很清楚,新手的话一时半会可能看不懂,自己就写一篇博客吧。力求...
  • 报错信息:Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'webname' in value "${webname}" 正常的配置,使用config client去访问server,启动client的时候,却出现无法解析变量...
  • 启动报错:Could not resolve placeholder ‘profile.name’ in value “${profile.name}” spring.profiles.active=${profile.name} 报错 环境: 开发工具:idea 报错内容 07-30 12:11:39.336 INFO [o.s.c.s....
  • 1问题Could not resolve placeholder 'api-host' in value: 2.解决问题: // 设置@Value注解取值不到忽略(不报错) @Bean public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { ...
  • 一、前言 ...如题,springcloud config-client启动报错:Could not resolve placeholder 'from' in value "${from}",具体异常堆栈如下: Error starting ApplicationContext. To display the cond...
  • 问题描述: springcloud启动eurekaClient服务时,报如下错误Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'server.port' in value "${server.port}"解决过程: 百度...
  • Could not resolve placeholder 'mytopic' in value "${mytopic}" 可以看出是引入这个字段出现错误了。 2.问题分析 查看配置文件,引用字段都没有问题 @Value("${mytopic}") private String myTopic; 最后...
  • 这个异常是出现在注入配置文件中配置好的属性时报错的: Injection of autowired dependencies failed;... Could not resolve placeholder 'girl.name' in value "${girl.name}" 此时配置文...
  • Could not resolve placeholder ‘spring.application.name’ in value “${spring.application.name}” springboot项目启动报错,配置文件用的是application.properties。 原因:application.properties文件格式...
  • 在多模块下进行编程时,如果有Config Client在运行时,会去配置文件找$(foo)的值。 ...Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'foo' in value "${foo...
  • springcloud中,微服务从配置中心读配置时,报这个错Could not resolve placeholder 'foo' in value "${foo},主要原因是当前服务名和配置中心中的文件名的命名不对应。 比如项目名是user-center,若读dev环境的...
  • 最近在项目中用spring配置oracle数据库连接池, 启动的时候莫名的出现javax.management.MalformedObjectNameException: Invalid character '' in value part of property这个异常。
  • 项目启动报错:Could not resolve placeholder 'spring.datasource.url' in value "${spring.datasource.url}"项目在配置更改后要对maven进行clean,install的操作,清除以重新编译项目...
  • 对工具类进行测试时报错:Could not resolve placeholder '’ in value "${}"。 总的意思肯定是application.yml文件中的属性读不到,查了半天,终于找到原因:瞎 红框内丢了没写,定位不到: 补全后,搞定: ...
  • 在项目的hibernate 中使用了 Oracle的jdbd...javax.management.MalformedObjectNameException: Invalid character '' in value part of property 发现还是jdbc驱动问题,原因因该是与bug有关,因此从新从otn
  • 在启动类上配置以下代码即可 @Bean public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { PropertySourcesPlaceholderConfigurer placeholderConfigurer = new ...
  • 这几天遇到个bug,别人的机器上都能正常跑出来,我的却不行,不知道是为什么。。。 bug信息: SEVERE: Exception ...javax.management.MalformedObjectNameException: Invalid character '=' in value part of
  • in value "${mail.host}" at org . springframework . util . PropertyPlaceholderHelper . parseStringValue ( PropertyPlaceholderHelper . java : 172 ) at org . springframework . util . ...
  • Spring Boot在启动的时候,报错:spring boot Could not resolve placeholder 'xxx' in value "${aaa.bbb.ccc}"在工程内检索aaa.bbb.ccc,检查了下,发现配置文件里面少了对应的配置项:aaa.bbb.ccc。加上...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 360,416
精华内容 144,166
关键字:

invalue