Reputation: 91
I am developing a spring-boot application which uses camel and cxf. I also include the spring-boot-starter-actuator. The actuator end points (e.g. /beans, /info, /env) work fine when executing the application as an executable jar or as a war deployed to Tomcat 8. However, when I deploy the same war to JBoss EAP 6 (AS 7) the actuator end points return a http status of 404. I have tried including the following dependencies in my pom.xml as per the documentation without success.
<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-undertow</artifactId>
<scope>provided</scope>
</dependency>
My application class looks like
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.ApplicationContext;
import org.springframework.web.WebApplicationInitializer;
import java.util.Arrays;
@SpringBootApplication
public class EsbApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(EsbApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(EsbApplication.class);
}
}
Any ideas on how I can get the actuator end points working in JBoss EAP
Thanks !
Upvotes: 3
Views: 2134
Reputation: 91
It would appear the JBoss EAP 6 servlet mapping works as /* but not with /
To avoid having to add a web.xml, I had to add the following to my SpringBootServletInitializer class
@Override
public void onStartup(ServletContext container) throws ServletException {
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
ServletRegistration.Dynamic registration = container.addServlet("dispatcher", new DispatcherServlet(context));
registration.setLoadOnStartup(1);
registration.addMapping("/*"); // required JBOSS EAP 6 / AS 7
super.onStartup(container);
}
Upvotes: 3