WSServletContextListener contextInitialized twice

Today I was trying to upgrade the jaxws-rt in my project. I was using version 2.2.1. I tried to upgrade to version 2.2.10 (latest right now).  And i was deploying my war file to tomcat 7.0.57. After changing the version, on deploy i used to get the contextinitialized message twice in the catalina.out.

Oct 09, 2016 2:46:17 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate
INFO: WSSERVLET14: JAX-WS servlet initializing
Oct 09, 2016 2:46:17 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized
INFO: WSSERVLET12: JAX-WS context listener initializing
Oct 09, 2016 2:46:17 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized
INFO: WSSERVLET12: JAX-WS context listener initializing
Oct 09, 2016 2:46:17 PM org.apache.catalina.startup.HostConfig deployWAR

So  the workaround for this issue is to remove the listener from web.xml. As the registration is already done by com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer. After this change the contextInitialized message was only shown once.

Like this post? Don’t forget to share it!

Leave a Reply

Your email address will not be published. Required fields are marked *