Skip to main content
Participating Frequently
November 20, 2010
Question

Stuck on Flex Test Drive Tut, Unable to invoke CFC testdrive_db

  • November 20, 2010
  • 2 replies
  • 2366 views

Hi peoples

I am new to most of this stuff, just so's you know.

I am following the Testdrive tutorial at

http://www.adobe.com/devnet/flex/testdrivemobile/articles/mtd_1_1.html

I have got down to step 7 which states

Test the setup by browsing to http://{your server:your port}/TestDrive/test/test.html. For a default standalone ColdFusion installation, browse to http://localhost:8500/TestDrive/test/test.html. You should see employee data from the database successfully displayed in a datagrid.

I type the following into my ie8 browser

http://localhost:8500/TestDrive/test/test.html

and i get a dialog box with this error message

faultCode:Server.Processing faultString:'Unable to invoke CFC - Datasource testdrive_db could not be found.' faultDetail:'For details, turn on Robust Exception Information in the ColdFusion Administrator'

Oh and a small blank grid? too

Things I have tried/looked at etc

I turned on Robust Exception in the admin page, but don't know if this helps. I don't see any output anywhere.

I have seen flex2gateway errors but when I type localhost/flex2gateway I get the blank page.

I have made the mods in the tutorial regarding setting property cases etc

er I don't actually know how to perform step 6 Restart the Coldfusion server (I rebooted, don't laugh)

If I dbl click the swf file directly under wwwroot/TestDrive/test I get the following error

faultCode:Client.Error.MessageSend faultString:'Send failed' faultDetail:'Channel.Security.Error error Error #2048 url: 'http://localhost/flex2gateway/''

My crossdomain.xml file in the wwwroot folder looks like this

<?xml version="1.0"?>

<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">

<!--Generic policy file for flex app access, it should be made more restrictive -->

<cross-domain-policy>

<site-control permitted-cross-domain-policies="all"/>

<!-- <allow-access-from domain="*.example.com"/> -->

</cross-domain-policy>

I am running Windows 7 64bit

I have installed CF9

Any help is very gratefully received

Ta Tom

This topic has been closed for replies.

2 replies

Community Expert
November 21, 2010

I know you said that the datasource was defined, but since you seem fairly unfamiliar with CF, I hope you won't object to my asking how you verified that. The datasource is in the CF Administrator - it's separate from the database itself.

Double-clicking on the SWF won't work, because that will cause it to be run using a filesystem path, not through an HTTP URL (as it needs to).

The crossdomain.xml file isn't really important here, as all of the URLs needed come from the same domain.

You might try running the CFC directly:

http://localhost:8500/TestDrive/services/EmployeeService.cfc

That URL should redirect to a documentation page, which shows the methods you can call. Then, try rerunning the same CFC with additional URL parameters to execute it directly, something like this:

http://localhost:8500/TestDrive/services/EmployeeService.cfc?method=foo&arg1=bar&arg2=baz (methods and arguments will vary, of course)

Dave Watts, CTO, Fig Leaf Software

http://www.figleaf.com/

http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on

GSA Schedule, and provides the highest caliber vendor-authorized

instruction at our training centers, online, or onsite.

Read this before you post:

http://forums.adobe.com/thread/607238

Dave Watts, Eidolon LLC
MorteliniAuthor
Participating Frequently
November 21, 2010

Hi David

Many thanks for replying. You are correct in that I am unfamiliar with CF. I have database experience and sql. I usually use Toad or DBvisualiser at work to see schemas. I have no idea how to see a schema for this source.

I verified the source in the admin panel and it came back with "OK"

I ran the CFC as suggested (I didn't know you could do this) and it returned the page as expected. I don't know what this proves though (but something is right). As for running the CFC with additional parameters I would appreciate a little help. I suspect you will need to know the methods and columns? parameters?

In total ignorance, I have tried the following: (with http://)

localhost:8500/TestDrive/services/EmployeeService.cfc?method=getEmployeesSummary

localhost:8500/TestDrive/services/EmployeeService.cfc?method=getEmployeesSummary()

localhost:8500/TestDrive/services/EmployeeService.cfc?method=getEmployeesSummary ( )

localhost:8500/TestDrive/services/EmployeeService.cfc?method=getEmployeesByID&1

And the structure from the CFC page

============================================================

getEmployeesByID

remote Struct getEmployeesByID ( required numeric itemID )

Output: suppressed
Parameters:
itemID: numeric, required, itemID

============================================================

getEmployeesSummary

remote Query getEmployeesSummary ( )

Output: suppressed

============================================================

I thought getEmployeesSummary would be easiest as it doesn't appear to expect parameters

I get the hourglass equivalent on the page for each of the above queries

System info

HotFix version (unknown)

OS Windows 7

Webserver Apache 2.2

Database (Don't know, I thought it was ColdFusion)

many thanks

Tom

 

 

 

 

ColdFusion Version

9,0,1,274733

Community Expert
November 21, 2010

To run the CFC methods directly from the browser, you'd specify the arguments (if any exist) as URL parameters.

http://localhost:8500/TestDrive/services/EmployeeService.cfc?method=getEmployeesByID&itemID=1

http://localhost:8500/TestDrive/services/EmployeeService.cfc?method=getEmployeesSummary

Now, having seen some of the code of those methods in your post, I think that you might not see any visual results, so the next step would be to invoke them yourself from CF, then viewing the results. You can do this by writing a new .cfm file, and putting something like this in it:

<cfinvoke webservice="http://localhost:8500/TestDrive/services/EmployeeService.cfc?wsdl"

     method="getEmployeesSummary"

     returnvariable="qEmployees">

<cfdump var="#qEmployees#" label="Employees query">

<cfinvoke webservice="http://localhost:8500/TestDrive/services/EmployeeService.cfc?wsdl"

     method="getEmployeesByID"

     itemID="1"

     returnvariable="qOneEmployee">

<cfdump var="#qOneEmployee#" label="First employee">

I haven't tested this code, so it may be incomplete or in error, but it should be pretty close.

You could also test the database directly by copying a query from one of the CFCs and putting it directly in a .cfm page, dumping the results as shown above, and running that.

> Database (Don't know, I thought it was ColdFusion)

ColdFusion is an application server, not a database. I believe that this tutorial uses Apache Derby, which is a Java database that is installed as part of ColdFusion.

Dave Watts, CTO, Fig Leaf Software

http://www.figleaf.com/

http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on

GSA Schedule, and provides the highest caliber vendor-authorized

instruction at our training centers, online, or onsite.

Read this before you post:

http://forums.adobe.com/thread/607238

Dave Watts, Eidolon LLC
Inspiring
November 20, 2010

The error message says you don't have the data source defined. Do you?

Also: to restart CF, use the Services applet (Windows), or perform some sort of witchcraft (*nix). Haven't used *nix for a while, sorry ;-).

--

Adam

MorteliniAuthor
Participating Frequently
November 20, 2010

Hi Adam

Yes, the datasource is defined and verified

Thanks for the services tip, should have thought have that.

Any suggestions for checking?

ta

Tom

Inspiring
November 20, 2010

Sorry, dunno anything about Flex's integration with CF.  Or indeed anything about Flex at all.

What I'd be doing if faced with this would be to write a CFM template that makes the same CFC call as Flex is doing, and see if you get a better error message.

But I've never seen CF claim a data source doesn't exist when it actually does, though...

--

Adam