I would like to add hawt.io as an embedded component to my spring boot 'fat jar' application which has an embedded tomcat server.
How can I do this? How could I deploy the hawt.io war file?
UPDATE: I added the dependencies:
- hawtio-web
- hawtio-core
- hawtio-plugin-mbean
- hawtio-springboot to my pom
When I start the application now and open the url localhost:8080/hatio/index.html I get the login page presented. Since I don't know username and password I the added hawtio.authenticationEnabled=false to my application.properties
But - now I get a warning ' WARN 3420 --- [nio-8080-exec-4] o.s.web.servlet.PageNotFound : Request method 'POST' not supported' followed by a a null pointer exception.
References: http://hawt.io/configuration/index.html
I had exactly the same issue - and here is how I solved the problem.
I found out that spring-boot doesnt support legacy web.xml configuration which is what you get when the
maven-war-plugin
does the overlay of the hawtio-web project on top of your own war. The resulting war contains both your web code as well as the content of the hawtio-web archive.See http://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html
So I started the process of configuring the servlets and filters in spring.
First add the necesary dependencies to pom.xml
Im using these versions:
Add a Configuration class to configure the servlets and filters:
I have tested this with both jetty and tomcat - and it works with both. I have also submitted this as a patch to hawtio, but it is not released as of yet. You could compile hawtio yourself and import the HawtioConfiguration: https://github.com/hawtio/hawtio/blob/master/hawtio-springboot/src/main/java/io/hawt/springboot/HawtioConfiguration.java
I have also updated the hawtio-sample to use the HawtioConfiguration: https://github.com/hawtio/hawtio/tree/master/hawtio-sample-springboot
Now i can access hawtio by visiting http://localhost:8080/hawtio/index.html
Hope this helps.
Good luck.
Here is what I have from following the latest tutorials (I'm guessing Hawtio improved this since this question was asked and answered originally): Using spring-boot-starter-parent 1.3.5.RELEASE, Hawtio version 1.4.64, include the following dependencies:
Here is a sample application class that sets up Hawtio with disabled authentication:
You can find the full code here in a sample application that includes Apache Camel: https://github.com/bowdoincollege/spring-boot-camel-sample