Trouble configuring Spring-boot 2 Actuator - spring-boot

I want to configure the spring-boot Actuator end points for our application. Below is my pom.xml file with spring-boot actuator dependency added.
When I start the application I don't see any of the /application/ URL endpoints registered as the documentation suggests. The documentation suggests that after adding the actuator dependency to the pom.xml that I should see extra mappings in the startup log, which I don't. What could be there problem here?
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SpreadSheetUploadWeb</groupId>
<artifactId>SpreadSheetUploadWeb</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
<spring.version>5.0.8.RELEASE</spring.version>
<spring.boot.version>2.0.4.RELEASE</spring.boot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring.boot.version}</version>
<scope>test</scope>
</dependency>
<!-- Actuator for application Health/State monitoring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
</dependency>
Here is a startup log:
2018-08-08 14:16:40 INFO o.f.core.internal.command.DbMigrate - Schema "DB2INST " is up to date. No migration necessary.
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/costspreadsheet/{uploader}],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.util.List<com.ibm.cio.cloud.cost.spreadsheet.domain.CostSpreadsheet>> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.getCostSpreadsheetByUploader(java.lang.String)
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/costspreadsheet/{uploader}],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.util.List<com.ibm.cio.cloud.cost.spreadsheet.domain.CostSpreadsheet>> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.getCostSpreadsheetByUploader(java.lang.String)
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/sscdata/],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.util.List<com.ibm.cio.cloud.cost.spreadsheet.domain.BluecostSSCData>> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.getAllBluecostSSCData()
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/sscdata/],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.util.List<com.ibm.cio.cloud.cost.spreadsheet.domain.BluecostSSCData>> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.getAllBluecostSSCData()
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/sscdata/],methods=[POST]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.createBluecostSSCData(com.ibm.cio.cloud.cost.spreadsheet.domain.BluecostSSCData)
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/sscdata/],methods=[POST]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.createBluecostSSCData(com.ibm.cio.cloud.cost.spreadsheet.domain.BluecostSSCData)
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/spreadsheet/upload],methods=[POST]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.uploadSpreadsheet(org.springframework.web.multipart.MultipartFile)
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/spreadsheet/upload],methods=[POST]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.uploadSpreadsheet(org.springframework.web.multipart.MultipartFile)
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/spreadsheet/{uploader}/{filename}],methods=[DELETE]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.deleteUploadedSpreadsheet(java.lang.String,java.lang.String)
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/spreadsheet/{uploader}/{filename}],methods=[DELETE]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.deleteUploadedSpreadsheet(java.lang.String,java.lang.String)
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/sscdata/{uploader}],methods=[GET]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.findSSCDataByUploader(java.lang.String)
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/sscdata/{uploader}],methods=[GET]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.findSSCDataByUploader(java.lang.String)
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/swagger-resources/configuration/ui]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.UiConfiguration> springfox.documentation.swagger.web.ApiResourceController.uiConfiguration()
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/swagger-resources/configuration/ui]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.UiConfiguration> springfox.documentation.swagger.web.ApiResourceController.uiConfiguration()
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/swagger-resources]}" onto public org.springframework.http.ResponseEntity<java.util.List<springfox.documentation.swagger.web.SwaggerResource>> springfox.documentation.swagger.web.ApiResourceController.swaggerResources()
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/swagger-resources]}" onto public org.springframework.http.ResponseEntity<java.util.List<springfox.documentation.swagger.web.SwaggerResource>> springfox.documentation.swagger.web.ApiResourceController.swaggerResources()
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/swagger-resources/configuration/security]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.SecurityConfiguration> springfox.documentation.swagger.web.ApiResourceController.securityConfiguration()
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/swagger-resources/configuration/security]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.SecurityConfiguration> springfox.documentation.swagger.web.ApiResourceController.securityConfiguration()
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-08-08 14:16:41 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-08-08 14:16:42 INFO s.d.s.w.PropertySourcedRequestMappingHandlerMapping - Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
2018-08-08 14:16:42 INFO s.d.s.w.PropertySourcedRequestMappingHandlerMapping - Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
2018-08-08 14:16:42 INFO o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-08 14:16:42 INFO o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-08 14:16:42 INFO o.s.w.s.m.m.a.RequestMappingHandlerAdapter - Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#3967e60c: startup date [Wed Aug 08 14:16:34 MDT 2018]; root of context hierarchy
2018-08-08 14:16:42 INFO o.s.w.s.m.m.a.RequestMappingHandlerAdapter - Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#3967e60c: startup date [Wed Aug 08 14:16:34 MDT 2018]; root of context hierarchy
2018-08-08 14:16:42 INFO o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-08 14:16:42 INFO o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-08 14:16:42 INFO o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-08 14:16:42 INFO o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-08 14:16:43 INFO o.s.j.e.a.AnnotationMBeanExporter - Registering beans for JMX exposure on startup
2018-08-08 14:16:43 INFO o.s.j.e.a.AnnotationMBeanExporter - Bean with name 'dataSource' has been autodetected for JMX exposure
2018-08-08 14:16:43 INFO o.s.j.e.a.AnnotationMBeanExporter - Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
2018-08-08 14:16:43 INFO o.s.c.s.DefaultLifecycleProcessor - Starting beans in phase 2147483647
2018-08-08 14:16:43 INFO s.d.s.w.p.DocumentationPluginsBootstrapper - Context refreshed
2018-08-08 14:16:43 INFO s.d.s.w.p.DocumentationPluginsBootstrapper - Context refreshed
2018-08-08 14:16:43 INFO s.d.s.w.p.DocumentationPluginsBootstrapper - Found 1 custom documentation plugin(s)
2018-08-08 14:16:43 INFO s.d.s.w.p.DocumentationPluginsBootstrapper - Found 1 custom documentation plugin(s)
2018-08-08 14:16:43 INFO s.d.s.w.s.ApiListingReferenceScanner - Scanning for api listing references
2018-08-08 14:16:43 INFO s.d.s.w.s.ApiListingReferenceScanner - Scanning for api listing references
2018-08-08 14:16:43 INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8080"]
2018-08-08 14:16:43 INFO o.a.tomcat.util.net.NioSelectorPool - Using a shared selector for servlet write/read
2018-08-08 14:16:44 INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 8080 (http) with context path ''
2018-08-08 14:16:44 INFO c.i.c.c.c.s.BlueCostSpreadsheetUploadWebApplication - Started BlueCostSpreadsheetUploadWebApplication in 10.194 seconds (JVM running for 11.014)

It's working as expected, but the URLs that I've been trying to reach these through were not correct. I found the real URLs in the spring documentation, and for me they are:
http://localhost:8080/actuator
and
http://localhost:8080/browser.html

Related

Spring boot actuator endpoints not exposed via HTTP

