dji-sdk / DJI-Cloud-API-Demo

MIT License
147 stars 105 forks source link

1.9.0 fails to start if gb28181 section is not configured #52

Closed neilyoung closed 8 months ago

neilyoung commented 9 months ago

My section (as inherited and not touched):

    gb28181:
      serverIP: Please enter the server ip.
      serverPort: Please enter the server port.
      serverID: Please enter the server id.
      agentID: Please enter the agent id.
      agentPassword: Please enter the agent password.
      localPort: Please enter the local port.
      channel: Please enter the channel.

Reaction on startup:

2024-02-28 14:30:42.195 ERROR 125793 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'livestream.url.gb28181.local-port' to java.lang.Integer:

    Property: livestream.url.gb28181.local-port
    Value: "Please enter the local port."
    Origin: class path resource [application.yml] from sample-1.9.0.jar - 145:18
    Reason: failed to convert java.lang.String to @javax.validation.constraints.NotNull java.lang.Integer (caused by java.lang.NumberFormatException: For input string: "Pleaseenterthelocalport.")

Action:

Update your application's configuration

java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'liveStreamProperty': Could not bind properties to 'LiveStreamProperty' : prefix=livestream.url, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'livestream.url.gb28181.local-port' to java.lang.Integer
        at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:92)
        at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:78)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:920)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)
        at com.dji.sample.CloudApiSampleApplication.main(CloudApiSampleApplication.java:16)
        ... 6 more
Caused by: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'livestream.url.gb28181.local-port' to java.lang.Integer
        at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:387)
        at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:347)
        at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$4(Binder.java:472)
        at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:98)
        at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:86)
        at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:62)
        at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:476)
        at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:590)
        at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:576)
        at org.springframework.boot.context.properties.bind.Binder$Context.access$300(Binder.java:537)
        at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:474)
        at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:414)
        at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:343)
        at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$4(Binder.java:472)
        at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:98)
        at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:86)
        at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:62)
        at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:476)
        at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:590)
        at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:576)
        at org.springframework.boot.context.properties.bind.Binder$Context.access$300(Binder.java:537)
        at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:474)
        at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:414)
        at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:343)
        at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:332)
        at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:262)
        at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:249)
        at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.bind(ConfigurationPropertiesBinder.java:95)
        at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:89)
        ... 25 more
Caused by: org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@javax.validation.constraints.NotNull java.lang.Integer] for value [Please enter the local port.]; nested exception is java.lang.NumberFormatException: For input string: "Pleaseenterthelocalport."
        at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:47)
        at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192)
        at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:109)
        at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:100)
        at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:92)
        at org.springframework.boot.context.properties.bind.Binder.bindProperty(Binder.java:459)
        at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:403)
        at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:343)
        ... 52 more
Caused by: java.lang.NumberFormatException: For input string: "Pleaseenterthelocalport."
        at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.base/java.lang.Integer.parseInt(Integer.java:652)
        at java.base/java.lang.Integer.valueOf(Integer.java:983)
        at org.springframework.util.NumberUtils.parseNumber(NumberUtils.java:211)
        at org.springframework.core.convert.support.StringToNumberConverterFactory$StringToNumber.convert(StringToNumberConverterFactory.java:64)
        at org.springframework.core.convert.support.StringToNumberConverterFactory$StringToNumber.convert(StringToNumberConverterFactory.java:50)
        at org.springframework.core.convert.support.GenericConversionService$ConverterFactoryAdapter.convert(GenericConversionService.java:437)
        at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:41)
        ... 59 more

I commented the section and the app started. You should provide a commented template.

scortLi commented 8 months ago

@neilyoung 你好这个解决了吗,我也遇到这个问题了

neilyoung commented 8 months ago

I commented the section and the app started. You should provide a commented template.

Like so

scortLi commented 8 months ago

@neilyoung 请问你解决了吗 如果解决了能告诉我怎么解决的吗

neilyoung commented 8 months ago

??

scortLi commented 8 months ago

@neilyoung Description:

Failed to bind properties under 'livestream.url.gb28181.local-port' to java.lang.Integer:

Property: livestream.url.gb28181.local-port
Value: "Please enter the local port."
Origin: class path resource [application.yml] from sample-1.9.0.jar - 145:18
Reason: failed to convert java.lang.String to @javax.validation.constraints.NotNull java.lang.Integer (caused by java.lang.NumberFormatException: For input string: "Pleaseenterthelocalport.")

Action:

Update your application's configuration 上云API的后台源码报这个错误你解决了吗

neilyoung commented 8 months ago

Man, can you read? Since I don't use that obscure gb-blabla I just commented the entire section and boom - fixed

neilyoung commented 8 months ago

But other than that: If you use this crap, then just follow the description:

Reason: failed to convert java.lang.String to @javax.validation.constraints.NotNull java.lang.Integer (caused by java.lang.NumberFormatException: For input string: "Pleaseenterthelocalport.")

So you need to provide an INTEGER port...

scortLi commented 8 months ago

@neilyoung 这是什么意思呢,新手小白,可以说清楚一点吗

Pure0319 commented 2 weeks ago

@neilyoung 这是什么意思呢,新手小白,可以说清楚一点吗

他好像看不懂中文 就你把关于gb部分注释掉就行 在配置文件里application