mod_java - java.lang.NoClassDefFoundError
I am encountering the following error when I try to use the mod_java interface: 2007-11-24 18:38:07 [NOTICE] switch_core_state_machine.c:134 switch_core_standard_on_execute() Execute java(fs_ivr arg1 arg2 arg3) Exception in thread "Thread-0" java.lang.NoClassDefFoundError: org/freeswitch/Launcher My dialplan has the following entry: <extension name="Validation_Demo"> <condition field="destination_number" expression="1234"> <action application="java" data="fs_ivr arg1 arg2 arg3"/> </condition> </extension> java.conf.xml has the following entry: <options> <!-- Your class path (make sure freeswitch.jar is on it) --> <option value="- Djava.class.path=/usr/local/freeswitch/scripts/freeswitch.jar"/> <option value="-Djava.class.path=/usr/local/freeswitch/scripts/fs_ivr"/> <!-- Enable remote debugging --> <option value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address= 127.0.0.1:8000"/> </options> I have also tried setting the class path to freeswitch.jar in the CLASSPATH environment variable. export CLASSPATH=/usr/local/freeswitch/scripts/freeswitch.jar. None of the permutations have met with success. Can anyone spot the error I am making? Any ideas on what to try? Jonathan
X-ECN Telecoms-MailScanner-Information: Contact ECN Telecoms X-ECN Telecoms-MailScanner: Found to be clean X-ECN Telecoms-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-97.488, required 6, AWL -0.22, FH_HOST_ALMOST_IP 1.75, RCVD_IN_SORBS_DUL 0.88, RDNS_DYNAMIC 0.10, USER_IN_WHITELIST -100.00) X-ECN Telecoms-MailScanner-From: damjan@ecntelecoms.com X-Spam-Status: No On Sat, 2007-11-24 at 19:46 -0800, jonathan augenstine wrote:
I am encountering the following error when I try to use the mod_java interface:
2007-11-24 18:38:07 [NOTICE] switch_core_state_machine.c:134 switch_core_standard_on_execute() Execute java(fs_ivr arg1 arg2 arg3) Exception in thread "Thread-0" java.lang.NoClassDefFoundError: org/freeswitch/Launcher
My dialplan has the following entry:
<extension name="Validation_Demo"> <condition field="destination_number" expression="1234"> <action application="java" data="fs_ivr arg1 arg2 arg3"/> </condition> </extension>
I'm assuming fs_ivr is a class without a package and outside any jar.
java.conf.xml has the following entry:
<options> <!-- Your class path (make sure freeswitch.jar is on it) --> <option value="-Djava.class.path=/usr/local/freeswitch/scripts/freeswitch.jar"/>
Make sure you have a /usr/local/freeswitch/scripts/freeswitch.jar
<option value="-Djava.class.path=/usr/local/freeswitch/scripts/fs_ivr"/>
This means you have a directory /usr/local/freeswitch/scripts/fs_ivr containing fs_ivr.class. Also I'm not sure if you can have multiple -Djava.class.paths like this (that could be why it isn't finding org/freeswitch/Launcher), you might have to have one colon (:) separated list of paths. This is also why I prefer having JARs by the way, you don't have to set the classpath before running freeswitch and reload mod_java if it changes, and if you overwrite the JAR with a newer version it starts using the newer version for calls made from then on (no dialplan editing required :-).
<!-- Enable remote debugging --> <option value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=MailScanner warning: numerical links are often malicious: 127.0.0.1:8000"/> </options>
I have also tried setting the class path to freeswitch.jar in the CLASSPATH environment variable.
export CLASSPATH=/usr/local/freeswitch/scripts/freeswitch.jar.
The CLASSPATH environment variable is ignored.
None of the permutations have met with success. Can anyone spot the error I am making? Any ideas on what to try?
Sorry it's so confusing, I'll document it better when you get it working.
Jonathan
Damjan
Damjan, Thanks for the reply. I had already worked through the issues of the -D option not allowed twice and CLASSPATH being ignored. I am successfully launching the fs_ivr class (yes, I do intend to use a jar file) but I have hit another snag (see trace below). It appears the app is not finding the native interface library. Where do I declare that path? Jonathan 2007-11-25 23:17:53 [NOTICE] switch_core_state_machine.c:134 switch_core_standard_on_execute() Execute java(fs_ivr arg1 arg2 arg3) Exception in thread "Thread-0" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.freeswitch.Launcher.launch(Launcher.java:80) Caused by: java.lang.UnsatisfiedLinkError: console_log at org.freeswitch.swig.freeswitchJNI.console_log(Native Method) at org.freeswitch.swig.freeswitch.console_log(freeswitch.java:13) at fs_ivr.run(fs_ivr.java:27) ... 5 more 2007-11-25 23:17:53 [NOTICE] switch_core_state_machine.c:184 switch_core_standard_on_execute() Hangup PortAudio/1234 [CS_EXE On Nov 25, 2007 10:35 PM, Damjan Jovanovic <damjan@ecntelecoms.com> wrote:
X-ECN Telecoms-MailScanner-Information: Contact ECN Telecoms X-ECN Telecoms-MailScanner: Found to be clean X-ECN Telecoms-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-97.488, required 6, AWL -0.22, FH_HOST_ALMOST_IP 1.75, RCVD_IN_SORBS_DUL 0.88, RDNS_DYNAMIC 0.10, USER_IN_WHITELIST -100.00) X-ECN Telecoms-MailScanner-From: damjan@ecntelecoms.com X-Spam-Status: No
On Sat, 2007-11-24 at 19:46 -0800, jonathan augenstine wrote:
I am encountering the following error when I try to use the mod_java interface:
2007-11-24 18:38:07 [NOTICE] switch_core_state_machine.c:134 switch_core_standard_on_execute() Execute java(fs_ivr arg1 arg2 arg3) Exception in thread "Thread-0" java.lang.NoClassDefFoundError: org/freeswitch/Launcher
My dialplan has the following entry:
<extension name="Validation_Demo"> <condition field="destination_number" expression="1234"> <action application="java" data="fs_ivr arg1 arg2 arg3"/> </condition> </extension>
I'm assuming fs_ivr is a class without a package and outside any jar.
java.conf.xml has the following entry:
<options> <!-- Your class path (make sure freeswitch.jar is on it) --> <option value="-Djava.class.path=/usr/local/freeswitch/scripts/freeswitch.jar"/>
Make sure you have a /usr/local/freeswitch/scripts/freeswitch.jar
<option value="-Djava.class.path=/usr/local/freeswitch/scripts/fs_ivr"/>
This means you have a directory /usr/local/freeswitch/scripts/fs_ivr containing fs_ivr.class. Also I'm not sure if you can have multiple -Djava.class.paths like this (that could be why it isn't finding org/freeswitch/Launcher), you might have to have one colon (:) separated list of paths. This is also why I prefer having JARs by the way, you don't have to set the classpath before running freeswitch and reload mod_java if it changes, and if you overwrite the JAR with a newer version it starts using the newer version for calls made from then on (no dialplan editing required :-).
<!-- Enable remote debugging --> <option
value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=MailScanner warning: numerical links are often malicious: 127.0.0.1:8000"/>
</options>
I have also tried setting the class path to freeswitch.jar in the CLASSPATH environment variable.
export CLASSPATH=/usr/local/freeswitch/scripts/freeswitch.jar.
The CLASSPATH environment variable is ignored.
None of the permutations have met with success. Can anyone spot the error I am making? Any ideas on what to try?
Sorry it's so confusing, I'll document it better when you get it working.
Jonathan
Damjan
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
X-ECN Telecoms-MailScanner-Information: Contact ECN Telecoms X-ECN Telecoms-MailScanner: Found to be clean X-ECN Telecoms-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-98.357, required 6, AWL 0.61, BAYES_00 -2.60, FH_HOST_ALMOST_IP 1.75, RCVD_IN_PBL 0.91, RCVD_IN_SORBS_DUL 0.88, RDNS_DYNAMIC 0.10, USER_IN_WHITELIST -100.00) X-ECN Telecoms-MailScanner-From: damjan@ecntelecoms.com X-Spam-Status: No On Sun, 2007-11-25 at 23:30 -0800, jonathan augenstine wrote:
Damjan,
Thanks for the reply. I had already worked through the issues of the -D option not allowed twice and CLASSPATH being ignored. I am successfully launching the fs_ivr class (yes, I do intend to use a jar file) but I have hit another snag (see trace below). It appears the app is not finding the native interface library. Where do I declare that path?
It's hardcoded as "-Djava.library.path=" SWITCH_PREFIX_DIR SWITCH_PATH_SEPARATOR "mod". So if you did a ./configure --prefix=/usr/local/freeswitch, it would look for mod_java.so or mod_java.dll in /usr/local/freeswitch/mod. You could try remote debugging at this stage (Netbeans, Run -> Attach debugger) and trace through every method (especially the static constructor) in org.freeswitch.Launcher to see where and how it looks for mod_java and whether it gets loaded.
Jonathan
2007-11-25 23:17:53 [NOTICE] switch_core_state_machine.c:134 switch_core_standard_on_execute() Execute java(fs_ivr arg1 arg2 arg3) Exception in thread "Thread-0" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java :25) at java.lang.reflect.Method.invoke(Method.java:585) at org.freeswitch.Launcher.launch(Launcher.java:80) Caused by: java.lang.UnsatisfiedLinkError: console_log at org.freeswitch.swig.freeswitchJNI.console_log (Native Method) at org.freeswitch.swig.freeswitch.console_log(freeswitch.java:13) at fs_ivr.run(fs_ivr.java:27) ... 5 more 2007-11-25 23:17:53 [NOTICE] switch_core_state_machine.c:184 switch_core_standard_on_execute() Hangup PortAudio/1234 [CS_EXE
Damjan
Damjan, I did as you suggested and used the remote debugging to walk through the static constructor in Launcher. What I discovered was that the constructor was not finding the mod_java.so file. I tried setting java.library.pathexplicity in java.conf.xml and also by rebuilding with -prefix=/usr/local/java. Neither of these solutions were successful. I was able to verify that this was the issue by explicitly entering the library path into the code for the Launcher constructor and running the app. This was successful. I just need to resolve why the System.getProperty("java.library.path") is failing to retrieve the library path. Jonathan On Nov 25, 2007 11:55 PM, Damjan Jovanovic <damjan@ecntelecoms.com> wrote:
X-ECN Telecoms-MailScanner-Information: Contact ECN Telecoms X-ECN Telecoms-MailScanner: Found to be clean X-ECN Telecoms-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-98.357, required 6, AWL 0.61, BAYES_00 -2.60, FH_HOST_ALMOST_IP 1.75, RCVD_IN_PBL 0.91, RCVD_IN_SORBS_DUL 0.88, RDNS_DYNAMIC 0.10, USER_IN_WHITELIST -100.00) X-ECN Telecoms-MailScanner-From: damjan@ecntelecoms.com X-Spam-Status: No
On Sun, 2007-11-25 at 23:30 -0800, jonathan augenstine wrote:
Damjan,
Thanks for the reply. I had already worked through the issues of the -D option not allowed twice and CLASSPATH being ignored. I am successfully launching the fs_ivr class (yes, I do intend to use a jar file) but I have hit another snag (see trace below). It appears the app is not finding the native interface library. Where do I declare that path?
It's hardcoded as "-Djava.library.path=" SWITCH_PREFIX_DIR SWITCH_PATH_SEPARATOR "mod". So if you did a ./configure --prefix=/usr/local/freeswitch, it would look for mod_java.so or mod_java.dll in /usr/local/freeswitch/mod.
You could try remote debugging at this stage (Netbeans, Run -> Attach debugger) and trace through every method (especially the static constructor) in org.freeswitch.Launcher to see where and how it looks for mod_java and whether it gets loaded.
Jonathan
2007-11-25 23:17:53 [NOTICE] switch_core_state_machine.c:134 switch_core_standard_on_execute() Execute java(fs_ivr arg1 arg2 arg3) Exception in thread "Thread-0" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java :25) at java.lang.reflect.Method.invoke(Method.java:585) at org.freeswitch.Launcher.launch(Launcher.java:80) Caused by: java.lang.UnsatisfiedLinkError: console_log at org.freeswitch.swig.freeswitchJNI.console_log (Native Method) at org.freeswitch.swig.freeswitch.console_log(freeswitch.java:13) at fs_ivr.run(fs_ivr.java:27) ... 5 more 2007-11-25 23:17:53 [NOTICE] switch_core_state_machine.c:184 switch_core_standard_on_execute() Hangup PortAudio/1234 [CS_EXE
Damjan
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (2)
-
Damjan Jovanovic
-
jonathan augenstine