Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

No Custom Class in CVP Session?


I feel a little like I've just moved into The Twilight Zone here - is this a newbie question?

In my CVP VXML application, I have 2 custom elements that use a custom class.  In the beginning of the call flow, I create an instance of the class, assign it to session, and then later in the call flow I retrieve it from session.

CustomObject myAmazingObject = new CustomObject();

actionData.setSessionData("amazingObject", myAmazingObject);

When the object is retrieved from session, I got a ClassCastException when retrieving it, so I added some slightly more defensive code:

CustomObject existingObject = null; //(CustomObject) actionData.getSessionData("amazingObject");

Object anObject = actionData.getSessionData("amazingObject");

System.out.println( "THE OBJECT IS: " + anObject.getClass().getName() );

if( anObject instanceof CustomObject )

     existingObject = (CustomObject) anObject;

What I'm wondering is, why the full classname is printed correctly in the logs but the instanceof test fails!

What I need to find out is what needs to happen in order to be able to store/retrieve user-defined classes in the CVP session.  Is there a reason this would not be possible?  Strings work fine, more "creative" objects seem to be disallowed...

Does the jar containing the object need to be in a special place maybe?



Everyone's tags (5)
New Member

No Custom Class in CVP Session?

Apparently what happened here is a side-effect of the "Magical Cache Syndrome".  :-) 

It appears as though Eclipse or the CVP plugins creates a serialized cache of any jars added to a CVP Studio Project, and there may be a test in the caching mechanism that does not update the cache if only the serialVersionUID changes.  Thus the package+class name is the same, but the runtime instance becomes incompatible.  Maybe?

Changing the package name of the object, rebuilding, redeploying, fixed the issue.

Then again, it may not be a builder issue.  It may also be a Tomcat session issue (it uses serialization when bouncing to retain data), though with no active callers in the test environment I'm not sure why Tomcat would even retain a session, and wouldn't the "updateApp" command clobber it?

Does anyone have any detailed technical information on how this entire mechanism works?  I only like magic tricks I can fully explain... :-)




No Custom Class in CVP Session?

I've never had an issue with this. But I keep it very simple.

I don't allow Eclipse to hand off the jars to the server, and I don't have any in-line Java code within the project. I just use custom elements that go into the Element palette. I use custom classes only (not JAR'd) in server/common/classes and third-part JARs in server/common/lib.



CreatePlease to create content