./gradlew runExampleClientRPC issue

(Andre Stephenson ) #1

I navigated to the client folder that contains ExampleClientRPC.kt file :

cd src/main/kotlin/com/example/client

Then executed this command :

./gradlew runExampleClientRPC localhost:10004

Yet this was the error I got :

-bash: ./gradlew: No such file or directory

WHEN I ran that command from cordapp-template folder it returned this error :

_eloiim:cordapp-template iivri.andre$ ./gradlew runExampleClientRPC localhost:10004 _

FAILURE: Build failed with an exception.

_ What went wrong:_*
Project ‘localhost’ not found in root project ‘cordapp-template’.

_ Try:_*
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


How is this fixed?

(Rope Trick) #2

Running the command from cordapp-template folder is the right thing to do.
The localhost:10004 parameter is not necessary.
build.gradle file already specifies the argument for the task to be: localhost:10004

If you wish to override the param( say you want to run the RPC client on NodeB or NodeC instead of nodeA) then use -P to pass command line arguments to gradlew:

./gradlew runExampleClientRPC -P localhost:10004

For seeing results, make sure the nodes, controller are up and running:

cd build/nodes ./runnodes

Create a purchase order( so that ClientRPC has data to report):

echo '{"orderNumber": "1","deliveryDate": "2018-09-15","deliveryAddress": {"city": "London","country": "UK"},"items" : [{"name": "widget","amount": "3"},{"name": "thing","amount": "4"}]}' | curl -T - -H 'Content-Type: application/json' http://localhost:10005/api/example/NodeB/create-purchase-order

then test the runExampleClientRPC task:

./gradlew runExampleClientRPC -P localhost:10004

You will see the details of the PO transaction just created.

(Roger Willis) #3

Cheers @ropetrick :slight_smile: