Need help on FastAGI-asterisk java

Hi All,

I need help on asterisk java AGI integration. I am taking the reference from: [color=blue][/color] for FastAGI.

Scenario is:

  1. calling from 2000 to 3000 on asterisk.
  2. from the dial plan call a AGI script.
  3. in the script using java code i am printing something and using external jar for the some purpose.
    like mail.jar


I am [color=red]able to call [/color]the java code from asterisk using FastAGI
Normal Script is running fine and printing whatever is directed in the streamfile() method.


in the java code i am taking the reference of some externam APIs, say [color=red]mail.jar [/color]i am using.
on the UNIX system when i am setting the classpath, compiling and running is fine for the
java code.
But when the same script is been run from the Asterisk, it gives error as follows:

[color=red]Sep 9, 2008 12:00:47 PM org.asteriskjava.fastagi.DefaultAgiServer startup
INFO: Received connection from /
Exception in thread “Asterisk-Java DaemonPool-1-thread-1” java.lang.NoClassDefFoundError: javax/mail/Service
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at org.asteriskjava.fastagi.AbstractMappingStrategy.createAgiScriptInstance([/color]
I know this error is only that FastAGI server is not getting the reference to the mail.jar
I have included this jar into the same folder where the java code is running as well as in the library folder too. I have set the CLASSPATH on the unix end, and if i run the code only from unix things works fine for me.
But gives problem when run by Asterisk - FastAGI.

Please give me any helping pointer, if someone had already done something on this.

vishal bhardwaj.