title: Failed to connect to MBean server at port 9001: Could not invoke shutdown operation: Connection refused to host: 127.0.0.1
body: <p>I am using this <a href="https://github.com/springdoc/springdoc-openapi-maven-plugin" rel="nofollow noreferrer">plugin</a> to generate a JSON file during the build time. I have created a test profile in configuration and using the below command to run.</p>
  <p><code>mvn clean install -Dgpg.skip -Dspring.profiles.active=test -P test</code></p>
  <p>It's giving an error message. <code>Failed to connect to MBean server at port 9001: Could not invoke shutdown operation: Connection refused to host: 127.0.0.1</code></p>
  <p>I am having <code>bootstrap.properties</code> in my <code>src/main/resources</code>. So I created <code>application-test.properties</code> in same folder <code>src/main/resources</code>.</p>
  <p>I am using this configuration in the <code>springdoc-openapi-maven-plugin</code>.</p>
  <pre><code>&lt;plugin&gt;
                  &lt;groupId&gt;org.springdoc&lt;/groupId&gt;
                  &lt;artifactId&gt;springdoc-openapi-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.1&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;integration-test&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;generate&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
                  
                  &lt;configuration&gt;
                  &lt;useTestClasspath&gt;true&lt;/useTestClasspath&gt;
                  &lt;profiles&gt;
                          &lt;profile&gt;test&lt;/profile&gt;
                      &lt;/profiles&gt;
                      &lt;apiDocsUrl&gt;http://localhost:8083/registrationprocessor/v1/registrationstatus/v2/api-docs?group=Registration%20Status&lt;/apiDocsUrl&gt;
                      &lt;outputFileName&gt;openapi.json&lt;/outputFileName&gt;
                      &lt;outputDir&gt;${project.build.directory}&lt;/outputDir&gt;
                      &lt;skip&gt;false&lt;/skip&gt;
                  &lt;/configuration&gt;
                  
              &lt;/plugin&gt;
  </code></pre>
  <p>Full Error message:</p>
  <pre><code>{&quot;@timestamp&quot;:&quot;2021-05-21T12:17:21.856+05:30&quot;,&quot;@version&quot;:&quot;1&quot;,&quot;message&quot;:&quot;Could not locate PropertySource: Invalid URL: localhost&quot;,&quot;logger_name&quot;:&quot;org.springframework.cloud.config.client.ConfigServicePropertySourceLocator&quot;,&quot;thread_name&quot;:&quot;main&quot;,&quot;level&quot;:&quot;WARN&quot;,&quot;level_value&quot;:30000,&quot;appName&quot;:&quot;registration-processor,application&quot;}
  {&quot;@timestamp&quot;:&quot;2021-05-21T12:17:21.866+05:30&quot;,&quot;@version&quot;:&quot;1&quot;,&quot;message&quot;:&quot;The following profiles are active: dev&quot;,&quot;logger_name&quot;:&quot;io.mosip.registration.processor.status.api.RegistrationStatusApiApplication&quot;,&quot;thread_name&quot;:&quot;main&quot;,&quot;level&quot;:&quot;INFO&quot;,&quot;level_value&quot;:20000,&quot;appName&quot;:&quot;registration-processor,application&quot;}
  {&quot;@timestamp&quot;:&quot;2021-05-21T12:17:21.891+05:30&quot;,&quot;@version&quot;:&quot;1&quot;,&quot;message&quot;:&quot;Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6eb82908: startup date [Fri May 21 12:17:21 IST 2021]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@172ca72b&quot;,&quot;logger_name&quot;:&quot;org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext&quot;,&quot;thread_name&quot;:&quot;main&quot;,&quot;level&quot;:&quot;INFO&quot;,&quot;level_value&quot;:20000,&quot;appName&quot;:&quot;registration-processor,application&quot;}
  {&quot;@timestamp&quot;:&quot;2021-05-21T12:17:22.147+05:30&quot;,&quot;@version&quot;:&quot;1&quot;,&quot;message&quot;:&quot;Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [io.mosip.registration.processor.status.api.RegistrationStatusApiApplication]; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'mosip.auth.adapter.impl.basepackage' in value \&quot;${mosip.auth.adapter.impl.basepackage}\&quot;&quot;,&quot;logger_name&quot;:&quot;org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext&quot;,&quot;thread_name&quot;:&quot;main&quot;,&quot;level&quot;:&quot;WARN&quot;,&quot;level_value&quot;:30000,&quot;appName&quot;:&quot;registration-processor,application&quot;}
  {&quot;@timestamp&quot;:&quot;2021-05-21T12:17:22.156+05:30&quot;,&quot;@version&quot;:&quot;1&quot;,&quot;message&quot;:&quot;Application run failed&quot;,&quot;logger_name&quot;:&quot;org.springframework.boot.SpringApplication&quot;,&quot;thread_name&quot;:&quot;main&quot;,&quot;level&quot;:&quot;ERROR&quot;,&quot;level_value&quot;:40000,&quot;stack_trace&quot;:&quot;org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [io.mosip.registration.processor.status.api.RegistrationStatusApiApplication]; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'mosip.auth.adapter.impl.basepackage' in value \&quot;${mosip.auth.adapter.impl.basepackage}\&quot;\n\tat org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:184)\n\tat org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316)\n\tat org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)\n\tat org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)\n\tat org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)\n\tat org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)\n\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)\n\tat org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)\n\tat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)\n\tat org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:327)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)\n\tat io.mosip.registration.processor.status.api.RegistrationStatusApiApplication.main(RegistrationStatusApiApplication.java:30)\nCaused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'mosip.auth.adapter.impl.basepackage' in value \&quot;${mosip.auth.adapter.impl.basepackage}\&quot;\n\tat org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:172)\n\tat org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124)\n\tat org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:237)\n\tat org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:211)\n\tat org.springframework.core.env.AbstractEnvironment.resolveRequiredPlaceholders(AbstractEnvironment.java:567)\n\tat org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.resolveBasePackage(ClassPathScanningCandidateComponentProvider.java:481)\n\tat org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:420)\n\tat org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:316)\n\tat org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:275)\n\tat org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132)\n\tat org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:288)\n\tat org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245)\n\tat org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:202)\n\tat org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:170)\n\t... 13 common frames omitted\n&quot;,&quot;appName&quot;:&quot;registration-processor,application&quot;}
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time:  49.449 s
  [INFO] Finished at: 2021-05-21T12:17:22+05:30
  [INFO] ------------------------------------------------------------------------
  [WARNING] The requested profile &quot;test&quot; could not be activated because it does not exist.
  [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.3.4.RELEASE:start (pre-integration-test) on project registration-processor-registration-status-service: Could not figure out if the application has started: Failed to connect to MBean server at port 9001: Could not invoke shutdown operation: Connection refused to host: 127.0.0.1; nested exception is: 
  [ERROR]     java.net.ConnectException: Connection refused (Connection refused)
  [ERROR] -&gt; [Help 1]
  [ERROR] 
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
  </code></pre>
  <p>I am setting dev profile in my <code>bootstrap.properties</code> in <code>src/main/resources</code>.</p>
  <pre><code>spring.profiles.active=dev
  </code></pre>
  <p>When I change this to</p>
  <pre><code>spring.profiles.active=dev, test
  </code></pre>
  <p>It's successfully generating openapi.json giving this warning <code>[WARNING] The requested profile &quot;test&quot; could not be activated because it does not exist</code>. with this command <code>mvn clean install -Dgpg.skip -Dspring.profiles.active=test -P test</code>.
  But I want the test profile should be considered from mvn command so I used <code>-Dspring.profiles.active=test</code> but still it's not considering my test profile until I explicitly put it in my bootstrap.</p>
  <p>The full codebase can be found <a href="https://github.com/mosip/registration/tree/master/registration-processor/init/registration-processor-registration-status-service" rel="nofollow noreferrer">here</a> as I didn't push to these things as it's having issues.
  Any help would be appreciated.</p>