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

CFHTTP fails CF2018 Enterprise

Explorer ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

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 (sometimes) 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 and I recently applied Update 11 with same results. I am running ColdFusion 2018 Enterprise Version: 2018.0.11.326016 on Windows Server 2016 Standard.

 

I then did as BKBK recommended in another post 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+8-LTS-162" is being used. I restarted both the server and ColdFusion service and still get this issue:

 

Another thing I tried was importing 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? Attached is the cfdump.

Views

1.3K

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 Expert ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

You are sending data to the server by means of cfhttpparam. So I would suggest you use the Post method, rather than the Get.

If it still doesn't work, then output the variables to see whether they are what you expect. That is:

<cfoutput>
	URL: https://fleet.badger-technologies.com/api/web/v1/cleansweep?from=#fullStDtTime2#&to=#fullEndDtTime2#...<br>
	Authorization: Basic #ToBase64("myuser:pwd")#
</cfoutput>

Votes

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

Copy link to clipboard

Copied

BKBK, thank you for your reposne. I am sending varibale values in the URL string along with the Authorization info but I am getting JSON data returned to me which I write to a text file. I tried your POST method but that fails with same error. I was doing the cfoutput in my cftry/cfcatch already to verify I was sending the correct values in the variables and they are correct.  As I mentioned in initial post it works one time and then fails everytime after that. I have a list of store numbers and I loop over this CFHTTP code to send the store number in one of the variables to get the JSON data back but fails everytime. Then if I wait like 20 minutyes and run it, it will work for the 1st call but then fail everytime after that again. I have been running this exact same code for almost 2 years on our CF10 Enterprise version with no issues so kinda stumped on this one with applying the updates and using newer Java version that seemed to work for others having this same issue.

Votes

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 Expert ,
Apr 25, 2021 Apr 25, 2021

Copy link to clipboard

Copied

Jdsplicer, thanks for your reply. I had another look at your first post. In thinking that you would be using httpparams to call the service, I had perhaps assumed too much. Sorry about that. As long as the httpparams are exclusively headers, you can of course use GET.

 

quote...it works one time and then fails everytime after that. I have a list of store numbers and I loop over this CFHTTP code to send the store number in one of the variables to get the JSON data back but fails everytime. Then if I wait like 20 minutyes and run it, it will work for the 1st call but then fail everytime after that again. I have been running this exact same code for almost 2 years on our CF10 Enterprise version with no issues ...

By @Jdsplicer

 

Loud and clear. That's what we have to look into.

 

To start with, could you share any log messages that you get during the failed cfhttp calls.

Votes

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 Expert ,
Apr 25, 2021 Apr 25, 2021

Copy link to clipboard

Copied

See if adding the following headers helps (in case it is a connection issue):

<cfhttpparam type="header" name="Accept" value="application/json"/> 
<cfhttpparam type="header" name="Accept-Encoding" value="*"/>
<cfhttpparam type="Header" name="TE" value="deflate;q=0"/>	
<cfhttpparam type="header" name="Connection" value="keep-alive"/>

Votes

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

Copy link to clipboard

Copied

Thnak for your sugesstions BKBK. I have tried the cfhttpparam's you listed above with the same results. I have attached some log files after running to show what is happenning. I really don't see anything in there that leads me in any one direction. I am also including my JVM settings to see if anything there may be causing the issue.

Votes

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 Expert ,
Apr 25, 2021 Apr 25, 2021

Copy link to clipboard

Copied

Yet another suggestion: do the following 3 tests, each requiring you to add TLS flags to jvm.config

 

  1. -Djdk.tls.client.protocols=TLSv1.2,TLSv1.3 -Dhttps.protocols=TLSv1.2,TLSv1.3
  2. -Djdk.tls.client.protocols=TLSv1.2 -Dhttps.protocols=TLSv1.2
  3. use neither flag

 

Restart ColdFusion after each change. Then make the http GET request.

Votes

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

Copy link to clipboard

Copied

I tried all 3 of your suggestions with the same results. Attached are my JVM Arguments after each test. I restarted CF service after each change as well. I checked the logs after each test as well and did not see anything different than in the first set of logs error wise.

Votes

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 Expert ,
Apr 25, 2021 Apr 25, 2021

Copy link to clipboard

Copied

OK. Do you also check coldfusion-error.log, application.log, exception.log and server.log? What do they say?

Votes

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

Copy link to clipboard

Copied

Actually no, I only cehcked the log files that showed an update to the date/timestamp when I ran the file. I will check them shortly and see what they say, thanks for your suggestions!!

Votes

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 Expert ,
Apr 25, 2021 Apr 25, 2021

Copy link to clipboard

Copied

When I test with the following call, I get a response every time from the server. Albeit a '401 Unauthorized' response, as expected.

 

<cfhttp method="GET" url="https://fleet.badger-technologies.com/api/web/v1/cleansweep?from=2021-04-20%2015:00:00&to=2021-04-20%2015:59:59&ahold_store_id=0003" result="MartyData" throwonerror="yes" >
<cfhttpparam type="header" name="Authorization" value="Basic YWxhZGRpbjpvcGVuc2VzYW1l"/>
<cfhttpparam type="header" name="Content-Type" value="application/json;charset=utf-8" />
</cfhttp>
<cfdump var="#MartyData#" >

 

 

Might this be telling us something about the dynamic authorization sting? Test this hypothesis by replacing #ToBase64("myuser:pwd")# with the actual string.

 

Votes

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

Copy link to clipboard

Copied

So I tried the exact same code as you did above and I still get the same error I get when I pass the authorization string (see attached). I changed it as you suggested and still get the same error. Starting to think something is not configured right in my setup or something is blocking my call out.

Votes

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

Copy link to clipboard

Copied

So when I cehck the server log file I see this message when I restart CF service. Not sure what it means:

 

"Error","main","04/25/21","16:04:35","","RMI for LCDS has been disabled. Set coldfusion.rmi.enable and coldfusion.rmi.enablelcds JVM flags as true in jvm.config file and restart the server"
"Error","main","04/25/21","16:04:35","","Unable to initialise FlexAssembler service: coldfusion.flex.rmi.RMIInitializationException: RMI for LCDS has been disabled. Set coldfusion.rmi.enable and coldfusion.rmi.enablelcds JVM flags as true in jvm.config file and restart the server "
"Information","main","04/25/21","16:04:35","","Starting .NET..."
"Information","main","04/25/21","16:04:35","","Starting Monitoring..."
"Information","main","04/25/21","16:04:36","","Starting PDFG..."
"Information","main","04/25/21","16:04:36","","Starting WebSocket..."
"Information","main","04/25/21","16:04:36","","WebSocket server listens on port: 8581"
"Information","main","04/25/21","16:04:36","","ColdFusion started"
"Information","main","04/25/21","16:04:36","","ColdFusion: application services are now available"
"Information","Thread-7","04/25/21","16:04:39","","Same Serial Number found on another ColdFusion server.The server may be out of compliance."
"Information","Thread-15","04/25/21","16:04:45","","PDFg service manager http://127.0.0.1:8991/PDFgServlet/ registered."

Votes

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 Expert ,
Apr 25, 2021 Apr 25, 2021

Copy link to clipboard

Copied

quote

So when I cehck the server log file I see this message when I restart CF service. Not sure what it means:

"Error","main","04/25/21","16:04:35","","RMI for LCDS has been disabled. Set coldfusion.rmi.enable and coldfusion.rmi.enablelcds JVM flags as true in jvm.config file and restart the server"
"Error","main","04/25/21","16:04:35","","Unable to initialise FlexAssembler service: coldfusion.flex.rmi.RMIInitializationException: RMI for LCDS has been disabled. Set coldfusion.rmi.enable and coldfusion.rmi.enablelcds JVM flags as true in jvm.config file and restart the server "

By @Jdsplicer

That may or may not be relevant to the current issue. But it seems important.

 

The error "RMI for LCDS has been disabled" suggests you are using RMI somewhere.

Are you using Flex, Adobe's LiveCycle Data Services (LCDS) or any module that requires RMI? If not, then something went wrong with your ColdFusion 2018 installation.

 

