Search code examples
springspring-bootspring-tool-suite

version 3.9.0 server.port as VM arg in Launch config quit working


Since upgrading STS to version 3.9.0, it seems there is a new issue with setting the server.port property via VM args in Launch configurations. On the Arguments tab of the Debug/Run configurations screen, in the VM arguments window, I have -Dserver.port=8123. This launch configuration has been working for over 6 months, but after upgrading to 3.9.0, now I'm getting a NumberFormat exception related to parsing the port number. Caused by: java.lang.NumberFormatException: For input string: "8123-noverify" If I move the port number assignment into the application.yml properties file, the issue goes away. The issue also goes away if I use the Spring arg format --server.port=8123 in the launch config. The problem is restricted to parsing the -Dserver.port= VM arg. I don't know if the issue affects other VM args besides server.port.

Edit: (stack trace)

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: [...]

Solution

  • Your problem's caused by a bug. It's been fixed but, at the time of writing, it has yet to make it into a release.

    You can work around the problem by opening preferences, navigating to Spring -> Boot and clearing Java VM arguments to trigger app's fast startup which, by default, contains -noverify -XX:TieredStopAtLevel=1.