3

I have a Java DXA 2.0 environment with Web 8.5. The microservices are setup on a Linux environment. I have set oAuth to false at all the places possible on the services and the webapp.

I followed the steps from here https://docs.sdl.com/LiveContent/content/en-US/SDL%20DXA-v10/GUID-991AF5E7-387E-4C0A-A0C3-DF87A6F79427

But when I start my webapp and try hitting the first page (not a specific page but the first page after the webapp starts), I get this error

    10:58:43.366 [http-nio-8081-exec-3] INFO  c.s.c.o.c.ODataContextEngineProxy - Error Initializing Token Provider.
java.lang.NullPointerException: Client id is required!
    at java.util.Objects.requireNonNull(Objects.java:228)
    at com.sdl.web.client.impl.OAuthTokenProvider.initializeClientIdAndSecret(OAuthTokenProvider.java:54)
    at com.sdl.web.client.impl.OAuthTokenProvider.<init>(OAuthTokenProvider.java:48)
    at com.sdl.context.odata.client.ODataContextEngineProxy.<init>(ODataContextEngineProxy.java:69)
    at com.sdl.context.odata.client.api.ODataContextEngine.<init>(ODataContextEngine.java:33)
    at com.sdl.webapp.tridion.contextengine.ContextServiceClaimsProvider.getContextClaims(ContextServiceClaimsProvider.java:99)
    at com.sdl.webapp.common.impl.contextengine.ContextEngineImpl.claims(ContextEngineImpl.java:52)
    at com.sdl.webapp.common.impl.contextengine.ContextEngineImpl.getClaims(ContextEngineImpl.java:32)
    at com.sdl.webapp.common.impl.contextengine.ContextEngineImpl.getClaims(ContextEngineImpl.java:42)
    at com.sdl.webapp.common.impl.WebRequestContextImpl.displayWidth(WebRequestContextImpl.java:234)
    at com.sdl.webapp.common.impl.WebRequestContextImpl.getDisplayWidth(WebRequestContextImpl.java:70)
    at com.sdl.webapp.common.impl.WebRequestContextImpl$$FastClassBySpringCGLIB$$2bfec188.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
    at com.sdl.webapp.common.impl.WebRequestContextImpl$$EnhancerBySpringCGLIB$$2912a13f.getDisplayWidth(<generated>)
    at com.sdl.webapp.common.impl.DefaultMediaHelper.getScreenWidth(DefaultMediaHelper.java:155)
    at com.sdl.webapp.common.controller.PageController.handleGetPage(PageController.java:139)
    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 com.nrg.dxawebapp.corefeatures.service.MBDispatcherServlet.doService(MBDispatcherServlet.java:35)
    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 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:493)
    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:800)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
    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)

The error doesn't stop me from getting the page on the browser. The webapp works perfectly fine and I get all the pages when I hit them from the browser but I get this error in the logs when I hit the first page.

My question is, is there a way to get rid of this error from the console? What could be causing this error?

5

I got rid of that error from the logs by adding the TokenService back to the cd_client_conf.xml on the webapp side.

<TokenService ClientId="clientID" ClientSecret="encrypted:password"/>

This seems like a bug with DXA where even after you have the oAuth disabled, you need the token service tag with client id and client secret in the webapp. For some reason there seems to be a blank check happening on the services side which doesn't affect the content rendering at all. It just throws an error in the logs if the check fails but the webapp still runs fine.

The weird part is that if the client ID or the secret is wrong here, then the webapp won't work at all.

You either need to have the correct id and secret to make it work perfectly or no id and secret which will still work but will throw an error in the logs.

  • This is actually Java CIL behavior (let’s. call it a quirk :-) – Rick Pannekoek Apr 23 at 17:02

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.