Heads Up :
The post you are writing will appear in a public forum. Please ensure all content is appropriate for public consumption. Review the employee guidelines for the community here.
Created by: Ryan Hilfers on 26-06-2013 12:16:52 PM Hi all,
Struggling with this one. I have made my own class (CustomClass) and upon startup of an applicaiton, parse a file, instantiate this custom object, fill in some fields via the constructor and store it in application data.
I.e.
CustomClass cc = new CustomClass(file.txt); api.setApplicationData("myOb", cc); //api == ApplicationStartAPI object
Later, when a call comes through and executes the doDecision method. I try to grab that object from memory and cast it to my custom class type
CustomClass cc = (CustomClass) data.getApplicationAPI().getApplicationData("myOb");
This throws a ClassCastException. Research seems to point to a separate classloaders causing this but I do not understand it. The class file is local to the application in java/application/classes/..
Per the programming guide. Each application is loaded into memory by a separate classloader. What am I missing? Has anyone had this problem before?
EDIT: Fixed a typo ct -> cc
Subject: RE: ClassCastException from app data Replied by: Janine Graves on 28-06-2013 08:18:46 AM I haven't had a chance to try this yet, but the workaround for now is to put your custom class in VxmlServer/common directory.
Subject: RE: ClassCastException from app data Replied by: Ryan Hilfers on 02-07-2013 05:38:29 PM
Janine Graves:
I haven't had a chance to try this yet, but the workaround for now is to put your custom class in VxmlServer/common directory.
Janine,
Thanks for your reply. I finally have a chance to get back to this. I did end up trying to move the class files around and found common dir did resolve this issue with one caveat; If you run updateCommonClasses.bat then the same ClassCastexception turns up unless you also run updateApp.bat! Apparently there's some classloader chaos going on in the background.
I really want to understand this one better but happy to find it works using common *sorta.
I attached my project which I made to point out this bug/exception specifically.
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: