CFHTTP works one time per restart

Explorer ,
Jan 15, 2021 Jan 15, 2021

Copy link to clipboard

Copied

Hello All-

 

I have a strange problem with CFHTTP.

 

I am sending JSON to a server using HTTPS via CFHTTP.  My code worked successfully under CF2016 for quite a while.  I migrated servers, now using CF2018, on Windows 2019.  

 

My problem is that now I can send ONE post successfully via cfhttp, then it will no longer work.  I receive a 'Connection Failure' error after the first success.  I've repeated this exercise at least 30 times, with the same result each time.

 

This is secure, and initially I thought the problem was with my Java certificates.  I installed what I believe are the correct certs.

 

The strange part, is that it will work ONCE every time I restart CF.  I can successfully POST the JSON, and view the results on the target server, as well as receiving the appropriate response from the server.  The next POST will fail.  Every attempt after that will fail- even re-running the initial post that was successful previously.

 

But if I restart the CF service, the next POST will be successful- then all of the others will fail.

 

The fact that it does work initially, leads me to believe this is not firewally, certificates, external server, etc.  Everything I can figure out points to CF as the problem- as restarting it will 'fix' the problem for one more iteration. 

 

This is my code- the same exact code worked on my previous server:

 

  <cfhttp url="#caesdomain#/api/invoices/#caesinvoicenumber#/send" method="post" result="GoodJob" timeout="20">
      <cfhttpparam type="header" name="Authorization" value="#apikey#" >
      <cfhttpparam type="header" name="Content-Type" value="application/json" />
      <cfhttpparam type="body" value="#mailsend#">
  </cfhttp>
 
Any help would be greatly, enthusiastically, and super-super-happily appreciated!
 