In that case, I would recommend reinstallation + upgrading to the latest update level.

 

However, if you have a module that uses RMI, you should add the following flags to jvm.config, and restart ColdFusion and let's see what happens:

 

-Dcoldfusion.rmi.enable=true -Dcoldfusion.rmi.enablelcds=true

Votes

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

Copy link to clipboard

Copied

No, I am not using Flex, Adobe's LiveCycle Data Services (LCDS) or any module that requires RMI. I added the JVM arguments, restarted CF service and still same issue; howvere, now I can't seem to get it to connect even once so I am going to remove those JVM argumnets.

Votes

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 Expert ,
Apr 26, 2021 Apr 26, 2021

Copy link to clipboard

Copied

quote

No, I am not using Flex, Adobe's LiveCycle Data Services (LCDS) or any module that requires RMI. I added the JVM arguments, restarted CF service and still same issue; howvere, now I can't seem to get it to connect even once so I am going to remove those JVM argumnets.

By @Jdsplicer

 

You should indeed remove the RMI flags. Having said that, I now think your ColdFusion 2018 installation contains an error. That is because it is apparently starting up RMI processes in the background. Whereas, as you say, you aren't using any module that requires RMI.

 

Therefore, I would recommend you reinstall ColdFusion 2018 + upgrade to the latest update level.

 

 

Votes

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 Expert ,
Apr 25, 2021 Apr 25, 2021

Copy link to clipboard

Copied

@Jdsplicer : "I tried all 3 of your suggestions with the same results. Attached are my JVM Arguments after each test. "

 

OK. That was that. 

Please return jvm.config to the original state, but with:

    -Djdk.tls.client.protocols=TLSv1.2,TLSv1.3 -Dhttps.protocols=TLSv1.2,TLSv1.3

Votes

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 Expert ,
Apr 25, 2021 Apr 25, 2021

Copy link to clipboard

Copied

Jd, given that you are already on the latest jvm (well, as of the beginning of this week--there was newer one this week), there may be more to your problem than that. Especially since you say that this works once then fails.

 

First, you may want to at least confirm that java 11.11 doesn't help.

 

Second, though the code you run "worked before", I wonder if it may act differently if you urlencoded the url vars in the url of the cfhttp (using urlencodedformat).

 

Finally, if neither helps, there's a possibility that if you installed cf10 on this same new machine, maybe you'd find that it would fail there even in cf10. Worth at least a try. And even if you might find you couldn't easily set things up to "run your app", just setup a single template to test just this one thing. Shouldn't take more than 15 mins.

 

Woukd love to hear what you may find or think. 


/Charlie (troubleshooter, carehart.org)

Votes

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

Copy link to clipboard

Copied

Charlie, hi and thank you for the suggestions. When you say Java 11.11 I assume you mean Java SE 11.0.11 as that is the latest release for the Java SE 11 Platform. If so, I went ahead and downloaded that, updated my Java virtual machine path and verifed it was using it by running the folowing:

<cfdump var="#server.system.properties.java.vm.version#"> which displays: "Java Ver: 11.0.11+9-LTS-194" and unfortunately I still get the same result.
 
I tried your second suggestion about "urlencoded the url vars in the url of the cfhttp (using urlencodedformat)" but that seems to fail everytime.
 
For your thrid suggestion, unfortunately I do not have access at this time to the CF10 Enterprise software and license, I will need to see if that is something i can get from the team this week but I won't hold my breath as that was controlled by another group before I took over the CF2018 installs.

Votes

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 Expert ,
Apr 25, 2021 Apr 25, 2021

Copy link to clipboard

Copied

1) Yes, 11.0.11. Sorry, was typing quickly.

 

2) About using urlencodedformat, what fails? Do you mean the same error as before, or about using that function? Show us what you're doing, like the other code. Maybe we'll see something to suggest. 

 

3) Finally, as for cf10, you don't need a license. When you install cf, any version, you have a choice of putting in a license, or choosing the free developer edition, or choosing the 60-day trial--after which if you don't put in a license, it reverts to the dev edition.

 

Lastly, as for getting the installer, you can--for any version--at a community-run site that I and others contribute to, cfmlrepo.com. 

 

BTW, installing cf10 on a machine already running cf2018 should be no problem and have no negative on it. The cf installer will detect that the other one is running and choose unique ports for the new install. 

 

Again, you can be done in 15 mins, so it's worth it to confirm if this is indeed the cf2018 config problem you currently are feeling it must be. And it may be, but let's rule out other possibilities first, since done easily. 


/Charlie (troubleshooter, carehart.org)

Votes

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

Copy link to clipboard

Copied

Sorry, yes I mean the same error as before. Here is my code:

 

<cfhttp method="GET" url="https://fleet.badger-technologies.com/api/web/v1/cleansweep?from=#urlencodedformat(fullStDtTime2)#&to=#urlencodedformat(fullEndDtTime2)#&ahold_store_id=#TRIM(urlencodedformat(qGetMartyStores.f_storenum))#" result="MartyData" throwonerror="yes">
<cfhttpparam type="header" name="Authorization" value="Basic #ToBase64("user:pwd")#"/>
<cfhttpparam type="header" name="Content-Type" value="application/json; charset=utf-8" />                        
</cfhttp>
 
Same result: Connection Failure: Status code unavailable

Votes

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 Expert ,
Apr 26, 2021 Apr 26, 2021

Copy link to clipboard

Copied

Suggestion: in all the tests that follow, replace

 

"Basic #ToBase64("myuser:pwd")#"

 

with the actual authorization string. Just one thing less for us to worry about. 🙂

Votes

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 Expert ,
Apr 26, 2021 Apr 26, 2021

Copy link to clipboard

Copied

 Is the cfhttp within a loop? If so, the client code may be making requests too frequent for the service to handle. Then a suggestion for a test would be to have a 10 second delay in between the cfhttp calls:

 

<cfloop index="i" from="1" to="6">
	
<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 your-auth-string-in-full"/>
<cfhttpparam type="header" name="Content-Type" value="application/json;charset=utf-8" />

<!--- Log the results to look at later (in the current folder)--->
<cfdump var="#MartyData#" format="html" output="#expandPath('httpResults.html')#" >

<!--- 10 second wait between cfhttp calls --->
<cfset sleep(10000)>

</cfhttp>

</cfloop>

 

 

Votes

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

Copy link to clipboard

Copied

Yes, this is inside a cfloop tag. I am thinking it may be an issue at the client (somehow). I have CF2018 on 2 different 2016 Windows servers and 4 RHEL servers running websphere and they all get that same error message for this service call. The only server it works from is our CF10 windows 2012r2 server. The vendor assures me they are not whitelisting or blocking anything from our side for this call. I decided to find another external API that I could call with cfhttp to see if there us an issue with CF2018. I found a free APi call to a random joke api and it works without issue. Below is the code I used for that, looping 50 times and it connected and created 50 txt files with the response data without issue. To me this confirms that cfhttp is working as I would expect it to, at least for this unauthenticated call.

 

 

<cfloop index="i" from="1" to="50">
    <cfoutput>#i#</cfoutput>
    <cftry>       
        <cfhttp method="GET" url="https://official-joke-api.appspot.com/random_joke" result="MartyData" throwonerror="yes">
        <cfhttpparam type="header" name="Content-Type" value="application/json; charset=utf-8" />            
        </cfhttp>
        
        <cffile action="write" file="/webnet/internet_development/SharedDev/martydata/files/MartyJSON#i#.txt" output="#MartyData.filecontent#" nameconflict="overwrite" mode="777">        
    <cfcatch>
    <cfdump var="#cfcatch#"><br />     
<cfabort> 
    </cfcatch>
    </cftry>
</cfloop>

 

 

Thanks.

Votes

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 Expert ,
Apr 26, 2021 Apr 26, 2021

Copy link to clipboard

Copied

Thanks for sharing that. Did you do the test with sleep() that I suggested?

 

One may argue that, in your (cfhttp + fileWrite) example, the fileWrite contributes a wait to the process.

Votes

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
Resources
Documentation