we are some problems with a Spring Boot 1.5.2 application and the actuator endpoints.
Sometimes when we start the spring boot application, spring mvc don't expose the actuators endpoints via HTTP. I don't find any pattern, I neww start the same application 3 or 4 times in order to expose these endpoints.
In this application we are using:
Java 8
Spring boot 1.5.2
Spring 4.3.7
The actuator are configure adding the next dependencie to build.gradle:
compile 'org.springframework.boot:spring-boot-starter-actuator'
The configuration in application.yml:
management:
context-path: /private/actuator
security:
enabled: false
In LOG we expect to find some like this:
2018-12-05 15:15:54.585 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/private/billing],methods=[GET]}" onto public wtn.integration.webmodel.billing.response.BillingResponse
wtn.integration.controller.BillingController.process()
2018-12-05 15:15:54.587 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/private/events/recover/{reportId}],methods=[GET]}" onto public void wtn.integration.controller.EventCon
troller.recover(java.lang.Long)
2018-12-05 15:15:54.587 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/private/events/recover/{reportId}],methods=[POST]}" onto public void wtn.integration.controller.EventCo
ntroller.recover(java.lang.Long,wtn.integration.api.event.bean.Event)
2018-12-05 15:15:54.588 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/private/events/discard/{reportId}],methods=[GET]}" onto public void wtn.integration.controller.EventCon
troller.discard(java.lang.Long)
2018-12-05 15:15:54.588 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/private/events],methods=[POST]}" onto public void wtn.integration.controller.EventController.process(wt
n.integration.api.event.request.EventRequest)
2018-12-05 15:15:54.591 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframew
ork.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-12-05 15:15:54.591 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.
Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-12-05 15:15:54.672 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerAdapter - Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationCon
text#1b7f1011: startup date [Wed Dec 05 15:15:46 CET 2018]; root of context hierarchy
2018-12-05 15:15:55.978 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/env/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || appli
cation/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2018-12-05 15:15:55.979 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/env || /private/actuator/env.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-12-05 15:15:55.979 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/beans || /private/actuator/beans.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-12-05 15:15:55.979 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/configprops || /private/actuator/configprops.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-12-05 15:15:55.981 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/info || /private/actuator/info.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-12-05 15:15:55.982 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/heapdump || /private/actuator/heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2018-12-05 15:15:55.983 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/loggers/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.get(java.lang.String)
2018-12-05 15:15:55.983 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/loggers/{name:.*}],methods=[POST],consumes=[application/vnd.spring-boot.actuator.v1+json || application/json],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.set(java.lang.String,java.util.Map<java.lang.String, java.lang.String>)
2018-12-05 15:15:55.983 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/loggers || /private/actuator/loggers.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-12-05 15:15:55.984 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/health || /private/actuator/health.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,java.security.Principal)
2018-12-05 15:15:55.984 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/mappings || /private/actuator/mappings.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-12-05 15:15:55.985 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/dump || /private/actuator/dump.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-12-05 15:15:55.985 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/metrics/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2018-12-05 15:15:55.986 [restartedMain] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/private/actuator/metrics || /private/actuator/metrics.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
But we found:
2018-12-05 15:27:10.713 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/private/billing],methods=[GET]}" onto public wtn.integration.webmodel.billing.response.BillingResponse
wtn.integration.controller.BillingController.process()
2018-12-05 15:27:10.715 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/private/events/discard/{reportId}],methods=[GET]}" onto public void wtn.integration.controller.EventController.discard(java.lang.Long)
2018-12-05 15:27:10.715 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/private/events/recover/{reportId}],methods=[POST]}" onto public void wtn.integration.controller.EventController.recover(java.lang.Long,wtn.integration.api.event.bean.Event)
2018-12-05 15:27:10.715 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/private/events/recover/{reportId}],methods=[GET]}" onto public void wtn.integration.controller.EventController.recover(java.lang.Long)
2018-12-05 15:27:10.715 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/private/events],methods=[POST]}" onto public void wtn.integration.controller.EventController.process(wtn.integration.api.event.request.EventRequest)
2018-12-05 15:27:10.718 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-12-05 15:27:10.718 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-12-05 15:27:10.817 [restartedMain] INFO o.s.w.s.m.m.a.RequestMappingHandlerAdapter - Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#6aedc770: startup date [Wed Dec 05 15:27:04 CET 2018]; root of context hierarchy
2018-12-05 15:27:12.156 [restartedMain] INFO o.s.j.e.a.AnnotationMBeanExporter - Registering beans for JMX exposure on startup
2018-12-05 15:27:12.158 [restartedMain] INFO o.s.j.e.a.AnnotationMBeanExporter - Bean with name 'getDataSource' has been autodetected for JMX exposure
2018-12-05 15:27:12.165 [restartedMain] INFO o.s.j.e.a.AnnotationMBeanExporter - Bean with name 'connectionFactory' has been autodetected for JMX exposure
Any idea?
Thanks in advance!
Try setting its exposure:
management:
server:
servlet:
context-path: /manage
endpoints:
web:
exposure:
include: '*'

Spring Cloud Vault - Missing required header: X-Config-Token

