cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1034
Views
7
Helpful
4
Replies

CVP 11 Action Element invoking Java Class

MikeHMirt
Beginner
Beginner

I'm looking for a later example / sample to create a java class template to be invoked from an action element.  All I've been able to locate are samples from CVP 9.    I've tried these templates and have run into issues testing within CVP .(Debug)   I've followed the dated (2009) posts but have run into an issue.

Java Code::

package dialog;

import com.audium.server.AudiumException;

import com.audium.server.session.ActionElementData;

import com.audium.server.voiceElement.ActionElementBase;

public class GetDialogs  extends ActionElementBase{

  /**

  * @param args

  */

  public void doAction(String name, ActionElementData data) throws AudiumException {

  // TODO Auto-generated method stub

 

  }

}

Steps followed before failure::

1) Copy the above compiled java class to the studio project deploy->java->application->classes  folder.

2) Create an action setting the "class" drop down, and entering the name class  GetDialogs.  Also, tried dialog.GetDialogs

3) Start a debug session

   At this point I have a failure when the debug session initializes that the above class can't be found due to the wrong name:

  Exception snippet::

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

Caused by: java.lang.NoClassDefFoundError: GetDialogs (wrong name: dialog/GetDialogs)

at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142

Appreciate any advice on how to resolve this issue, or if there is a later set of templates for CVP 11 that I should be following.

1 ACCEPTED SOLUTION

Accepted Solutions

janinegraves
Rising star
Rising star

If you're using a package (your package is named 'dialog'), then you

have to configure the Action element with the package name, in your case

use dialog.GetDialogs

And be sure that you've copied the right structure into the studio app:

appname/deploy/java/application/classes/dialog/GetDialogs.class

NOTE - If you originally had the wrong structure in the studio app

initially:

appname/deploy/java/application/*classes/GetDialogs.class (missing the

package subfolder named dialog)

*

Then you MUST MANUALLY go over to VXMLServer and delete the old

VXMLServer/applications/appname/java/application/*classes/GetDialogs.class

file* - or else it'll still have the class file in the wrong folder (as

deploying from Studio and OAMP only copies things to VXMLServer, never

deletes old files) - preventing it from ever loading in memory correctly.

View solution in original post

4 REPLIES 4

ptindall
Cisco Employee
Cisco Employee

Posted some simple custom action elements yesterday for MediaSense recording control and Mobile Agent CLI fixup.  You could use any of those and the deployment notes as a starting point.

https://t.co/xrqsTg0L60

https://t.co/TC3Y22NVco

I should add that these are for custom elements rather than just a class to invoke from the standard action element, but in my opinion, for the minimal extra work of a few additional methods you get a far better and more easily supported result.

Hi Paul

    Thank you for the attachments.  I've reviewed the contents and will use those as a guide for the time we will creaet custom elements.  For the current need we are inheriting some legacy java code that will be a one time call from the application flow so we will need to resolve the current ERROR for accessing the java class.

Appreciate your advice.

janinegraves
Rising star
Rising star

If you're using a package (your package is named 'dialog'), then you

have to configure the Action element with the package name, in your case

use dialog.GetDialogs

And be sure that you've copied the right structure into the studio app:

appname/deploy/java/application/classes/dialog/GetDialogs.class

NOTE - If you originally had the wrong structure in the studio app

initially:

appname/deploy/java/application/*classes/GetDialogs.class (missing the

package subfolder named dialog)

*

Then you MUST MANUALLY go over to VXMLServer and delete the old

VXMLServer/applications/appname/java/application/*classes/GetDialogs.class

file* - or else it'll still have the class file in the wrong folder (as

deploying from Studio and OAMP only copies things to VXMLServer, never

deletes old files) - preventing it from ever loading in memory correctly.

Hi Janine

   Thank you for taking the time to reply.  Your advice was spot-on and cleared up the issue caused by not defining the proper folder structure under the application class folder.  Once I made that correction the issue was cleared.  We have/had not deployed the application yet, and have only tested within studio, but I've made not of the fact deployed application structure may need to be manually corrected under certain situations. 

  Appreciate your time and help resolving our issue.

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: