Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Coldfusion2021 Apache Java Null Pointer Exception

Explorer ,
Jan 16, 2023 Jan 16, 2023

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?

 

Thanks,
Souvik
853
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 16, 2023 Jan 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 ?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 16, 2023 Jan 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 16, 2023 Jan 16, 2023

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

 

Thanks,
Souvik
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 16, 2023 Jan 16, 2023

@BKBK  Yes, the application uses client variables and it's from the database.

 

Thanks,
Souvik
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 16, 2023 Jan 16, 2023

Thanks Souvik,

 

Have you added that DB and also selected to store client variables in CF Admin?

 

PriyankShrivastava_0-1673873140601.pngexpand image

 

Thanks,
Priyank Shrivastava
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 16, 2023 Jan 16, 2023

@Priyank Shrivastava. yes, it's added. The application is running but getting this error frequently.

 

Thanks,
Souvik
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 16, 2023 Jan 16, 2023

@Souvik Saha Choudhury , could you answer Priyank's second question? For the sake of completeness. 

BKBK_0-1673886728779.pngexpand image

 

Did you choose 'Cookie', 'Registry' or 'None'? There is a reason for asking. Choosing Registry is capable of causing the problem you've reported.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 16, 2023 Jan 16, 2023

@BKBK None selected.

 

Thanks,
Souvik
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 16, 2023 Jan 16, 2023
quote

BKBK None selected.

 


By Souvik Saha Choudhury

Select 'Cookie' and click on the Apply button. Does that stop the error?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 16, 2023 Jan 16, 2023
quote

BKBK None selected.

 

By Souvik Saha Choudhury

Select 'Cookie' and click on the Apply button. Does that stop the error?



@Souvik Saha Choudhury As BKBK asked you to select Cookies. However, you mentioned that you are using DB, please select DB in Client variable page in CF Admin, it will create tables and then you can select the DB and Apply. Test your application and let us know if that resolves the issue. It is most likely failing because of that. 

 

Thanks,
Priyank Shrivastava
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2023 Jan 17, 2023

Indeed, @Priyank Shrivastava. . I should add that my last Cookie suggestion is only meant as a test. If selecting Cookie makes the error go away, it will mean that client-storage in the database is not properly configured.

 

@Souvik Saha Choudhury , does Application.cfc have the following setting?

[ 'clientDatasource' is the datasource you added in the Administrator in the section: Server Settings => Client Variables => Select a data source to add as Client Store ]


this.clientStorage="clientDatasource";

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 31, 2023 Jan 31, 2023
LATEST

@BKBK  I selected data source in client store. I am getting the issue sometimes, but not as frequently as before.

 

Thanks,
Souvik
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 16, 2023 Jan 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)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 16, 2023 Jan 16, 2023

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

 

Thanks,
Souvik
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources