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

Coldfusion 9 CFFTP Tag

New Here ,
Oct 13, 2009 Oct 13, 2009

Hi, hope somebody can help!

I'm running an evaluation on the new Coldfusion 9 and  trying to use the <CFFTP> tag to connect to a remote SFTP server. The server version is:-

SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu1.2

My Code is:-


<cfftp action = "open"

username = "myusername"

connection = "MyConnection"

password = "mypassword"

server = "myserver.com"

secure = "yes">


<p>Successful: <cfoutput>#cfftp.succeeded#</cfoutput>

<cfdump var ="#MyConnection#" label="connection">

This is what is returned:-

An error occurred while establishing an sFTP connection.

Verify your connection attributes: username, password, server, fingerprint, port, key, connection, proxyServer, and secure (as applicable). Error: Session.connect: java.io.IOException: invalid data.
The error occurred in /Applications/ColdFusion9/wwwroot/test/sftp.cfm: line 12
10 : 
11 : server = "10.1.3.43"
12 : secure = "yes">
13 : 
14 : <p>Successful: <cfoutput>#cfftp.succeeded#</cfoutput>

Resources:

Browser  Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_1; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Safari/412.0
Remote Address  0:0:0:0:0:0:0:1%0
Referrer 
Date/Time  13-Oct-09 11:32 PM
Stack Trace
at cfsftp2ecfm1948882534.runPage(/Applications/ColdFusion9/wwwroot/test/sftp.cfm:12) at cfsftp2ecfm1948882534.runPage(/Applications/ColdFusion9/wwwroot/test/sftp.cfm:12)

com.jcraft.jsch.JSchException: Session.connect: java.io.IOException: invalid data
     at com.jcraft.jsch.Session.connect(Unknown Source)
     at com.jcraft.jsch.Session.connect(Unknown Source)
     at coldfusion.tagext.net.SftpHandler.getConnection(SftpHandler.java:265)
     at coldfusion.tagext.net.SftpHandler.createConnection(SftpHandler.java:76)
     at coldfusion.tagext.net.FtpTag.doStartTag(FtpTag.java:675)
     at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2722)
     at cfsftp2ecfm1948882534.runPage(/Applications/ColdFusion9/wwwroot/test/sftp.cfm:12)
     at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231)
     at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416)
     at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
     at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:363)
     at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
     at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
     at coldfusion.filter.PathFilter.invoke(PathFilter.java:87)
     at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
     at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
     at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
     at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
     at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
     at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
     at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:53)
     at coldfusion.CfmServlet.service(CfmServlet.java:200)
     at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
     at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
     at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
     at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
     at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
     at jrun.servlet.FilterChain.service(FilterChain.java:101)
     at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
     at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
     at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
     at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
     at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
     at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
     at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
     at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
     at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

I've tried running this from both a Mac and Windows platform.

Incidentally, I also took the example from the Adobe Coldfusion 9 live docs and got the same error.

If I can't get this to work then it's a show stopper for the use of CF within our environment.

Best Regards,

Carl Bourne

Message was edited by: CarlB  Just tried using the above to connect to a SSH (SSH-2.0-OpenSSH_5.2) server running on MAC OSX. I got the same error.

9.5K
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 ,
Oct 18, 2009 Oct 18, 2009
server = "10.1.3.43"

And when you use the form server = "ftp.myserver.com"?

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
Participant ,
Nov 01, 2009 Nov 01, 2009

I'm having the same issue. Did you ever get this working? Did changing the IP address to the domain name work?

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
New Here ,
Nov 30, 2009 Nov 30, 2009

has this been fixed yet, as I am getting same 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
New Here ,
Dec 01, 2009 Dec 01, 2009
check jsch library version, read this for details:

I replaced my jsch.jar with com.jcraft.jsch_0.1.32.jar from the post above:

Created an attachment (id=60352) [details]
This jar will specify "SunJCE" explicitly in using JCE API.

The attached jar will specify the JCE provider name "SunJCE" in
getting JCE instances.  You have thought that you have only used the default
JCE provider and you may feel it is just a waste of time,
but please try it if possible.

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
Participant ,
Dec 01, 2009 Dec 01, 2009

That did not fix my problem specifically, but it is related, and it gave me enough insight to find a work-around without changing jar files.

It seems that ColdFusion loads "com.rsa.jsafe.provider.JsafeJCE" as the default security provider at startup. Perhaps there is something wrong with this provider like the “BC” provider mentioned in your link. Working with that, I was able to dump my providers into an array where the first array position represents the default provider and shows JsafeJCE as the default:


<cfset providerMethods = CreateObject('java','java.security.Security')>

You can dump the providers:

<cfdump var="#providerMethods.getProviders()#">

I then made a copy of the provider like:

<cfset jSafeProvider = providerMethods.getProvider('JsafeJCE')>

I then removed it from the provider array:

<cfset providerMethods.removeProvider('JsafeJCE')>

I then made my sFTP call and this time it was successful.

<cfftp action="open"

            secure="true”…

I then put the provider back into the array in position 1 – the default:

<cfset providerMethods.insertProviderAt(jSafeProvider,1)>

I can’t say I know exactly what’s wrong and I certainly don’t want to remove the JsafeJCE provider from the default position for forever. I’ll let Adobe come up with a true fix, but for now, this provides me with a work-around so I can use sFTP. I’m sure JsageJCE is used/required for some other encryption, so you’ll have to watch for other issues while it’s not part of the provider array. The quicker you can get it out/in, probably the better. My sFTP only runs a few times, so I feel OK with the possible side effects. Maybe someone can take it from here and find a better solution and not a simple work-around.

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
New Here ,
Oct 02, 2010 Oct 02, 2010

Thanks Neo! - your work-around saved my project.  Running CF 9.0.1 and couldn't connect for nothing.  I added your code and it connects as expected.  I unfortunately lost the jSafeProvider during an error on the cfftp "open" tag, so the Provider was not written back as the default.  Now I get jSafeProvider not defined error.  Anyway to recover that?

Thanks again for posting your work-around.

Mark

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
Guest
Oct 06, 2010 Oct 06, 2010

Just store the provider a a variable before you remove it and add it back in after the operation is complete.

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
New Here ,
Oct 11, 2010 Oct 11, 2010

Hey Mark,

If you loose jSafeProvider because of errors happening before re-adding it to the provider list, you can restart your ColdFusion service and it should appear again.

Cheers,

Tom

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
Advocate ,
Dec 04, 2012 Dec 04, 2012

Thanks Neo!  That was exactly what I needed to.

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
Participant ,
Dec 04, 2012 Dec 04, 2012
LATEST

This has been fixed in CF10 and sFTP works with no issues or work-around's, so just comment your code so you can remove it when you upgrade....

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
New Here ,
Feb 06, 2011 Feb 06, 2011

Thanks Mark your a life saver...

Asen..

http://nikolov.com.au

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