4

We are using SDL Web 8.5 with DXA 2.0 and Java. The java application is deployed on Red Hat Linux server using Java version "1.8.0_161" 64 bit and Tomcat 8.5.30 .We are getting 500 server error when DXA caching is enabled but if we disable the DXA Caching using

spring.profiles.active=dxa.no-cache

website loading fine

we are getting below 500 server error when caching is enabled

java.lang.NullPointerException: null
    at com.sdl.dxa.caching.TridionCacheConfiguration.lambda$null$4(TridionCacheConfiguration.java:53)
    at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:372)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.Collections$2.tryAdvance(Collections.java:4717)
    at java.util.Collections$2.forEachRemaining(Collections.java:4725)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at com.sdl.dxa.caching.TridionCacheConfiguration.lambda$cacheResolver$5(TridionCacheConfiguration.java:54)
    at org.springframework.cache.jcache.interceptor.AbstractCacheInterceptor.resolveCache(AbstractCacheInterceptor.java:61)
    at org.springframework.cache.jcache.interceptor.CacheResultInterceptor.invoke(CacheResultInterceptor.java:50)
    at org.springframework.cache.jcache.interceptor.JCacheAspectSupport.execute(JCacheAspectSupport.java:131)
    at org.springframework.cache.jcache.interceptor.JCacheAspectSupport.execute(JCacheAspectSupport.java:102)
    at org.springframework.cache.jcache.interceptor.JCacheInterceptor.invoke(JCacheInterceptor.java:61)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
    at com.sdl.dxa.tridion.modelservice.ModelServiceClient$$EnhancerBySpringCGLIB$$dee1a1aa.getForType(<generated>)
    at com.sdl.dxa.tridion.modelservice.DefaultModelService._loadPage(DefaultModelService.java:56)
    at com.sdl.dxa.tridion.modelservice.DefaultModelService.loadPageModel(DefaultModelService.java:37)
    at com.sdl.dxa.tridion.mapping.impl.DefaultContentProvider._loadPage(DefaultContentProvider.java:100)
    at com.sdl.dxa.tridion.mapping.impl.DefaultContentProvider.getPageModel(DefaultContentProvider.java:175)
    at com.sdl.webapp.common.controller.PageController.getPageModel(PageController.java:290)
    at com.sdl.webapp.common.controller.PageController.handleGetPage(PageController.java:119)
    at com.sdl.dxa.modules.generic.controller.GenericPageController.handleGetPage(GenericPageController.java:54)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at com.tridion.ambientdata.web.AbstractAmbientDataServletFilter.doFilter(AbstractAmbientDataServletFilter.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)

Update

ehcache.xml

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://www.ehcache.org/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.1.xsd">
    <cache-template name="default">
        <expiry>
            <ttl unit="seconds">5</ttl>
        </expiry>
        <resources>
            <heap unit="entries">10000</heap>
        </resources>
    </cache-template>

    <cache alias="defaultCache" uses-template="default" />
</config>
4
  • TGe error points to an invalid caching configuration. So check your settings. Maybe something as simple as a missed xml closing tag. For best answers though, update your question with the config. Apr 22, 2018 at 23:48
  • @NickoliRoussakov i have checked XML file it is properly closing all tags Jun 28, 2018 at 9:59
  • In the dxa.properties file dxa.caching.required.caches=?? what is the value?
    – Velmurugan
    Jun 28, 2018 at 20:52
  • @Velmurugan it is dxa.caching.required.caches=defaultCache,failures Jun 29, 2018 at 23:36

1 Answer 1

2

So, according to the Stack Trace, there is a NullPointerException at line 53 in TridionCacheConfiguration.java.

Good luck with post-mortem analysis. :-)

See: https://community.sdl.com/product-groups/sdl-tridion-dx/tridion-sites/b/blog-posts/posts/digital-forensics-based-on-a-stack-trace

UPDATE

There are three things on line 53 that could cause a NullPointerException:

  1. The result of the previous line, i.e. the result of the map method
  2. The log object
  3. The cache parameter of the lambda expression

Looking at the first line of the Stack Trace, the exception occurred in a lambda expression. So, it’s either #2 or #3.

4
  • Rick after looking at the code it seems issue is code is not able to get cache name and when it is trying to get cache using cacheManager().getCache(name) system is throwing null pointer expression. Jun 29, 2018 at 23:45
  • You mean that cacheManager().getCache(name) returned null, so that the cache lambda parameter on line 53 becomes null resulting in a NullPointerException on cache.getName()? I would agree that seems to be the most likely cause. Jun 30, 2018 at 11:52
  • Rick what could be the root cause ? Jul 2, 2018 at 10:44
  • I have to tell you a little secret: I don’t know everything. I’m just trying to help out with the analysis. Jul 2, 2018 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.