Java Question

What is the origin of a NestedServletException?

Lately I've been working with the Hybris platform and I encountered an exception in my Tomcat today. The issue is I can't seem to find any valuable information about what a NestedServletException is or why it's thrown. At the moment my priority is to understand the concept, then after solve it.

In case it's usefull, I'll attach the StackTrace:

Estado HTTP 500 - Error while processing internal filterchain. Exception occurred at chain position: 5 of 15. Current filter: 'es.logista.storefront.filters.cms.CMSSiteFilter@539dc64a'!; nested exception is java.lang.NullPointerException

type Informe de Excepción

mensaje Error while processing internal filterchain. Exception occurred at chain position: 5 of 15. Current filter: 'es.logista.storefront.filters.cms.CMSSiteFilter@539dc64a'!; nested exception is java.lang.NullPointerException

descripción El servidor encontró un error interno que hizo que no pudiera rellenar este requerimiento.

excepción

org.springframework.web.util.NestedServletException: Error while processing internal filterchain. Exception occurred at chain position: 5 of 15. Current filter: 'es.logista.storefront.filters.cms.CMSSiteFilter@539dc64a'!; nested exception is java.lang.NullPointerException
de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:234)
es.logista.storefront.filters.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:89)
de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
es.logista.storefront.filters.AcceleratorAddOnFilter.doFilter(AcceleratorAddOnFilter.java:92)
de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
de.hybris.platform.servicelayer.web.SessionFilter.doFilter(SessionFilter.java:73)
de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
de.hybris.platform.servicelayer.web.Log4JFilter.doFilter(Log4JFilter.java:47)
de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain.doFilterInternal(AbstractPlatformFilterChain.java:156)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
es.logista.storefront.filters.AcceleratorAddOnFilter.doFilter(AcceleratorAddOnFilter.java:92)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
de.hybris.platform.servicelayer.web.XSSFilter.doFilter(XSSFilter.java:230)

causa raíz

java.lang.NullPointerException
java.util.concurrent.ConcurrentHashMap.get(Unknown Source)
de.hybris.platform.persistence.property.PersistenceInfoCache.getCachedExternalTableTypes(PersistenceInfoCache.java:70)
de.hybris.platform.persistence.property.DBPersistenceManager.getExternalTableTypes(DBPersistenceManager.java:883)
de.hybris.platform.persistence.flexiblesearch.typecache.impl.DefaultFlexibleSearchTypeCacheProvider.getExternalTableTypes(DefaultFlexibleSearchTypeCacheProvider.java:137)
de.hybris.platform.persistence.flexiblesearch.ParsedType.<init>(ParsedType.java:93)
de.hybris.platform.persistence.flexiblesearch.ParsedType.<init>(ParsedType.java:78)
de.hybris.platform.persistence.flexiblesearch.FromClause.createSingleType(FromClause.java:89)
de.hybris.platform.persistence.flexiblesearch.FromClause.translateNested(FromClause.java:73)
de.hybris.platform.persistence.flexiblesearch.ParsedText$2.translate(ParsedText.java:269)
de.hybris.platform.persistence.flexiblesearch.FlexibleSearchTools.replace(FlexibleSearchTools.java:310)
de.hybris.platform.persistence.flexiblesearch.ParsedText.translate(ParsedText.java:263)
de.hybris.platform.persistence.flexiblesearch.FromClause.translate(FromClause.java:48)
de.hybris.platform.persistence.flexiblesearch.ParsedQuery.translate(ParsedQuery.java:401)
de.hybris.platform.persistence.flexiblesearch.ParsedQuery.getTranslatedQuery(ParsedQuery.java:181)
de.hybris.platform.persistence.flexiblesearch.QueryParser.translateQuery(QueryParser.java:229)
de.hybris.platform.jalo.flexiblesearch.FlexibleSearch.translate(FlexibleSearch.java:2007)
de.hybris.platform.jalo.flexiblesearch.FlexibleSearch.search(FlexibleSearch.java:1412)
de.hybris.platform.jalo.flexiblesearch.FlexibleSearch.search(FlexibleSearch.java:1628)
de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService$2.execute(DefaultFlexibleSearchService.java:374)
de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService$2.execute(DefaultFlexibleSearchService.java:1)
de.hybris.platform.servicelayer.session.impl.DefaultSessionService.executeInLocalView(DefaultSessionService.java:91)
de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService.getJaloResult(DefaultFlexibleSearchService.java:363)
de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService.search(DefaultFlexibleSearchService.java:164)
de.hybris.platform.servicelayer.internal.dao.AbstractItemDao.search(AbstractItemDao.java:70)
de.hybris.platform.cms2.servicelayer.daos.impl.DefaultCMSSiteDao.findAllCMSSites(DefaultCMSSiteDao.java:42)
de.hybris.platform.cms2.servicelayer.services.impl.DefaultCMSSiteService.getSites(DefaultCMSSiteService.java:317)
de.hybris.platform.cms2.servicelayer.services.impl.DefaultCMSSiteService.getSiteForURL(DefaultCMSSiteService.java:269)
de.hybris.platform.acceleratorcms.context.impl.DefaultContextInformationLoader.initializeSiteFromRequest(DefaultContextInformationLoader.java:98)
es.logista.storefront.filters.cms.CMSSiteFilter.processNormalRequest(CMSSiteFilter.java:161)
es.logista.storefront.filters.cms.CMSSiteFilter.doFilterInternal(CMSSiteFilter.java:97)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
es.logista.storefront.filters.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:89)
de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
es.logista.storefront.filters.AcceleratorAddOnFilter.doFilter(AcceleratorAddOnFilter.java:92)
de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
de.hybris.platform.servicelayer.web.SessionFilter.doFilter(SessionFilter.java:73)
de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
de.hybris.platform.servicelayer.web.Log4JFilter.doFilter(Log4JFilter.java:47)
de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain.doFilterInternal(AbstractPlatformFilterChain.java:156)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
es.logista.storefront.filters.AcceleratorAddOnFilter.doFilter(AcceleratorAddOnFilter.java:92)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
de.hybris.platform.servicelayer.web.XSSFilter.doFilter(XSSFilter.java:230)

nota La traza completa de la causa de este error se encuentra en los archivos de diario de Apache Tomcat/7.0.59.

Answer

Nested Exceptions are exceptions wrapped up in another exception. People do that for multiple reasons (some of them mentioned here).

As you can see in the stack trace the root exception is a nullpointer exception.

So basically your NestedServletException is nothing but a NullpointerException that is caught & thrown again at some point, but wrapped up in a ServletException.