I was following the getting started guides for spring config server and vault when I run into a issue related to vault I am unable to resolve. The config server is however working fine with GIT but not with Vault. Below is the code and config I am using -
Here is the configserver code -
#EnableConfigServer
#SpringBootApplication
public class SpringConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(SpringConfigServerApplication.class, args);
}
}
And the corresponding application.yml -
spring:
application:
name: configserver
cloud:
config:
server:
vault:
port: 8200
host: 127.0.0.1
git:
uri: https://github.com/weekly-drafts/config-repo-spring-cloud-configserver-vault
profiles:
active: default, native, git, vault
server:
port: 8888
configserver pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.rockingengineering</groupId>
<artifactId>spring-config-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>spring-config-server</name>
<description>Spring Config Server Application</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<relativePath />
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.SR1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Here is my configclient code
#SpringBootApplication
public class VaultApplication {
public static void main(String[] args) {
SpringApplication.run(VaultApplication.class, args);
}
}
and property loading controller. This code is loading properties from GIT but not vault.
#RefreshScope
#RestController
public class VaultController {
#Value("${client.pseudo.property}")
private String pseudoProperty;
#Value("${client.pseudo.property.vault}")
private String proeprtyFromVault;
#GetMapping("/property")
public ResponseEntity<String> getProperty() {
return ResponseEntity.ok(pseudoProperty);
}
#GetMapping("/property/vault")
public ResponseEntity<String> getPropertyFromVault() {
return ResponseEntity.ok(proeprtyFromVault);
}
}
Configclient bootstrap.yml -
spring:
application:
name: configclient
cloud:
vault:
token: f474964a-89bf-39e6-2e37-3d7de918f762
uri: http://localhost:8888
config:
token: f474964a-89bf-39e6-2e37-3d7de918f762
uri: http://localhost:8888
headers:
X-Vault-Token: f474964a-89bf-39e6-2e37-3d7de918f762
server:
port: 8080
ConfigClient pom.xml -
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.rockingengineering</groupId>
<artifactId>spring-cloud-vault</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>spring-cloud-vault</name>
<description>Spring Cloud Vault Application</description>
<inceptionYear>2018</inceptionYear>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<relativePath />
</parent>
<properties>
<spring-cloud-vault-dependencies.version>1.0.2.RELEASE</spring-cloud-vault-dependencies.version>
<log4j.version>1.2.17</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-cloud.version>Finchley.SR1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-vault-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0-alpha-1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<finalName>spring-cloud-vault</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Response from Vault -
vault kv get -format=json secret/configclient
{
"request_id": "1a8dba22-d120-f7b9-13a2-8f2107786c29",
"lease_id": "",
"lease_duration": 0,
"renewable": false,
"data": {
"data": {
"client.pseudo.property.vault": "Property value loaded from Vault"
},
"metadata": {
"created_time": "2018-10-11T12:36:24.165749Z",
"deletion_time": "",
"destroyed": false,
"version": 2
}
},
"warnings": null
}
I am able to use vault from CLI using the same token. The error I am getting is -
2018-10-11 18:07:49.946 INFO 97999 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#3fc2959f: startup date [Thu Oct 11 18:07:49 IST 2018]; root of context hierarchy
2018-10-11 18:07:50.389 INFO 97999 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$c21aa722] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-10-11 18:07:50.913 INFO 97999 --- [ main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.5.RELEASE)
2018-10-11 18:07:53.579 WARN 97999 --- [ main] o.s.v.a.LifecycleAwareSessionManager : Cannot enhance VaultToken to a LoginToken: Token self-lookup failed: 500 {"timestamp":"2018-10-11T12:37:53.557+0000","status":500,"error":"Internal Server Error","message":"No such label: token","path":"/v1/auth/token/lookup-self"}
2018-10-11 18:07:53.603 WARN 97999 --- [ main] LeaseEventPublisher$LoggingErrorListener : [RequestedSecret [path='secret/configclient', mode=ROTATE]] Lease [leaseId='null', leaseDuration=PT0S, renewable=false] Status 400 secret/configclient: {"timestamp":"2018-10-11T12:37:53.594+0000","status":400,"error":"Bad Request","message":"Missing required header: X-Config-Token","path":"/v1/secret/configclient"}
2018-10-11 18:07:53.632 WARN 97999 --- [ main] LeaseEventPublisher$LoggingErrorListener : [RequestedSecret [path='secret/application', mode=ROTATE]] Lease [leaseId='null', leaseDuration=PT0S, renewable=false] Status 400 secret/application: {"timestamp":"2018-10-11T12:37:53.630+0000","status":400,"error":"Bad Request","message":"Missing required header: X-Config-Token","path":"/v1/secret/application"}
org.springframework.vault.VaultException: Status 400 secret/application: {"timestamp":"2018-10-11T12:37:53.630+0000","status":400,"error":"Bad Request","message":"Missing required header: X-Config-Token","path":"/v1/secret/application"}
at org.springframework.vault.client.VaultResponses.buildException(VaultResponses.java:89) ~[spring-vault-core-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.vault.client.VaultResponses.buildException(VaultResponses.java:81) ~[spring-vault-core-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.vault.core.VaultTemplate.lambda$doRead$1(VaultTemplate.java:328) ~[spring-vault-core-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.vault.core.VaultTemplate.doWithSession(VaultTemplate.java:307) ~[spring-vault-core-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.vault.core.VaultTemplate.doRead(VaultTemplate.java:317) ~[spring-vault-core-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.vault.core.VaultTemplate.read(VaultTemplate.java:212) ~[spring-vault-core-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.vault.core.lease.SecretLeaseContainer.doGetSecrets(SecretLeaseContainer.java:545) [spring-vault-core-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.vault.core.lease.SecretLeaseContainer.start(SecretLeaseContainer.java:357) [spring-vault-core-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.vault.core.lease.SecretLeaseContainer.addRequestedSecret(SecretLeaseContainer.java:316) [spring-vault-core-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.vault.core.env.LeaseAwareVaultPropertySource.loadProperties(LeaseAwareVaultPropertySource.java:147) [spring-vault-core-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.vault.core.env.LeaseAwareVaultPropertySource.<init>(LeaseAwareVaultPropertySource.java:133) [spring-vault-core-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.cloud.vault.config.LeasingVaultPropertySourceLocator.createVaultPropertySource(LeasingVaultPropertySourceLocator.java:151) [spring-cloud-vault-config-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.cloud.vault.config.LeasingVaultPropertySourceLocator.createVaultPropertySource(LeasingVaultPropertySourceLocator.java:88) [spring-cloud-vault-config-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.cloud.vault.config.VaultPropertySourceLocatorSupport.doCreatePropertySources(VaultPropertySourceLocatorSupport.java:170) [spring-cloud-vault-config-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.cloud.vault.config.VaultPropertySourceLocatorSupport.createCompositePropertySource(VaultPropertySourceLocatorSupport.java:145) [spring-cloud-vault-config-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.cloud.vault.config.VaultPropertySourceLocatorSupport.locate(VaultPropertySourceLocatorSupport.java:116) [spring-cloud-vault-config-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:94) [spring-cloud-context-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:654) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:390) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:331) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at com.rockingengineering.vault.VaultApplication.main(VaultApplication.java:10) [classes/:na]
2018-10-11 18:07:53.633 INFO 97999 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='vault', propertySources=[LeaseAwareVaultPropertySource {name='secret/configclient'}, LeaseAwareVaultPropertySource {name='secret/application'}]}
2018-10-11 18:07:53.639 INFO 97999 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
2018-10-11 18:07:56.496 INFO 97999 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=configclient, profiles=[default], label=null, version=null, state=null
2018-10-11 18:07:56.496 INFO 97999 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='configService', propertySources=[MapPropertySource {name='https://github.com/weekly-drafts/config-repo-spring-cloud-configserver-vault/configclient.yml'}]}
2018-10-11 18:07:56.502 INFO 97999 --- [ main] c.r.vault.VaultApplication : No active profile set, falling back to default profiles: default
2018-10-11 18:07:56.516 INFO 97999 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#60a2630a: startup date [Thu Oct 11 18:07:56 IST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#3fc2959f
2018-10-11 18:07:57.909 INFO 97999 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=e9255d82-de63-3800-b389-53a2229e780a
2018-10-11 18:07:58.032 INFO 97999 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$c21aa722] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-10-11 18:07:58.564 INFO 97999 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2018-10-11 18:07:58.589 INFO 97999 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-10-11 18:07:58.589 INFO 97999 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.34
2018-10-11 18:07:58.593 INFO 97999 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/naveen/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2018-10-11 18:07:58.706 INFO 97999 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-10-11 18:07:58.706 INFO 97999 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2190 ms
2018-10-11 18:07:59.377 INFO 97999 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-10-11 18:07:59.965 INFO 97999 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/property],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> com.rockingengineering.vault.controller.VaultController.getProperty()
2018-10-11 18:07:59.966 INFO 97999 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/property/vault],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> com.rockingengineering.vault.controller.VaultController.getPropertyFromVault()
2018-10-11 18:07:59.969 INFO 97999 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/v2/api-docs],methods=[GET],produces=[application/json || application/hal+json]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)
2018-10-11 18:08:00.101 INFO 97999 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2018-10-11 18:08:00.116 INFO 97999 --- [ main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2018-10-11 18:08:00.117 INFO 97999 --- [ main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2018-10-11 18:08:00.118 INFO 97999 --- [ main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto protected java.util.Map<java.lang.String, java.util.Map<java.lang.String, org.springframework.boot.actuate.endpoint.web.Link>> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-10-11 18:08:00.266 INFO 97999 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-10-11 18:08:00.397 INFO 97999 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#60a2630a: startup date [Thu Oct 11 18:07:56 IST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#3fc2959f
2018-10-11 18:08:00.443 INFO 97999 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-10-11 18:08:00.443 INFO 97999 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-10-11 18:08:00.798 INFO 97999 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-10-11 18:08:00.811 INFO 97999 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'environmentManager' has been autodetected for JMX exposure
2018-10-11 18:08:00.812 INFO 97999 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'refreshScope' has been autodetected for JMX exposure
2018-10-11 18:08:00.815 INFO 97999 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
2018-10-11 18:08:00.821 INFO 97999 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'environmentManager': registering with JMX server as MBean [org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager]
2018-10-11 18:08:00.831 INFO 97999 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'refreshScope': registering with JMX server as MBean [org.springframework.cloud.context.scope.refresh:name=refreshScope,type=RefreshScope]
2018-10-11 18:08:00.842 INFO 97999 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,context=60a2630a,type=ConfigurationPropertiesRebinder]
2018-10-11 18:08:00.985 INFO 97999 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2018-10-11 18:08:00.986 INFO 97999 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2018-10-11 18:08:01.004 INFO 97999 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
2018-10-11 18:08:01.016 INFO 97999 --- [ main] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
2018-10-11 18:08:01.099 WARN 97999 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.vaultController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'client.pseudo.property.vault' in value "${client.pseudo.property.vault}"
2018-10-11 18:08:01.101 INFO 97999 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2018-10-11 18:08:01.102 INFO 97999 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans
2018-10-11 18:08:01.107 INFO 97999 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2018-10-11 18:08:01.131 INFO 97999 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-10-11 18:08:01.138 ERROR 97999 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.vaultController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'client.pseudo.property.vault' in value "${client.pseudo.property.vault}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:378) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1341) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:572) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:353) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:390) ~[spring-cloud-context-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at com.rockingengineering.vault.VaultApplication.main(VaultApplication.java:10) [classes/:na]
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'client.pseudo.property.vault' in value "${client.pseudo.property.vault}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:172) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:237) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:211) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
... 33 common frames omitted
2018-10-11 18:08:01.139 INFO 97999 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#3fc2959f: startup date [Thu Oct 11 18:07:49 IST 2018]; root of context hierarchy
2018-10-11 18:08:01.141 INFO 97999 --- [ Thread-2] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService
Can anyone tell what I am missing here?
You don't need to use spring-cloud-starter-vault-config for your config-client in this particular case. Basically your client doesn't know anything about Vault. You just need to pass token (spring.cloud.config.token) and config-server will take care of getting properties from Vault using this token. spring-cloud-starter-vault-config is used in case when you want to get data directly from Vault (not through config-server). Your configuration (bootstrap.yml) should look like this:
spring:
application:
name: configclient
cloud:
config:
token: your_vault_token
uri: http://localhost:8888
In config-server you need to support composite configuration from git and Vault. So you need to put 2 profiles: git and vault.
The tricky moment is that Vault has now 2 versions for KV Secrets Engine (https://www.vaultproject.io/api/secret/kv/index.html) so make sure that you use same version in vault and config-server. Because based on documentation kv version 2 is enabled by default in dev mode:
Additionally, when running a dev-mode server, the v2 kv secrets engine is enabled by default at the path secret/ (for non-dev servers, it is currently v1). It can be disabled, moved, or enabled multiple times at different paths. Each instance of the KV secrets engine is isolated and unique.
See: https://www.vaultproject.io/docs/secrets/kv/kv-v2.html
Spring Cloud Config has support of both versions of Vault KV storage:
Vault 0.10.0 introduced a versioned key-value backend (k/v backend version 2) that exposes a different API than earlier versions, it now requires a data/ between the mount path and the actual context path and wraps secrets in a data object. Setting kvVersion=2 will take this into account.
More: http://cloud.spring.io/spring-cloud-static/spring-cloud-config/2.0.1.RELEASE/single/spring-cloud-config.html#vault-backend
So based on all of this information, you configserver application.yml should look like this:
server:
port: 8888
spring:
application:
name: configserver
profiles:
active: git, vault
cloud:
config:
server:
vault:
port: 8200
host: 127.0.0.1
kvVersion: 2 #may be 1 depends on Vault configuration
git:
uri: https://github.com/weekly-drafts/config-repo-spring-cloud-configserver-vault
The right configuration is spring.cloud.config.token, you have the right config in the wrong file. Try adding it in application.yml instead, basically everything that comes before the Spring Boot Logo is configured through bootstrap.yml after the logo, Spring unloads bootstrap.yml and loads application.yml and then it tries to get the configuration from Spring Config Server.
What I usually do is to add is as an environment variable (SPRING_CLOUD_CONFIG_TOKEN), so no matter when it tries to reach the config, the value will be there.

Spring Boot controller returns 404 for all api endpoints

I am new to Spring's ecosystem. And I am stuck with this particular situation. My application server responds with 404 for all of my API endpoints.
This is my controller
package com.example.controllers;
import com.example.models.Movie;
import com.example.services.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Optional;
#RestController
public class MovieController {
#Autowired
private MovieService movieService;
#RequestMapping(value = "/movies", method = RequestMethod.GET)
#ResponseBody
public List<Movie> getAllMovies(){
return movieService.getAllMovies();
}
#RequestMapping(value = "/movies", method = RequestMethod.POST)
#ResponseBody
public Movie addNewMovie(#RequestBody Movie movie){
System.out.println("Hello World");
return movieService.addMovie(movie);
}
#RequestMapping(value = "/movies/{id}", method = RequestMethod.GET)
#ResponseBody
public Optional<Movie> getMovieById(#PathVariable String id){
return movieService.getMovieById(id);
}
#RequestMapping(value = "/movies", method = RequestMethod.PUT)
#ResponseBody
public Movie updateMovie(#RequestBody Movie movie){
return movieService.updateMovie(movie);
}
#RequestMapping(value = "/movies/{id}", method = RequestMethod.DELETE)
public void removeMovieById(#PathVariable String id){
movieService.deleteMovie(id);
}
}
And this my main class
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
#EnableAutoConfiguration
#ComponentScan
#SpringBootApplication
public class LearnSpringApplication{
public static void main(String[] args) {
SpringApplication.run(LearnSpringApplication.class, args);
}
}
I am running it on localhost and port is 8080. I did set up a small app prior to this one, and that worked as expected. However, I am guessing that it's because the controller is in a different package since in the previous app, the main class and the controller were in the same package.
Edit Here's my pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>learn_spring</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>learn_spring</name>
<description>Project to learn Spring</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>10</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
EDIT My Spring-Boot startup logs are
2018-05-03 17:16:44.937 INFO 14017 --- [ main] com.example.LearnSpringApplication : Starting LearnSpringApplication v0.0.1 on tfc with PID 14017 (/home/ayush/Workspace/learn_spring/target/learn_spring-0.0.1.jar started by ayush in /home/ayush/Workspace/learn_spring)
2018-05-03 17:16:44.940 INFO 14017 --- [ main] com.example.LearnSpringApplication : No active profile set, falling back to default profiles: default
2018-05-03 17:16:45.045 INFO 14017 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#6aba2b86: startup date [Thu May 03 17:16:45 IST 2018]; root of context hierarchy
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (jar:file:/home/ayush/Workspace/learn_spring/target/learn_spring-0.0.1.jar!/BOOT-INF/lib/spring-core-5.0.5.RELEASE.jar!/) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2018-05-03 17:16:46.113 INFO 14017 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2018-05-03 17:16:46.138 INFO 14017 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-05-03 17:16:46.139 INFO 14017 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.29
2018-05-03 17:16:46.151 INFO 14017 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
2018-05-03 17:16:46.218 INFO 14017 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-05-03 17:16:46.218 INFO 14017 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1186 ms
2018-05-03 17:16:46.336 INFO 14017 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-05-03 17:16:46.339 INFO 14017 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-05-03 17:16:46.340 INFO 14017 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-05-03 17:16:46.340 INFO 14017 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-05-03 17:16:46.340 INFO 14017 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-05-03 17:16:46.455 INFO 14017 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-05-03 17:16:46.720 INFO 14017 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#6aba2b86: startup date [Thu May 03 17:16:45 IST 2018]; root of context hierarchy
2018-05-03 17:16:46.786 INFO 14017 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-05-03 17:16:46.787 INFO 14017 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-05-03 17:16:46.817 INFO 14017 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-05-03 17:16:46.817 INFO 14017 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-05-03 17:16:47.060 INFO 14017 --- [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2018-05-03 17:16:47.151 INFO 14017 --- [localhost:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:12}] to localhost:27017
2018-05-03 17:16:47.155 INFO 14017 --- [localhost:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 6, 3]}, minWireVersion=0, maxWireVersion=6, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=null, roundTripTimeNanos=2192957}
2018-05-03 17:16:47.323 INFO 14017 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-05-03 17:16:47.392 INFO 14017 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2018-05-03 17:16:47.395 INFO 14017 --- [ main] com.example.LearnSpringApplication : Started LearnSpringApplication in 2.89 seconds (JVM running for 3.296)
Sometimes is because of your package structure. Always make sure your controllers are in same package or sub-package level as the #SpringBootApplication class.
For example:
If application class is at com.a.b then controllers should be at com.a.b or com.a.b.c or com.a.b.c.d etc. You don't always have to add #ComponentScan to get them registered.
You're using IntelliJ IDEA community version, which does not support the Spring Framework:
see https://www.jetbrains.com/idea/features/editions_comparison_matrix.html for reference
Update
Since you're using the command line, then the above does not apply. I'll leave it here as a reference, though.
In the comments, you have specified that when running mvn clean package followed by java -jar target/whatever-your-project-name-is.jar, you get the following error:
Field movieService in com.example.controllers.MovieController required a bean of type 'com.example.services.MovieService' that could not be found.
Please make sure that:
you have a class MovieService in the package services
that class is annotated with the #Service annotation
Update 2
Since the above did not work, try replacing
#ComponentScan
by
#ComponentScan({"com.example.services", "com.example.controllers"})
in your LearnSpringApplication class.
Include all other packages that have classes annotated with #Component, #Service, #Controller, #RestController, or #Repository.
Note that this is a workaround. Normally, having #ComponentScan alone should be sufficient -- or as #DarrenForsythe mentionned in the comment, even just #SpringBootApplication should be sufficient for your case.
I had the same problem today and tried the simple solution provided above by #Daniel Moshi. It worked fine. Thanks.
Other option is using like below:
#SpringBootApplication(scanBasePackages = "com.example")
...with this the Controller can stay in any sub-package of com.example and works good even without explicit usage of #ComponentScan.

Soap spring boot wsdl generated app fails with 404 no message available

What I am using:
netbeans 8.2
spring boot
Maven 4.0
tomcat 8.5
Here is the POM file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo-sem-ds</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>demoSemDs</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>tissSolicitacaoProcedimentoV3_03_02.wsdl</wsdlFile>
</wsdlFiles>
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
<staleFile>${project.build.directory}/jaxws/stale/tissSolicitacaoProcedimentoV3_03_02.stale</staleFile>
</configuration>
<id>wsimport-generate-tissSolicitacaoProcedimentoV3_03_02</id>
<phase>generate-sources</phase>
</execution>
<!--<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>tissSolicitacaoProcedimentoV3_03_02.wsdl</wsdlFile>
</wsdlFiles>
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
<staleFile>${project.build.directory}/jaxws/stale/tissSolicitacaoProcedimentoV3_03_02_1.stale</staleFile>
</configuration>
<id>wsimport-generate-tissSolicitacaoProcedimentoV3_03_02_1</id>
<phase>generate-sources</phase>
</execution>-->
</executions>
<dependencies>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-api</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
<configuration>
<sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
<xnocompile>true</xnocompile>
<verbose>true</verbose>
<extension>true</extension>
<catalog>${basedir}/src/jax-ws-catalog.xml</catalog>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<!--<version>2.0.2</version>-->
<configuration>
<webResources>
<resource>
<directory>src</directory>
<targetPath>WEB-INF</targetPath>
<includes>
<include>jax-ws-catalog.xml</include>
<include>wsdl/**</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
Here are my generated classes for the webservice:
Application:
package com.example.demosemds;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class DemoSemDsApplication {
public static void main(String[] args) {
SpringApplication.run(DemoSemDsApplication.class, args);
}
}
Servlet:
package com.example.demosemds;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(DemoSemDsApplication.class);
}
}
WebService Operation:
package com.example.demosemds;
import br.gov.ans.padroes.tiss.schemas.StTissFault;
import br.gov.ans.padroes.tiss.schemas.TissFaultWS;
import br.gov.ans.tiss.ws.tipos.tisssolicitacaoprocedimento.v30302.TissFault;
import javax.jws.WebService;
/**
*
* #author chris
*/
#WebService(serviceName = "tissSolicitacaoProcedimento", portName = "tissSolicitacaoProcedimento_Port", endpointInterface = "br.gov.ans.tiss.ws.tipos.tisssolicitacaoprocedimento.v30302.TissSolicitacaoProcedimentoPortType", targetNamespace = "http://www.ans.gov.br/tiss/ws/tipos/tisssolicitacaoprocedimento/v30302", wsdlLocation = "WEB-INF/wsdl/tissSolicitacaoProcedimentoV3_03_02.wsdl")
public class DemoSemDsWSFromWSDL {
public br.gov.ans.padroes.tiss.schemas.AutorizacaoProcedimentoWS tissSolicitacaoProcedimentoOperation(br.gov.ans.padroes.tiss.schemas.SolicitacaoProcedimentoWS solicitacaoProcedimento) throws TissFault {
//TODO implement this method
//throw new UnsupportedOperationException("Not implemented yet.");
TissFaultWS tissFaultWS = new TissFaultWS();
tissFaultWS.setTissFault(StTissFault.HASH_INVALIDO);
throw new TissFault("Something at last!", tissFaultWS);
}
}
When I run this it deploys to the tomcat server on port 8090. But when I call it on localhost:8090/demo-sem-ds I just get the Whitelabel Error Page: There was an unexpected error (type=Not Found, status=404). No message available.
I don't know if it's related, but I also get an INFO message in the tomcat log when running the application saying: org.apache.catalina.core.ApplicationContext.log 2 Spring WebApplicationInitializers detected on classpath.
I have searched the internet, mainly StackOverflow, to try and find a definitive answer, but so far I haven't had any luck.
I would be most grateful if anyone can help me. Please let me know if there is anything extra I can add to the question.
Thanks,
Update 1:
Sorry about replying like this. I ran out of characters in the question.
I saw in this link that #markwatsonatx suggested that Mapped "{[/demo-sem-ds]}" should be somewhere in the log. However, I can't find it in my tomcat output.
Here's the tomcat output just when running the project:
10-Jan-2018 17:02:30.431 INFORMAÇÕES [http-nio-8090-exec-35] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor [C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\Catalina\localhost\demo-sem-ds.xml]
10-Jan-2018 17:02:44.330 INFORMAÇÕES [http-nio-8090-exec-35] com.sun.xml.ws.transport.http.servlet.WSServletDelegate.<init> WSSERVLET14: Inicializando servlet de JAX-WS
17:02:45.307 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'servletConfigInitParams' with lowest search precedence
17:02:45.323 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'servletContextInitParams' with lowest search precedence
17:02:45.347 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'jndiProperties' with lowest search precedence
17:02:45.347 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'systemProperties' with lowest search precedence
17:02:45.347 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'systemEnvironment' with lowest search precedence
17:02:45.347 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Initialized StandardServletEnvironment with PropertySources [StubPropertySource#927279822 {name='servletConfigInitParams', properties=java.lang.Object#69dde978}, StubPropertySource#166873606 {name='servletContextInitParams', properties=java.lang.Object#1b7de455}, JndiPropertySource#99663534 {name='jndiProperties', properties=org.springframework.jndi.JndiLocatorDelegate#3e00141}, MapPropertySource#408537409 {name='systemProperties', properties={java.vendor=Oracle Corporation, sun.java.launcher=SUN_STANDARD, catalina.base=C:\Program Files\Apache Software Foundation\Tomcat 8.5, sun.management.compiler=HotSpot 64-Bit Tiered Compilers, catalina.useNaming=true, os.name=Windows 10, sun.boot.class.path=C:\Program Files\Java\jdk1.8.0_131\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_131\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_131\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_131\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_131\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_131\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_131\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_131\jre\classes, java.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\logging.properties, sun.desktop=windows, java.vm.specification.vendor=Oracle Corporation, java.runtime.version=1.8.0_131-b11, user.name=chris, tomcat.util.scan.StandardJarScanFilter.jarsToScan=log4j-web*.jar,log4j-taglib*.jar,log4javascript*.jar,slf4j-taglib*.jar, shared.loader=, tomcat.util.buf.StringCache.byte.enabled=true, user.language=pt, java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, sun.boot.library.path=C:\Program Files\Java\jdk1.8.0_131\jre\bin, PID=14652, jdk.tls.ephemeralDHKeySize=2048, java.version=1.8.0_131, java.util.logging.manager=org.apache.juli.ClassLoaderLogManager, user.timezone=America/Sao_Paulo, sun.arch.data.model=64, java.util.concurrent.ForkJoinPool.common.threadFactory=org.apache.catalina.startup.SafeForkJoinWorkerThreadFactory, java.endorsed.dirs=C:\Program Files\Java\jdk1.8.0_131\jre\lib\endorsed, sun.cpu.isalist=amd64, sun.jnu.encoding=Cp1252, file.encoding.pkg=sun.io, package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,org.apache.tomcat., file.separator=\, java.specification.name=Java Platform API Specification, java.class.version=52.0, user.country=BR, java.home=C:\Program Files\Java\jdk1.8.0_131\jre, java.vm.info=mixed mode, os.version=10.0, path.separator=;, java.vm.version=25.131-b11, org.jboss.logging.provider=slf4j, user.variant=, java.protocol.handler.pkgs=org.apache.catalina.webresources, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,org.apache.naming.,org.apache.tomcat., user.script=, java.naming.factory.url.pkgs=org.apache.naming, user.home=C:\Users\chris, java.specification.vendor=Oracle Corporation, tomcat.util.scan.StandardJarScanFilter.jarsToSkip=bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,websocket-api.jar,jaspic-api.jar,catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-storeconfig.jar,catalina-tribes.jar,jasper.jar,jasper-el.jar,ecj-*.jar,tomcat-api.jar,tomcat-util.jar,tomcat-util-scan.jar,tomcat-coyote.jar,tomcat-dbcp.jar,tomcat-jni.jar,tomcat-websocket.jar,tomcat-i18n-en.jar,tomcat-i18n-es.jar,tomcat-i18n-fr.jar,tomcat-i18n-ja.jar,tomcat-juli-adapters.jar,catalina-jmx-remote.jar,catalina-ws.jar,tomcat-jdbc.jar,tools.jar,commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,commons-logging*.jar,commons-math*.jar,commons-pool*.jar,jstl.jar,taglibs-standard-spec-*.jar,geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,jmx-tools.jar,jta*.jar,log4j*.jar,mail*.jar,slf4j*.jar,xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,junit.jar,junit-*.jar,hamcrest-*.jar,easymock-*.jar,cglib-*.jar,objenesis-*.jar,ant-launcher.jar,cobertura-*.jar,asm-*.jar,dom4j-*.jar,icu4j-*.jar,jaxen-*.jar,jdom-*.jar,jetty-*.jar,oro-*.jar,servlet-api-*.jar,tagsoup-*.jar,xmlParserAPIs-*.jar,xom-*.jar, java.library.path=C:\Program Files\Java\jdk1.8.0_131\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Oracle\ora12c_65bits\product\12.1.0\client_1\bin;C:\Oracle\ora12c_32bits\product\12.1.0\client_1\bin;C:\Oracle\ora11g_720\product\11.1.0\client_1;C:\Oracle\ora11g_720\product\11.1.0\client_1\bin;C:\Oracle\ora11g_621\product\11.1.0\client_1;C:\Oracle\ora11g_621\product\11.1.0\client_1\bin;C:\Program Files\Java\jdk1.8.0_131\bin\;C:\Program Files\Java\jdk1.8.0_131\jre\bin;C:\Program Files (x86)\Java\jdk1.8.0_131\bin\;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\bin;C:\Program Files\NetBeans 8.2\java\maven\bin;C:\Program Files\NetBeans 8.2\java\maven\bin;C:\Program Files\Microsoft MPI\Bin\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Hewlett-Packard\SimplePass\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\OpenVPN\bin;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Users\chris\AppData\Local\Microsoft\WindowsApps;;., java.vendor.url=http://java.oracle.com/, spring.beaninfo.ignore=true, java.vm.vendor=Oracle Corporation, common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar", java.runtime.name=Java(TM) SE Runtime Environment, sun.java.command=org.apache.catalina.startup.Bootstrap start, java.class.path=C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin\tomcat-juli.jar, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.8, catalina.home=C:\Program Files\Apache Software Foundation\Tomcat 8.5, sun.cpu.endian=little, sun.os.patch.level=, java.awt.headless=true, java.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 8.5\temp, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, server.loader=, os.arch=amd64, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.ext.dirs=C:\Program Files\Java\jdk1.8.0_131\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext, user.dir=C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin, line.separator=
, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, file.encoding=Cp1252, java.specification.version=1.8}}, SystemEnvironmentPropertySource#1819461971 {name='systemEnvironment', properties={NB_EXEC_TOMCAT_START_PROCESS_UUID=tomcat80:home=C:\Program Files\Apache Software Foundation\Tomcat 8.5, USERDOMAIN_ROAMINGPROFILE=PC-CONSULTORIO, PROCESSOR_LEVEL=6, Platform=HPD, FP_NO_HOST_CHECK=NO, _RUNJAVA="C:\Program Files\Java\jdk1.8.0_131\bin\java.exe", JSSE_OPTS="-Djdk.tls.ephemeralDHKeySize=2048", SESSIONNAME=Console, ALLUSERSPROFILE=C:\ProgramData, JAVA_OPTS= "-Djdk.tls.ephemeralDHKeySize=2048" -Djava.protocol.handler.pkgs=org.apache.catalina.webresources, PROCESSOR_ARCHITECTURE=AMD64, TNS_ADMIN=C:\Chris\Work\TNS, PSModulePath=C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files\WindowsPowerShell\Modules\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\Storage\, SystemDrive=C:, JRE_HOME=C:\Program Files\Java\jdk1.8.0_131, USERNAME=chris, ProgramFiles(x86)=C:\Program Files (x86), FPS_BROWSER_USER_PROFILE_STRING=Default, PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC, ProgramData=C:\ProgramData, ProgramW6432=C:\Program Files, HOMEPATH=\Users\chris, _RUNJDB="C:\Program Files\Java\jdk1.8.0_131\bin\jdb.exe", PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 60 Stepping 3, GenuineIntel, LOGGING_CONFIG=-Djava.util.logging.config.file="C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\logging.properties", ProgramFiles=C:\Program Files, PUBLIC=C:\Users\Public, CURRENT_DIR=C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin, windir=C:\WINDOWS, =::=::\, NB_TOMCAT_JDK=1.8, LOCALAPPDATA=C:\Users\chris\AppData\Local, MSMPI_BIN=C:\Program Files\Microsoft MPI\Bin\, CATALINA_TMPDIR=C:\Program Files\Apache Software Foundation\Tomcat 8.5\temp, USERDOMAIN=PC-CONSULTORIO, FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer, LOGONSERVER=\\PC-CONSULTORIO, JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131, PROMPT=$P$G, FSHARPINSTALLDIR=C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0\, asl.log=Destination=file, CATALINA_BASE=C:\Program Files\Apache Software Foundation\Tomcat 8.5, OneDrive=C:\Users\chris\OneDrive, =C:=C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin, APPDATA=C:\Users\chris\AppData\Roaming, GTK_BASEPATH=C:\Program Files (x86)\GtkSharp\2.12\, _EXECJAVA="C:\Program Files\Java\jdk1.8.0_131\bin\java.exe", VBOX_MSI_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\, CommonProgramFiles=C:\Program Files\Common Files, Path=C:\Oracle\ora12c_65bits\product\12.1.0\client_1\bin;C:\Oracle\ora12c_32bits\product\12.1.0\client_1\bin;C:\Oracle\ora11g_720\product\11.1.0\client_1;C:\Oracle\ora11g_720\product\11.1.0\client_1\bin;C:\Oracle\ora11g_621\product\11.1.0\client_1;C:\Oracle\ora11g_621\product\11.1.0\client_1\bin;C:\Program Files\Java\jdk1.8.0_131\bin\;C:\Program Files\Java\jdk1.8.0_131\jre\bin;C:\Program Files (x86)\Java\jdk1.8.0_131\bin\;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\bin;C:\Program Files\NetBeans 8.2\java\maven\bin;C:\Program Files\NetBeans 8.2\java\maven\bin;C:\Program Files\Microsoft MPI\Bin\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Hewlett-Packard\SimplePass\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\OpenVPN\bin;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Users\chris\AppData\Local\Microsoft\WindowsApps;, OS=Windows_NT, COMPUTERNAME=PC-CONSULTORIO, CATALINA_HOME=C:\Program Files\Apache Software Foundation\Tomcat 8.5, MAINCLASS=org.apache.catalina.startup.Bootstrap, LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager, OnlineServices=Online Services, PROCESSOR_REVISION=3c03, CLASSPATH=C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin\tomcat-juli.jar, CommonProgramW6432=C:\Program Files\Common Files, ComSpec=C:\WINDOWS\system32\cmd.exe, SystemRoot=C:\WINDOWS, TEMP=C:\Users\chris\AppData\Local\Temp, ACTION=start, HOMEDRIVE=C:, USERPROFILE=C:\Users\chris, TMP=C:\Users\chris\AppData\Local\Temp, CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files, NUMBER_OF_PROCESSORS=4}}]
17:02:45.491 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Replacing PropertySource 'servletContextInitParams' with 'servletContextInitParams'
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.9.RELEASE)
2018-01-10 17:02:47.145 INFO 14652 --- [io-8090-exec-35] c.example.demosemds.ServletInitializer : Starting ServletInitializer on PC-Consultorio with PID 14652 (C:\Users\chris\Documents\NetBeansProjects\demoSemDsProject\target\demo-sem-ds-0.0.1-SNAPSHOT\WEB-INF\classes started by chris in C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin)
2018-01-10 17:02:47.148 INFO 14652 --- [io-8090-exec-35] c.example.demosemds.ServletInitializer : No active profile set, falling back to default profiles: default
2018-01-10 17:02:47.378 INFO 14652 --- [io-8090-exec-35] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#186f3e22: startup date [Wed Jan 10 17:02:47 BRST 2018]; root of context hierarchy
2018-01-10 17:02:52.088 INFO 14652 --- [io-8090-exec-35] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$bdca92aa] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-01-10 17:02:52.224 INFO 14652 --- [io-8090-exec-35] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2018-01-10 17:02:52.274 INFO 14652 --- [io-8090-exec-35] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4896 ms
2018-01-10 17:02:54.021 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2018-01-10 17:02:54.022 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'messageDispatcherServlet' to [/services/*]
2018-01-10 17:02:54.022 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'errorPageFilter' to: [/*]
2018-01-10 17:02:54.022 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*]
2018-01-10 17:02:54.022 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-01-10 17:02:54.022 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-01-10 17:02:54.022 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-01-10 17:02:54.023 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-01-10 17:02:54.023 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2018-01-10 17:02:54.023 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*]
2018-01-10 17:02:55.527 INFO 14652 --- [io-8090-exec-35] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#186f3e22: startup date [Wed Jan 10 17:02:47 BRST 2018]; root of context hierarchy
2018-01-10 17:02:55.975 INFO 14652 --- [io-8090-exec-35] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-01-10 17:02:55.979 INFO 14652 --- [io-8090-exec-35] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-01-10 17:02:56.076 INFO 14652 --- [io-8090-exec-35] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-01-10 17:02:56.076 INFO 14652 --- [io-8090-exec-35] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-01-10 17:02:56.257 INFO 14652 --- [io-8090-exec-35] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-01-10 17:02:57.428 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/auditevents || /auditevents.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.boot.actuate.endpoint.mvc.AuditEventsMvcEndpoint.findByPrincipalAndAfterAndType(java.lang.String,java.util.Date,java.lang.String)
2018-01-10 17:02:57.433 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.get(java.lang.String)
2018-01-10 17:02:57.433 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers/{name:.*}],methods=[POST],consumes=[application/vnd.spring-boot.actuator.v1+json || application/json],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.set(java.lang.String,java.util.Map<java.lang.String, java.lang.String>)
2018-01-10 17:02:57.433 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers || /loggers.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.433 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.434 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2018-01-10 17:02:57.434 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.434 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.435 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.436 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2018-01-10 17:02:57.436 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env || /env.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.437 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/info || /info.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.501 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/heapdump || /heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2018-01-10 17:02:57.503 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/health || /health.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,java.security.Principal)
2018-01-10 17:02:57.506 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.509 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.513 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:58.035 INFO 14652 --- [io-8090-exec-35] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-01-10 17:02:58.080 INFO 14652 --- [io-8090-exec-35] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2018-01-10 17:02:58.292 INFO 14652 --- [io-8090-exec-35] c.example.demosemds.ServletInitializer : Started ServletInitializer in 12.74 seconds (JVM running for 2359.263)
10-Jan-2018 17:02:58.328 INFORMAÇÕES [http-nio-8090-exec-35] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor [C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\Catalina\localhost\demo-sem-ds.xml] has finished in [27,898] ms
2018-01-10 17:02:58.304 INFO 14652 --- [io-8090-exec-35] com.sun.xml.ws.server.http : WSSERVLET12: inicialização do listener de contexto de JAX-WS
2018-01-10 17:02:58.305 INFO 14652 --- [io-8090-exec-35] com.sun.xml.ws.server.http : WSSERVLET12: inicialização do listener de contexto de JAX-WS
10-Jan-2018 17:02:58.367 INFORMAÇÕES [http-nio-8090-exec-35] org.apache.catalina.util.LifecycleBase.start The start() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/demo-sem-ds]] after start() had already been called. The second call will be ignored.
2018-01-10 17:02:59.296 INFO 14652 --- [io-8090-exec-38] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2018-01-10 17:02:59.427 INFO 14652 --- [io-8090-exec-38] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 131 ms
...and the application startup output:
Deploying on Apache Tomcat or TomEE
profile mode: false
debug mode: false
force redeploy: true
In-place deployment at C:\Users\chris\Documents\NetBeansProjects\demoSemDsProject\target\demo-sem-ds-0.0.1-SNAPSHOT
Deployment is in progress...
deploy?config=file%3A%2FC%3A%2FUsers%2Fchris%2FAppData%2FLocal%2FTemp%2Fcontext8200228991787487399.xml&path=/demo-sem-ds
OK - Deployed application at context path [/demo-sem-ds]
start?path=/demo-sem-ds
OK - Started application at context path [/demo-sem-ds]
Thanks again.
Update 2:
A colleague showed me how to get the proper response.
When I run the ws project, it was opening http://localhost:8090/demo-sem-ds/, but the url needs to have the name of the webservice on the end. In this case http://localhost:8090/demo-sem-ds/tissSolicitacaoProcedimento. Using this in SoupUI, with an appropriate call message, allows the webservice to reply.

Zipkin not showing trace logs

Hi Hoping somebody can help am trying to get a very basic implementation of zipkin working to get to grips with distributed tracing. I am using the spring boot to do this but cannot seem to get it to work. Nothing appears in the zipkin UI when I try to find traces for a my service.
I have got 2 deployments as follows:
My spring boot app which I am wanting to log:
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>zipkinClient</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>zipkinClient</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<!-- If i only put this dependency in then my app does not start -->
<!-- dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
With these dependencies I do get a connect error because of the rabbit mq dependency. I had to include this becuase I got a META-INF/spring binders error. Wasnt really sure how to get around this other than putting the dependency in.
My application.class
package com.example.demo;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.sleuth.sampler.AlwaysSampler;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
#SpringBootApplication
#RestController
public class ZipkinApplication {
private static final Logger LOG = Logger.getLogger(ZipkinApplication.class.getName());
#Autowired
private RestTemplate restTemplate;
public static void main(String[] args) {
SpringApplication.run(ZipkinApplication.class, args);
}
#Bean
public RestTemplate getRestTemplate() {
return new RestTemplate();
}
#Bean
public AlwaysSampler defaultSampler() {
return new AlwaysSampler();
}
#RequestMapping("/zipkin")
public String home() {
LOG.log(Level.INFO, "you called home");
return "Hello World";
}
#RequestMapping("/callhome")
public String callHome() {
LOG.log(Level.INFO, "calling home");
return restTemplate.getForObject("http://localhost:8080/zipkin", String.class);
}
}
When I run this aplication and call my endpoint I can see through the logging that it should be sending it to zipkin.
2017-05-17 15:20:09.425 INFO [zipkin demo,13ad9334863d28cf,13ad9334863d28cf,true] 23980 --- [nio-8080-exec-1] com.example.demo.ZipkinApplication : calling home
2017-05-17 15:20:09.550 INFO [zipkin demo,13ad9334863d28cf,a637530dc2dc2852,true] 23980 --- [nio-8080-exec-5] com.example.demo.ZipkinApplication : you called home
This are my full logs. Again I get the rabbitmq exception but not sure why i actually need this. Can zipkin not work without it
My full logs:
2017-05-17 15:19:45.162 INFO [zipkin demo,,,] 23980 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'rabbitConnectionFactory': registering with JMX server as MBean [org.springframework.amqp.rabbit.connection:name=rabbitConnectionFactory,type=CachingConnectionFactory]
2017-05-17 15:19:45.172 INFO [zipkin demo,,,] 23980 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'refreshEndpoint': registering with JMX server as MBean [org.springframework.cloud.endpoint:name=refreshEndpoint,type=RefreshEndpoint]
2017-05-17 15:19:45.183 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering beans for JMX exposure on startup
2017-05-17 15:19:45.184 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel errorChannel
2017-05-17 15:19:45.189 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=errorChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=errorChannel]
2017-05-17 15:19:45.283 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel nullChannel
2017-05-17 15:19:45.285 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=nullChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=nullChannel]
2017-05-17 15:19:45.303 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel sleuth
2017-05-17 15:19:45.305 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=sleuth': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=sleuth]
2017-05-17 15:19:45.336 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageHandler errorLogger
2017-05-17 15:19:45.338 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageHandler,name=errorLogger,bean=internal': registering with JMX server as MBean [org.springframework.integration:type=MessageHandler,name=errorLogger,bean=internal]
2017-05-17 15:19:45.373 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageSource sleuthStreamSpanReporter.poll.inboundChannelAdapter
2017-05-17 15:19:45.375 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageSource,name=sleuthStreamSpanReporter.poll.inboundChannelAdapter,bean=endpoint': registering with JMX server as MBean [org.springframework.integration:type=MessageSource,name=sleuthStreamSpanReporter.poll.inboundChannelAdapter,bean=endpoint]
2017-05-17 15:19:45.698 INFO [zipkin demo,,,] 23980 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase -2147482648
2017-05-17 15:19:46.060 INFO [zipkin demo,,,] 23980 --- [ main] com.example.demo.ZipkinApplication : No active profile set, falling back to default profiles: default
2017-05-17 15:19:46.068 INFO [zipkin demo,,,] 23980 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#28941a68: startup date [Wed May 17 15:19:46 BST 2017]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2dcd168a
2017-05-17 15:19:46.248 INFO [zipkin demo,,,] 23980 --- [ main] o.s.c.support.GenericApplicationContext : Refreshing org.springframework.context.support.GenericApplicationContext#5f1db390: startup date [Wed May 17 15:19:46 BST 2017]; root of context hierarchy
2017-05-17 15:19:46.351 INFO [zipkin demo,,,] 23980 --- [ main] com.example.demo.ZipkinApplication : Started ZipkinApplication in 0.575 seconds (JVM running for 27.035)
2017-05-17 15:19:48.498 WARN [zipkin demo,,,] 23980 --- [ main] o.s.amqp.rabbit.core.RabbitAdmin : Failed to declare exchange: Exchange [name=sleuth, type=topic, durable=true, autoDelete=false, internal=false, arguments={}], continuing... org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
2017-05-17 15:19:48.528 INFO [zipkin demo,,,] 23980 --- [ main] o.s.integration.channel.DirectChannel : Channel 'zipkin demo.sleuth' has 1 subscriber(s).
2017-05-17 15:19:48.529 INFO [zipkin demo,,,] 23980 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2017-05-17 15:19:48.610 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.endpoint.EventDrivenConsumer : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2017-05-17 15:19:48.611 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.channel.PublishSubscribeChannel : Channel 'zipkin demo.errorChannel' has 1 subscriber(s).
2017-05-17 15:19:48.611 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.endpoint.EventDrivenConsumer : started _org.springframework.integration.errorLogger
2017-05-17 15:19:48.645 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.e.SourcePollingChannelAdapter : started sleuthStreamSpanReporter.poll.inboundChannelAdapter
2017-05-17 15:19:48.646 INFO [zipkin demo,,,] 23980 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147482647
2017-05-17 15:19:48.646 INFO [zipkin demo,,,] 23980 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2017-05-17 15:19:48.786 INFO [zipkin demo,,,] 23980 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-05-17 15:19:48.793 INFO [zipkin demo,,,] 23980 --- [ main] com.example.demo.ZipkinApplication : Started ZipkinApplication in 28.094 seconds (JVM running for 29.477)
2017-05-17 15:20:09.056 INFO [zipkin demo,,,] 23980 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2017-05-17 15:20:09.057 INFO [zipkin demo,,,] 23980 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2017-05-17 15:20:09.308 INFO [zipkin demo,,,] 23980 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 250 ms
2017-05-17 15:20:09.425 INFO [zipkin demo,13ad9334863d28cf,13ad9334863d28cf,true] 23980 --- [nio-8080-exec-1] com.example.demo.ZipkinApplication : calling home
2017-05-17 15:20:09.550 INFO [zipkin demo,13ad9334863d28cf,a637530dc2dc2852,true] 23980 --- [nio-8080-exec-5] com.example.demo.ZipkinApplication : you called home
2017-05-17 15:20:10.084 INFO [zipkin demo,0058e6e4818c17f1,0058e6e4818c17f1,false] 23980 --- [ask-scheduler-1] o.s.i.codec.kryo.CompositeKryoRegistrar : registering [40, java.io.File] with serializer org.springframework.integration.codec.kryo.FileSerializer
2017-05-17 15:20:12.147 ERROR [zipkin demo,6f315febeb5c2176,6f315febeb5c2176,true] 23980 --- [ask-scheduler-1] o.s.integration.handler.LoggingHandler : org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint#5206a959]; nested exception is org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect, failedMessage=GenericMessage [payload=byte[948], headers={spanTraceId=0058e6e4818c17f1, spanId=0058e6e4818c17f1, messageSent=true, id=eb339ffc-5b54-edea-b348-60ca5eac05a1, spanSampled=0, contentType=application/x-java-object;type=org.springframework.cloud.sleuth.stream.Spans, timestamp=1495030810113}]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:139)
at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder$SendingHandler.handleMessageInternal(AbstractMessageChannelBinder.java:326)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:89)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.handleMessage(SourcePollingChannelAdapter.java:210)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:272)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:58)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:190)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:186)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:353)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:55)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:51)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:344)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:62)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:367)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:565)
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1430)
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1411)
at org.springframework.amqp.rabbit.core.RabbitTemplate.send(RabbitTemplate.java:712)
at org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint.send(AmqpOutboundEndpoint.java:134)
at org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint.handleRequestMessage(AmqpOutboundEndpoint.java:122)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
... 30 more
The 2nd application I deployed is my zipkin client / UI
Pom .xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>zipkinClient</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>zipkinClient</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
My application.class
package com.example.zipkinClient;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class ZipkinClientApplication {
public static void main(String[] args) {
SpringApplication.run(ZipkinClientApplication.class, args);
}
}
application.properties
spring.application.name=zipkin server
server.port=9411
Running the zipkin server it starts up ok but nothing is shown in the trace logs excpet for an error
When I go to the client I do get this error though
2017-05-17 15:27:21.822 INFO [zipkin server,,,] 13888 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 9411 (http)
2017-05-17 15:27:21.829 INFO [zipkin server,,,] 13888 --- [ main] c.e.z.ZipkinClientApplication : Started ZipkinClientApplication in 11.14 seconds (JVM running for 12.111)
2017-05-17 15:27:38.513 INFO [zipkin server,,,] 13888 --- [nio-9411-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2017-05-17 15:27:38.514 INFO [zipkin server,,,] 13888 --- [nio-9411-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2017-05-17 15:27:38.638 INFO [zipkin server,,,] 13888 --- [nio-9411-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 124 ms
2017-05-17 15:27:40.828 WARN [zipkin server,,,] 13888 --- [ender#38e778c9)] z.r.AsyncReporter$BoundedAsyncReporter : Dropped 2 spans due to HttpClientErrorException(404 null)
org.springframework.web.client.HttpClientErrorException: 404 null
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:63) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:700) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:653) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:628) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:590) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.cloud.sleuth.zipkin.RestTemplateSender.post(RestTemplateSender.java:73) ~[spring-cloud-sleuth-zipkin-1.2.0.RELEASE.jar:1.2.0.RELEASE]
at org.springframework.cloud.sleuth.zipkin.RestTemplateSender.sendSpans(RestTemplateSender.java:46) ~[spring-cloud-sleuth-zipkin-1.2.0.RELEASE.jar:1.2.0.RELEASE]
at zipkin.reporter.AsyncReporter$BoundedAsyncReporter.flush(AsyncReporter.java:228) [zipkin-reporter-0.6.12.jar:na]
at zipkin.reporter.AsyncReporter$Builder.lambda$build$0(AsyncReporter.java:153) [zipkin-reporter-0.6.12.jar:na]
at zipkin.reporter.AsyncReporter$Builder$$Lambda$1.run(Unknown Source) [zipkin-reporter-0.6.12.jar:na]
Any help is appreciated here
Thanks in advance
Here you have a very basic example of Sleuth & HTTP communication. https://github.com/openzipkin/sleuth-webmvc-example You can set your dependencies in a similar manner and everything should work fine. In your example you've got Stream but I don't think you're using it so it's better to remove it.
As M.Deinum said remove stream and stream-rabbit dependencies what if you do not need some AMQP server to store the trace message.
or
config the AMQP(rabbitMQ in your code) from application-configuration(both) and add zipkin-stream & stream-rabbit in zipkin-server side, so this time your app(zipkin-client) will not direct connect with zipkin-server
and it will be:
zipkin-client <==> AMQP(rabbitMQ) <==> zipkin-server

Resources