0
votes

I am using embedded tomcat to deploy my application's war file via maven appassembly plug-in. My application is built in Spring that uses WebApplicationInitializer instead of web.xml. The application gets deployed in embedded tomcat however when I add jamon.war (for instrumentation) to tomcat instance, my application's WebApplicationInitializer implementation is called again.

I spent almost 8-9 hours to figure this out but unable to, any help will be greatly appreciated. Code to create Tomcat instance and load the two wars is as mentioned below.

Tomcat tomcat = new Tomcat();
tomcat.setHostname("localhost");
tomcat.setPort(8080);

File appWar = new File("/home/myApp.war");
Context context = tomcat.addWebapp("", appWar.getAbsolutePath()); // This is my Spring app.

File jamonWar = new File("/home/jamon-war-2.4.war");
Context context = tomcat.addWebapp("", jamonWar.getAbsolutePath());

tomcat.start();
1

1 Answers

0
votes

This got resolved, I mistakenly added the jar file (containing WebApplicationInitializer implementation class) in maven assembly plugin pom.xml which then got added under dist/repo directory which is why the class was getting loaded twice.