-1

So I'm using the jersey libary for my servlet and I need to have a background thread to run on the server. I did some research and found this answer: Background Thread for a Tomcat servlet app

But the problem is that this answer uses a ServletContextListener class that comes with a jar servlet-api.jar. This jar isn't apart of the jersey jars (or the ones I downloaded for that matter) so I tried to add the servlet-api.jar to the WEB-INF folder in the project but for some reason it's not letting me reference it at all. I updated the project java build path but still no go. I also don't know if it's recommended to mix library jar files. Any ideas what I can do? Is there a way to do something similar using ServletContextListener but using the jersey jars?

Community
  • 1
  • 1

1 Answers1

-1

The jersey library supports the following annotation:

import javax.servlet.annotation.WebListener;

@WebListener

I added the annotation to the class and doing it in web.xml isn't needed.