How to invoke the other application from cuba


I have to collect inputs from cuba and provide them to other application (may be invoking a rest service from that) and collect the data from that and shows a report in cuba.

While collecting inputs, I am getting ClassCastException - Customer cannot be cast to java.lang.String. Below is my code :

String customer = customerField.getValue();
I tried to invoke a method from another application (copied jar in web-inf/lib), but it’s not working. Can you please help?

Hi Maruthi,

can you share a little more code in order to help you? What type is customerField e.g.?
From the Error message i would assume getValue() returns a Customer Object and you try to cast it to String.


Hi Mario,

Thanks for your reply.

That issue got resolved. customerField is of type LookupField. Can you please help me to integrate cuba with other application? Like I should invoke a rest url from ServiceBean class.


To integrating CUBA with another application (as a HTTP client), you can look at the two examples:

Generally this has nothing to to with CUBA since what you probably want to do is to communicate with a HTTP server in a java program. You can use whatever tools you would like to, e.g. Springs’s RestTemplate or Apache’s HttpComponents.

For a more detailed answer i need a more detailed question :slight_smile:

Hi Mario,

Thanks for your answer. I will check them