(I've included a cfdump of the response upon failure.)
 
Thanks-
TOPICS
Advanced techniques, Server administration

Views

206

Likes

Translate

Translate

Report

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

correct answers 1 Correct Answer

Explorer , Jan 19, 2021 Jan 19, 2021
BK-My new Java version: 11.0.9+7-LTSColdFusion was up to date with update 10.I tested and....it is now working!  Unfortunately the target server was also doing some troubleshooting, so I don't know whose changes fixed this.  But I am guessing the issue was on my side. After lunch I will update my production server to see if this fixes things there too. Thank you, thank you, thank you for pointing me in this direction.  With a brand new install of CF, I didn't think that updating the JRE would be...

Likes

Translate

Translate
Adobe Community Professional ,
Jan 15, 2021 Jan 15, 2021

Copy link to clipboard

Copied

Certainly odd. Please tell us what cf version this is, what update had been applied, and what jvm version it is, all indicated on the cf admin settings summary page. 

 

Also, please tell us whether there are any errors indicated in the most recent update log in the cf hf-updates folder. 

 

Finally another thing is not clear: can you confirm whether any other cfhttp calls work, whether to the same domain or another (using https and not)? 

 


/Charlie (server troubleshooter, carehart.org)

Likes

Translate

Translate

Report

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 Community Professional ,
Jan 16, 2021 Jan 16, 2021

Copy link to clipboard

Copied

@karlkrist : This is secure, and initially I thought the problem was with my Java certificates.  I installed what I believe are the correct certs.

 

I, too, thought of Java and certificates. Which Java version do you use? To see this, run:

 

<cfdump var="#server.system.properties.java.vm.version#">

 

Likes

Translate

Translate

Report

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 19, 2021 Jan 19, 2021

Copy link to clipboard

Copied

Hey BKBK!  I was wondering how to get that information!

This is the info I received when adding that dump.  (which oddly does not look like most cfdumps):

 

11.0.1+13-LTS

 

Please let me know if updating Java in some way is recommended!

Thanks-

Karl

Likes

Translate

Translate

Report

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 Community Professional ,
Jan 19, 2021 Jan 19, 2021

Copy link to clipboard

Copied

Ah. Java 11.0.1 is now too old for CF2018.

 

I would suggest that you:

(1) upgrade ColdFusion to the latest CF2018 update;

(2) install JAVA SE 11.0.9(LTS), typically the 64-Bit version - which you can download from http://adobe.com/support/coldfusion/downloads.html ;

(3) edit the java.home property in the system file /cfusion/bin/jvm.config to point to your Java 11.0.9 installation. For example, I have, for my CF2018 Update 10 installation on Windows:

 

java.home=C:/Program Files/Java/jdk-11.0.9

 

Likes

Translate

Translate

Report

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 Community Professional ,
Jan 19, 2021 Jan 19, 2021

Copy link to clipboard

Copied

If the cfhttp problem is still there after you update CF and Java, then we will talk some more. 🙂

Likes

Translate

Translate

Report

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 19, 2021 Jan 19, 2021

Copy link to clipboard

Copied

BK-

My new Java version: 11.0.9+7-LTS

ColdFusion was up to date with update 10.

I tested and....it is now working!  Unfortunately the target server was also doing some troubleshooting, so I don't know whose changes fixed this.  But I am guessing the issue was on my side.

 

After lunch I will update my production server to see if this fixes things there too.

 

Thank you, thank you, thank you for pointing me in this direction.  With a brand new install of CF, I didn't think that updating the JRE would be the issue.

Likes

Translate

Translate

Report

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 Community Professional ,
Jan 16, 2021 Jan 16, 2021

Copy link to clipboard

Copied

An idea to try: use cfhttp's clientCert and clientCertPassword attibutes. From the cfhttp documentation,

 

  • clientCert = The full path to a PKCS12 format file that contains the client certificate for the request
  • clientCertPassword = Password used to decrypt the client certificate

Likes

Translate

Translate

Report

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 Community Professional ,
Jan 18, 2021 Jan 18, 2021

Copy link to clipboard

Copied

karlkrist, any update for us? or any response to our suggestions?


/Charlie (server troubleshooter, carehart.org)

Likes

Translate

Translate

Report

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 ,
Apr 11, 2021 Apr 11, 2021

Copy link to clipboard

Copied

LATEST

I am running into the same issue. Currently my cfhttp process works for the API I am calling on CF10 Enterprise version running on Windows Server 2008R2 but, on my CF2018 editon it will run once and then fail every call after that. I applied update 10 when I first noticed the issue to see if that may help but it did not. I am running ColdFusion 2018 Enterprise Version: 2018.0.10.320417 on Windows Server 2016 Standard.

 

I then did as BKBK recommended above in this thread and installed latest Java from http://adobe.com/support/coldfusion/downloads.html which was 11.0.10 and pointed my jvm.config to the new Java home directory.

 

When I dump out value for the version using 

<cfdump var="#server.system.properties.java.version#"> just to make sure, it does indeed show "11.0.10" is being used. I restarted both the server and ColdFusion service and still get this issue:

Detail: [empty string]

Message: Connection Failure: Status code unavailable

 

Another thing I tried was impoting the SSL cert for the API site into the CF Certstore using Certman but since I am able to connect at least once I don't really think that is the issue, especially since I did not need to do that step on my CF10 version which is working.

 

Here is my cfhttp call:

<cfhttp method="GET" url="https://fleet.badger-technologies.com/api/web/v1/cleansweep?from=#fullStDtTime2#&to=#fullEndDtTime2#..." result="MartyData" throwonerror="yes" >

<cfhttpparam type="header" name="Authorization" value="Basic #ToBase64("myuser:pwd")#"/>

<cfhttpparam type="header" name="Content-Type" value="application/json; charset=utf-8" />

</cfhttp>

 

Kind of at a loss as to what to try next. Any further ideas or did I miss a step somewhere?

 

Likes

Translate

Translate

Report

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 Beginner ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

I had a similar issue with multiple cfhttp calls that broke when migrating to cf2021.  I upgraded to java 11.10 and that fixed the issue.

 

Likes

Translate

Translate

Report

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