开发者

Servlet init being called for every connection

开发者 https://www.devze.com 2023-02-11 21:56 出处:网络
I\'m using Tomc开发者_开发问答at 7. I\'m writing a servlet but I notice the init is being called for every request the user makes. I\'m creating the servlet with annotations as seen below. I want the

I'm using Tomc开发者_开发问答at 7. I'm writing a servlet but I notice the init is being called for every request the user makes. I'm creating the servlet with annotations as seen below. I want the servlet to init itself once on startup and never again. But with this code its being called for every connection. If I'm missing something really obvious please let me know. Thanks.

@WebServlet(urlPatterns={"/Tesing"}, loadOnStartup=1)
public class Testing extends HttpServlet {

    // ...

}


Found the issue ... it seems the very last call of my init was throwing an exception and as such the servlet was not getting initialized. Upon every remote connection it was trying to reconnect but failing on the same exception.

0

精彩评论

暂无评论...
验证码 换一张
取 消