Skip to main content
Known Participant
January 16, 2023
Question

Coldfusion2021 Apache Java Null Pointer Exception

  • January 16, 2023
  • 2 replies
  • 1315 views

I have Azure Container Instance running Coldfusion 2021 and Apache on Linux Server.

I am using the mod_jk connector.

I am getting the following error sometimes.

 

java.lang.NullPointerException
	at coldfusion.runtime.ClientScopeServiceImpl.GetClientScope(ClientScopeServiceImpl.java:330)
	at coldfusion.runtime.AppHelper.setupClientScope(AppHelper.java:971)
	at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:503)
	at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:43)
	at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
	at coldfusion.filter.PathFilter.invoke(PathFilter.java:162)
	at coldfusion.filter.IpFilter.invoke(IpFilter.java:45)
	at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:30)
	at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:97)
	at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
	at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
	at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:60)
	at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
	at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
	at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
	at coldfusion.CfmServlet.service(CfmServlet.java:231)
	at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:311)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
	at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:46)
	at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:47)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
	at coldfusion.inspect.weinre.MobileDeviceDomInspectionFilter.doFilter(MobileDeviceDomInspectionFilter.java:57)
	at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:47)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:295)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
	at org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:552)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:377)
	at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:463)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:889)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:835)

 

How to resolve this issue?

 

    This topic has been closed for replies.

    2 replies

    Charlie Arehart
    Community Expert
    Community Expert
    January 16, 2023

    Souvik, I have a different take: a couple, in fact. Sorry it's not a brief answer, but given what's been said so far, it seems this will take some digging into. 

     

    1) Following up on the client var aspect (as Priyank and BKBK pursued), I notice also that the stack trace includes mention of the Tomcat remoteipvalve. Perhaps something is amiss with the result of that valve's processing that confuses the client var processing (though I'd think the latter cares only about cookies, not ip addresses). 

     

    a) Anyway, that valve is not implemented in cf by default, so you or someone there enabled that (in the server.xml of cf, which I discuss here). I could certainly see a connection between that and the random nature of your problem, perhaps based on the nature of an incoming request.

     

    Have you tried removing it? Even if you "need it", I mean to suggest you consider removing it even if only temporarily, at least long enough to see if you'd get past however frequently you've been seeing this error. 

     

    b) If you "can't change that", a next step could be to observe what the ip is when it happens. But it's not as simple as looking at the apache log. Since you're using the remoteipvalve, that would mean you get requests through some proxy or firewall, such that the "real" ip is provided by that in a header, and the valve is used to extract that (in tomcat and for cf). Apache's log would likely report instead the ip of the proxy or firewall, which would not help us to solve this. (You could also look into configuring apache to log based on the ip headers also.) 

     

    Or if you may have fusionreactor, it can show you the headers (I don't think the PMT tracks headers)--and? Fusionreactor can also be configured to show and log the ip based on those headers, as I discuss here

     

    2) If none of the above helps, there may be other characteristics about your situation that we should understand, lest we make any mistaken presumptions:

    • What version of apache are you running? 
    • is it running running in the same container as cf?
    • Is this using Adobe's cf image or one you built?
    • If you built it, did you implement cf in the image using the full installer or the zip approach that's new to 2021?
    • Is that Ajp (cf/web server) connection configuration one that you built by running the cf wsconfig tool, or something you created by hand?
    • Have you run your combination of cf and apache as containers outside of aci?

     

    3) Finally, as a real shot in the dark, have you considered NOT using Ajp, but instead configure apache (or any other web server or ingress) to just forward requests to the internal (tomcat) web server within CF at port 8500?

     

    That's possible and supported. I show doing that (with nginx, without Ajp) here. While that shows configuring cf images via docker compose, the general idea can be implemented without it. 

     

    Again, sorry for the brain dump folks. But since the problem seems a knotty one, these these are where the clues so far would take me. 

    /Charlie (troubleshooter, carehart. org)
    Known Participant
    January 16, 2023

    @Charlie Arehart  Thanks for your reply. I shall check.

     

    Thanks,Souvik
    BKBK
    Community Expert
    Community Expert
    January 16, 2023

    Does the application use client variables? In other words, does Application.cfc contain the following setting?

    this.clientManagement="Yes";
    
    /* Alternatively, in tag syntax */
    /* <cfset this.clientManagement="Yes"> */
    
    If so, what is the value of  this.clientStorage ?
    Priyank Shrivastava.
    Community Manager
    Community Manager
    January 16, 2023

    @Souvik Saha Choudhury  As @BKBK  mentioned, please check if you are getting this error in your application. I need to know when you are getting this error while accessing the Application or CF Admin?

     

     

     

    Thanks, Priyank Shrivastava
    Known Participant
    January 16, 2023

    @Priyank Shrivastava. Getting this error while accessing the Application.

     

    Thanks,Souvik