1

I have an application implemented with Jersey Rest & Spring Security and located under tomcat/webapps folder. I am using the tomcat startup command using command prompt and getting this message. Unfortunately, the server started working.

I am using the annotation-based approach to configure beans.

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled = true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter 
{
// My configuratio code
}

web.xml having spring & jersey

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xmlns="http://java.sun.com/xml/ns/javaee" 
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
         id="WebApp_ID" version="3.0">
    <display-name>TestApplication</display-name>
  
    <servlet> 
        <servlet-name>TestApplication</servlet-name> 
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> 
        <init-param>
            <param-name>javax.ws.rs.Application</param-name>
            <param-value>com.MyApplication</param-value>  
        </init-param>
        <load-on-startup>1</load-on-startup> 
        <async-supported>true</async-supported>
    </servlet>
   
    <servlet-mapping> 
        <servlet-name>TestApplication</servlet-name> 
        <url-pattern>/rest/*</url-pattern> 
    </servlet-mapping>
    
    
    <listener>
        <listener-class>com.MyContextListener</listener-class>    
    </listener>
    
      <!-- Configure ContextLoaderListener to use AnnotationConfigWebApplicationContext
       instead of the default XmlWebApplicationContext -->
      <context-param>
          <param-name>contextClass</param-name>
          <param-value>
              org.springframework.web.context.support.AnnotationConfigWebApplicationContext
          </param-value>
      </context-param>
    
      <!-- Configuration locations must consist of one or more comma- or space-delimited
           fully-qualified @Configuration classes. Fully-qualified packages may also be
           specified for component-scanning -->
      <context-param>
          <param-name>contextConfigLocation</param-name>
          <param-value>com.infor.seService.ui.sso.WebSecurityConfig</param-value>
      </context-param>
    
      <!-- Bootstrap the root application context as usual using ContextLoaderListener -->
      <listener>
          <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      </listener>
      <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
      </filter>
      <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
      </filter-mapping>
</web-app>

I am not using any spring boot I am not sure whether I need to fix this error as I am using an Annotation-based approach. Any reference articles are greatly appricated.

Vineel Pellella
  • 332
  • 2
  • 4
  • 20
  • 1
    It's an `INFO` message stating that you don't have any `WebApplicationInitializer`s. _"Unfortunately, the server started working_"-so everything else is properly working? – Piotr P. Karwasz Jun 15 '21 at 09:23
  • 1
    In that article, it is not clearly mentioned that it is not an issue. Thanks for confirmation @PiotrP.Karwasz – Vineel Pellella Jun 15 '21 at 10:50
  • 1
    No, it is not mentioned, but of the hundreds of questions with _"No Spring WebApplicationInitializer"_ in the title is the only one I found that addresses the message directly: if you configure Spring in your `web.xml`, you can safely ignore the message. – Piotr P. Karwasz Jun 15 '21 at 11:09

0 Answers0