[Freeswitch-users] Mod_java loading error
solko at gcdf.pl
Wed Apr 15 00:40:15 PDT 2009
> Now i can able to load the mod_java in the freeswitch console.
> After that i have followed these method to run the PhoneTest.java
> *1) verified my classpath in the java.conf.xml: <option
> *2)my PhoneTest.class is located in /usr/local/freeswitch/script -
> directory, same as where freeswitch.jar is located*
> *3) I created PhoneTest.jar file from PhoneTest.class*
> *4)changed my dialplan to: <action application="java"
> data="/usr/local/freeswitch/scripts/PhoneTest.jar PhoneTest arg1 arg2
> Then i have complied and Run the PhoneTest.java by this methods
> **[localhost scripts]# javac -cp freeswitch.jar PhoneTest.java
> [localhost scripts]# java -cp freeswitch.jar PhoneTest
> Exception in thread "main" java.lang.NoClassDefFoundError: PhoneTest
> Caused by: java.lang.ClassNotFoundException: PhoneTest
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> **[localhost scripts]# javac -cp PhoneTest.jar:freeswitch.jar PhoneTest.java
> [localhost scripts]# java -cp PhoneTest.jar:freeswitch.jar PhoneTest
> Exception in thread "main" java.lang.NoSuchMethodError: main
> But I get these above errors .So Please Correct me where i am wrong and
> assist me how to compile and run the PhoneTest.java.
I think you need some extra training about Java.
First of all to run Java application you need to add all classes in classpath, so in your first method you forgot to adde
PhoneTest.jar to it, it is wrong, You did not mention that you pack it to jar I assume you did it.
Second method is good but does PhoneTest.java have main method? If you wanted to run it in freeswitch then it does not have main
method so it cannot be started as standalone application.
Why are you trying to run it as standalone application?
What are you trying to do? Why did you pick Java for it? Next time attach java files to mails (of course if they are not to huge).
> Warm Regards,
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
More information about the FreeSWITCH-users