cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
183
Views
0
Helpful
0
Comments
cdnadmin
Community Member
This document was generated from CDN thread

Created by: Michel Henault-Ethier on 10-03-2009 01:36:28 PM
Hi,
 
I in a onStartCall method (onStartCall(CallStartAPI callStartData)) I instantiate a new object call and place it in Application Data.  I can retrieve it in a new object in the same class without any problem as folloews:
 

<font size="2">
callStartData.getApplicationAPI().setApplicationData(
</font>
"CallInfo", new Call("1111", "2222", "3333"));<font size="2">
Call tempCall = (Call)callStartData.getApplicationAPI().getApplicationData(
</font>
"CallInfo");


However, when I try to get this object in another class extending DecisionElementBase in  method
doDecision(String name, DecisionElementData data) using the same code:
 

Call CallInfo = (Call)data.getApplicationAPI().getApplicationData("CallInfo");

 
 I get a casting exception.
 
I am running the code in the Call Studio Debug and not on a VXML server.
 
I have tried the same thing using the session scope with the same result:

java.lang.ClassCastException: Call
at decisionNextMenu.doDecision(decisionNextMenu.java:46)

 
Any idea why I can't pass objects between classes using either the application or session scope?
 
By the way I have tried using simple String and it works fiine...
 
Thanks
 
Mike

Subject: RE: Passing objects between classes using application or sesion scope
Replied by: Ranjana Narayan on 11-03-2009 05:52:28 AM
Hi Mike,

Workaround to escape this exception is to place your Call.class file under Cisco\CVP\VXMLServer\common\lib (if using VXML Server), else if you are working on Studio Debug, place the class under
Cisco\CallStudio\eclipse\plugins\com.audiumcorp.studio.debug.runtime_<x.y.z>\AUDIUM_HOME\common\classes\.
For all java objects that you store in the session (session data/ global data/ application data), make sure that the coresponding class is available at the common/lib to avoid ClassCastException.


Hope this helps,
Ranjana Narayan.

Subject: RE: Passing objects between classes using application or sesion scope
Replied by: Michel Henault-Ethier on 11-03-2009 02:37:45 PM
Hi Ranjana,
 
All is working fine now.
 
Thanks for the help.
 
Mike

Subject: RE: Passing objects between classes using application or sesion scope
Replied by: Randall Kirchner on 26-06-2009 06:39:38 PM
Hi Mike,

Workaround to escape this exception is to place your Call.class file under Cisco\CVP\VXMLServer\common\lib (if using VXML Server), else if you are working on Studio Debug, place the class under
Cisco\CallStudio\eclipse\plugins\com.audiumcorp.studio.debug.runtime_<x.y.z>\AUDIUM_HOME\common\classes\.
For all java objects that you store in the session (session data/ global data/ application data), make sure that the coresponding class is available at the common/lib to avoid ClassCastException.


Hope this helps,
Ranjana Narayan.


Hi,  I am having the same problem, but the fix you describe is not working for me.  I have a StartUp java class that reads a comma delimited text file and creates a CallInfo object from each line.  Then it puts each CallInfo object into a HashMap.
 
In my Studio script then I can successfully get the HashMap out of session, but when I try to retrieve a CallInfo object out of the HashMap and cast it, I get ClassCastException.  If I just retrieve it as an Object and call obj.getClass().getName() it tells me that it is a CallInfo object.  So why can't I get it to cast?
 
Thanks,
 
Randy
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links