I am currently migrating my application from WAS 8 to WAS Liberty, and I am stuck with the below problem. In one of my module web.xml file, the servlet load on startup value is -1. And the particular servlet is not getting invoked while running in Liberty. Can anyone help me with this? Please find the below code snippets from my web.xml,<servlet>
<servlet-name>SchedulerServlet</servlet-name>
<display-name>SchedulerServlet</display-name>
<servlet-class>com.metlife.bob.reassignment.scheduler.servlet.SchedulerServlet</servlet-class>
<load-on-startup>-1</load-on-startup>
</servlet>
Asked
Active
Viewed 286 times
0

Reza Mousavi
- 4,420
- 5
- 31
- 48

Venkatesh
- 31
- 1
- 7
-
1What you mean 'not invoked'? -1 defines that servlet can be loaded when container needs it, so I'd assume it will be loaded during 1st request. – Gas Sep 13 '18 at 13:03
1 Answers
1
Any negative value for load-on-startup means to defer loading the servlet until the first request is received, so unless something is invoking the servlet, it's not going to start on its own. You can override this behavior in Liberty with the deferServletLoad attribute in server.xml as described in this IBM KnowledgeCenter topic https://www.ibm.com/support/knowledgecenter/en/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/twlp_servlet_load.html As an aside, I noticed the name of your servlet includes "Scheduler" and you're migrating from traditional WebSphere to Liberty, I'm assuming you are aware that Liberty does not have a direct equivalent for traditional WebSphere scheduler service.

F Rowe
- 2,042
- 1
- 11
- 12
-
We added the below code
to the server.xml, but still the servlet is not getting invoked. We have the application configuration as . Whether we need to provide the application as web application and then only web container will works? – Venkatesh Sep 14 '18 at 14:56 -
Are you making any web request to the servlet? Or are you expecting it to start in the absence of a web request? – F Rowe Sep 17 '18 at 15:40
-
It is a scheduler servlet which needs to be get started during the scheduled time. But it doesn't get started. We changed the load on startup to 0 and then only it started along with the server – Venkatesh Sep 19 '18 at 09:51