We found when moving from Jetty in development to Tomcat in production that our Swagger documentation stopped working -- no operations would show up in the Swagger docs until after the first call to the servlet providing the operation.
After some work in the debugger we traced the problem to the servlets' init()
method not getting called. I assume that Jetty was treating all servlets as load-on-startup, whereas Tomcat isn't, unless you explicitly tell it to in the web.xml.
Unfortunately, in the web.xml, the only things you can set as load-on-startup are servlets, and there are no actual servlets in our Scalatra web.xml, only listeners and servlet-mappings.
How can we get Scalatra to initialize our various ScalatraServlets
on startup?
Note: We're on Scalatra 2.2.2. It could very well be that moving to 2.3 snapshot or milestone would fix the Swagger problem, but we've done a lot of work to get the 2.2 Swagger integration working and we're too close to going live to rip it all out.