1 Reply Latest reply on Jul 29, 2015 5:18 AM by Karthik k

    Running spring-mvc application in JBoss 7.1.1 throws NullPointerExcepiton in FilterChainProxy.getFilters

    Karthik k Newbie

      Hello i am getting the following exception in jboss 7.1.1. The spring web application is developed using spring boot version 1.2.5 release.

       

      18:00:11,982 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/DEMOAPP].[default]] (http--192.168.56.10-8080-2) Servlet.service() for servlet default threw exception: java.lang.NullPointerException

        at org.springframework.security.web.FilterChainProxy.getFilters(FilterChainProxy.java:202) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]

        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:176) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]

        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

        at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]

        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]

        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

        at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:116) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]

        at org.springframework.boot.context.web.ErrorPageFilter.access$000(ErrorPageFilter.java:60) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]

        at org.springframework.boot.context.web.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:91) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]

        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]

        at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:109) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

        at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_80]

       

      application class

       

      @SpringBootApplication

      public class Application extends SpringBootServletInitializer {

       

         /**
        * Main Method to the Application
        *
        * @param args - command line arguments
        */
         public static void main(String[] args) {

        SpringApplication.run(Application.class, args);
         }

       

         /**
        *
        * @param applicationBuilder - application builder class
        * @return - returns application builder class
        */
         @Override
         protected SpringApplicationBuilder configure(SpringApplicationBuilder applicationBuilder) {

         return applicationBuilder.sources(Application.class);
         }

       

         @Bean
         public DispatcherServlet dispatcherServlet() {

         return new DispatcherServlet();
         }

       

         /**
        * Register dispatcherServlet programmatically
        *
        * @return ServletRegistrationBean
        */
         @Bean
         public ServletRegistrationBean dispatcherServletRegistration() {

        ServletRegistrationBean registration = new ServletRegistrationBean(

        dispatcherServlet(), "/*");
         registration

        .setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
        return registration;
         }

       

      }

       

      Web security configuration

       

      @Configuration
      @EnableWebMvcSecurity
      public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

       

         /**
        * Custom Authentication Provider
        */
         @Autowired
         private CustomAuthenticationProvider customAuthenticationProvider;

         /**
        *
        * @param http - Http Security object
        * @throws Exception
        */
         @Override
         protected void configure(HttpSecurity http) throws Exception {

        http

        .authorizeRequests()

        .antMatchers("/css/**", "/js/**", "/forgotPassword",
         "/forgotUsername").permitAll()

        .anyRequest().authenticated()

        .and()

        .formLogin()

        .loginPage("/login")

        .permitAll()

        .and()

        .logout()

        .permitAll();
         }

       

         /**
        *
        * @param auth - Authentication Manager builder
        * @throws Exception
        */
         @Autowired
         public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {

        auth

        .authenticationProvider(customAuthenticationProvider);
         }

      }

       

      I am able to run the same web application in my development machine using maven spring-boot:run command and also can run in Jboss 7.2. The server i have to deploy has 7.1.1 and that is where the problem is happening.

       

      thanks,

      Karthik