版本3.9.0 server.port作为启动配置中的VM arg退出工作

时间:2017-07-31 14:33:15

标签: spring spring-boot spring-tool-suite

自从将STS升级到版本3.9.0后,似乎在启动配置中通过VM args设置server.port属性存在新问题。在Debug / Run配置屏幕的Arguments选项卡上,在VM参数窗口中,我有-Dserver.port=8123。此启动配置已运行超过6个月,但升级到3.9.0后,现在我收到与解析端口号相关的NumberFormat异常。 Caused by: java.lang.NumberFormatException: For input string: "8123-noverify"如果我将端口号分配移动到application.yml属性文件中,问题就会消失。如果我在启动配置中使用Spring arg格式--server.port = 8123,问题也会消失。问题仅限于解析-Dserver.port= VM arg。我不知道问题是否影响server.port以外的其他VM args。

编辑:(堆栈跟踪)

2017-07-31 09:35:17.011 [main] DEBUG c.b.m.m.MtrDaemonApplication - Running with Spring Boot v1.3.3.RELEASE, Spring v4.2.5.RELEASE
2017-07-31 09:35:17.012 [main] INFO  c.b.m.m.MtrDaemonApplication - The following profiles are active: local
2017-07-31 09:35:17.012 [main] DEBUG org.springframework.boot.SpringApplication - Loading source class com.bnsf.mtr.mtd.MtrDaemonApplication
2017-07-31 09:35:17.065 [background-preinit] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property
2017-07-31 09:35:17.067 [background-preinit] INFO  org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 5.2.4.Final
2017-07-31 09:35:17.079 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Activated profiles local
2017-07-31 09:35:17.079 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped (empty) config file 'classpath:/application.properties'
2017-07-31 09:35:17.080 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Profiles already activated, '[dev]' will not be applied
2017-07-31 09:35:17.080 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Loaded config file 'classpath:/application.yml'
2017-07-31 09:35:17.080 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped (empty) config file 'classpath:/application.properties' for profile local
2017-07-31 09:35:17.080 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Loaded config file 'classpath:/application.yml' for profile local
2017-07-31 09:35:17.081 [main] INFO  org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext - Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3d9fc57a: startup date [Mon Jul 31 09:35:17 CDT 2017]; root of context hierarchy
2017-07-31 09:35:17.086 [main] DEBUG org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext - Bean factory for org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3d9fc57a: org.springframework.beans.factory.support.DefaultListableBeanFactory@5bb3131b: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,mtrDaemonApplication]; root of factory hierarchy
2017-07-31 09:35:17.104 [background-preinit] DEBUG org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver - Found javax.persistence.Persistence on classpath containing 'getPersistenceUtil'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver
2017-07-31 09:35:17.106 [background-preinit] DEBUG org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver - Instantiated JPA aware TraversableResolver of type org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.
2017-07-31 09:35:18.708 [main] ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.IllegalStateException: Error processing condition on org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$EndpointWebMvcConfiguration
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:64)
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$TrackedConditionEvaluator.shouldSkip(ConfigurationClassBeanDefinitionReader.java:436)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$TrackedConditionEvaluator.shouldSkip(ConfigurationClassBeanDefinitionReader.java:425)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:127)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:333)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at org.springframework.boot.SpringApplication$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at c.b.m.m.MtrDaemonApplication.main(MtrDaemonApplication.groovy:94)
Caused by: org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [java.lang.Integer] for value '8123-noverify'; nested exception is java.lang.NumberFormatException: For input string: "8123-noverify"
at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:41)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:176)
at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:98)
at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:65)
at org.springframework.core.env.AbstractEnvironment.getProperty(AbstractEnvironment.java:541)
at org.springframework.boot.bind.RelaxedPropertyResolver.getProperty(RelaxedPropertyResolver.java:82)
at org.springframework.boot.bind.RelaxedPropertyResolver.getProperty(RelaxedPropertyResolver.java:72)
at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ManagementServerPort.getPortProperty(EndpointWebMvcAutoConfiguration.java:357)
at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ManagementServerPort.get(EndpointWebMvcAutoConfiguration.java:309)
at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$OnManagementMvcCondition.getMatchOutcome(EndpointWebMvcAutoConfiguration.java:295)
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
... 22 common frames omitted
Caused by: java.lang.NumberFormatException: For input string: "8123-noverify"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.valueOf(Unknown Source)
at org.springframework.util.NumberUtils.parseNumber(NumberUtils.java:194)
at org.springframework.core.convert.support.StringToNumberConverterFactory$StringToNumber.convert(StringToNumberConverterFactory.java:62)
at org.springframework.core.convert.support.StringToNumberConverterFactory$StringToNumber.convert(StringToNumberConverterFactory.java:49)
at org.springframework.core.convert.support.GenericConversionService$ConverterFactoryAdapter.convert(GenericConversionService.java:425)
at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:35)
... 33 common frames omitted
2017-07-31 09:35:18.714 [main] INFO  org.springframework.boot.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [...]

1 个答案:

答案 0 :(得分:2)

您的问题是由错误引起的。它是been fixed但是,在撰写本文时,尚未将其发布为版本。

您可以通过打开偏好设置,导航至Spring -> Boot并清除Java VM arguments to trigger app's fast startup来解决此问题,默认情况下,-noverify -XX:TieredStopAtLevel=1包含<script> var stickyNavTop = $('#navbarc').offset().top; $(window).scroll(function() { if ($(window).scrollTop() > stickyNavTop) { $('#navbarc').addClass('fixed'); } else { $('#navbarc').removeClass('fixed'); } }); </script>