Forum OpenACS Q&A: Java Module NOT Enabled

Collapse
Posted by Jason Tauber on
Can anybody please help with this problem?  I'm trying to setup
webmail which requires the nsjava module to be enabled.  I can't get
java to be enabled no matter what I do.  I'm running AOLserver 3.2
with openacs 3.2.5 and postgreSQL 7.1.  I'm sure its something
obvious that I've overlooked, so if somebody can offer some advice, I
would greatly appreciate it.  I included a part of my server.log
below:

[03/Aug/2001:20:29:55][1471.1024][-main-] Notice: modload:
loading '/usr/local/aolserver/bin/nscgi.so'

[03/Aug/2001:20:29:55][1471.1024][-main-] Notice: modload:
loading '/usr/local/aolserver/bin/libnsjava.so'

[03/Aug/2001:20:29:55][1471.1024][-main-] Notice: ModuleInit: Java
Module NOT enabled

[03/Aug/2001:20:29:55][1471.1024][-main-] Notice: modload:
loading '/usr/local/aolserver/bin/nscp.so'

[03/Aug/2001:20:29:55][1471.1024][-main-] Error: nscp: could not
listen on 127.0.0.1:9999

[03/Aug/2001:20:29:55][1471.1024][-main-] Error: modload: failed to
load '/usr/local/aolserver/bin/nscp.so': 'Ns_ModuleInit' returne
d -1

[03/Aug/2001:20:29:55][1471.1024][-main-] Fatal: modload: failed to
load module '/usr/local/aolserver/bin/nscp.so'

If somebody could also point out what causes 'Ns_ModuleInit'
returned -1, I would appreciate it.  A part of my server.tcl and
nsd.tcl are below also if they're needed:

ns_section "ns/server/acs-pg/module/nsjava"

ns_param  EnableJava          "on"  ;# Set to on to enable nsjava.

ns_param  VerboseJvm          "off"  ;# Same as command line -debug.

ns_param  LogLevel            "Notice"

ns_param  DestroyJvm          "on"  ;# Destroy jvm on shutdown.

ns_param  DisableJITCompiler  "off"

ns_param  ClassPath "/usr/lib/ibm-
java/jdk118/lib/classes.zip:/usr/local/aolserver/bin/nsjava.jar:/usr/l
ocal/aolserver/bin/activation.jar:/usr/local/aolserver/bin/mail.jar:/w
eb/stirling/www/webmail/java"

and heres my server.tcl file:

ns_section ns/server/${server}/acs/webmail

        # This module requires the aolserver module nsjava.
# See http://nsjava.sourceforge.net

        ns_param WebmailEnabledP 1

It seems to me that these are the 2 places you should enable
webmail.  On top of this, I did all the preliminary steps for
configuring webmail such as installing nsjava-0.0.9 successfully and
copying mail.jar, activation.jar, nsjava.jar, and libnsjava.so into
my /usr/local/aolserver/bin directory.  There must be something I've
overlooked, please help.

Thanks

-Jason Tauber

Collapse
Posted by Jonathan Marsden on
I can't help with the Java stuff, but the nscp issue looks like the server couldn't bind to 127.0.0.1:9999... the error was:

Error: nscp: could not listen on 127.0.0.1:9999

(a) Did you really intend to use nscp?  If not, comment it out in nsd.tcl, or ensure nscp_user is set to "".

(b) If you want it to run, check that the nscp user and password are set the way you want them to be.  The default in 3.2.5 should be not to try and load nscp.so at all.

(c) Could something else be already bound to 127.0.0.1:9999?  Another instance of nsd, for instance?  Use netstat -nl to check this.  If so, changing the nscp port to some other number (9998 maybe) should help.

(d) Lastly... you do have a correctly configured loopback interface at 127.0.0.1 on your server?  Might be worth checking as a last resort!

Collapse
Posted by Dan Wickstrom on
Is your server name really acs-pg?  In the "ns/server/acs-pg/module/nsjava" section you have the server name as acs-pg, while in the "ns/server/${server}/acs/webmail" section, your server name is a tcl variable.  I suspect that the two are different, and if that's the case, then the nsjava module won't load.
Collapse
Posted by Jason Tauber on
Thanks for the help, I now get the following message in my server log:

[08/Aug/2001:12:52:49][17503.1024][-main-] Notice: modload: loading '/usr/local/aolserver/bin/libnsjava.so'

[08/Aug/2001:12:52:49][17503.1024][-main-] Notice: ModuleInit: Java Module ENABLED

[08/Aug/2001:12:52:50][17503.1024][-main-] Notice: ModuleInit: JVM init succeeded!

I have libnsjava.so in my /usr/local/aolserver/bin directory and its specified as my bin dir and its also included in my LD_LIBRARY_PATH, but I still get this message:

[08/Aug/2001:12:53:51][17503.6151][-sched:87-] Notice: Running scheduled proc wm_process_queue...

libnsjava.so: cannot open shared object file: No such file or directory (libnsjava.so)

java.lang.UnsatisfiedLinkError: no nsjava in shared library path
        at java.lang.LinkageError.<init>(Compiled Code)
        at java.lang.UnsatisfiedLinkError.<init>(Compiled Code)
        at java.lang.Runtime.loadLibrary(Compiled Code)
        at java.lang.System.loadLibrary(Compiled Code)
        at
        at MessageParser.process_queue(Compiled Code)

[08/Aug/2001:12:53:51][17503.6151][-sched:87-] Error: JavaEvalCmd:  Java exception occured:

[08/Aug/2001:12:53:51][17503.6151][-sched:87-] Error: JavaEvalCmd:  Java exception occured:

Args:
ns_java
-detach
MessageParser::process_queue
/usr/local/aolserver/qmail/queue/

[08/Aug/2001:12:53:51][17503.6151][-sched:87-] Notice: Done running scheduled proc wm_process_queue.
[08/Aug/2001:12:54:51][17503.7175][-sched:87-] Notice: Running scheduled proc wm_process_queue...
java.lang.NoClassDefFoundError: nsjava/NsLog

Is there a reason why it can't find libnsjava.so?  This webmail thing is getting to be a real hassle but it's the most important part of openacs that I want running.  Thanks for all the help Dan, you've helped me get pretty far but I'm not there yet.

Thanks again

-Jason Tauber

Collapse
Posted by Dan Wickstrom on
Yes, setting up webmail is a real hassle.  Even thought you have your LD_LIBRARY_PATH set, it's still complaining that it can't find the library to load it.  Maybe there's a typo in your LD_LIBRARY_PATH.  What do you have it set to?  Also, do you have your CLASSPATH variable set correctly in your nsd.tcl file?
Collapse
Posted by Jason Tauber on
Here is my classpath in nsd.tcl:

ns_section "ns/server/${server}/module/nsjava"
        ns_param  EnableJava          "on"  ;# Set to on to enable nsjava.
        ns_param  VerboseJvm          "off"  ;# Same as command line -debug.
        ns_param  LogLevel            "Notice"
        ns_param  DestroyJvm          "on"  ;# Destroy jvm on shutdown.
        ns_param  DisableJITCompiler  "off"

        ns_param  ClassPath "/usr/lib/ibm-java/jdk118/lib/classes.zip:/usr/local/aolserver/bin/nsjava.jar:/usr/local/aolserver/bin/
activation.jar:/usr/local/aolserver/bin/mail.jar:/web/stirling/www/webmail/java:/usr/local/aolserver/bin/libnsjava.so"

I included /usr/local/aolserver/bin/libnsjava.so in the classpath to try and trouble shoot the problem but it didn't fix it.  I know libnsjava.so is in that directory so this is really strange.

Here is my LD_LIBRARY_PATH in /etc/profile, is this the only place you have to set it?  I'm not sure.

# used to load postgreSQL libraries and java libraries

LD_LIBRARY_PATH=/usr/local/pgsql/lib:/usr/lib/ibm-java/jdk118/lib/linux/native_threads:/usr/local/aolserver/bin
export LD_LIBRARY_PATH

I really appreciate your quick responses Dan.  I will have a huge celebration when this gets working! :) You will definitely be invited.

Collapse
Posted by Jason Tauber on
I forgot about the /etc/ld.so.conf file, sorry!  I placed the location  of libnsjava.so there and it worked!  At least the server log didn't report any error messages.  The problem now is that the site stays up for about a minute and then is unable to be reached.  This is what's reported when I run the command ps aux:

nsadmin  17703  0.8  7.7 55748 14944 ?      S    17:18  0:02 /usr/local/aolserver/bin/nsd -it /usr/local/aolserver/nsd.tcl -u nsad

nsadmin  17706  0.0  0.0    0    0 ?        Z    17:18  0:00 [nsd <defunct>]

Could anybody please help and tell me why this is happening and what defunct means?

Collapse
Posted by Dan Wickstrom on
The defunct process, also known as a zombie process is a process that that has exited and has a parent, but has not yet been waited for by the parent process.

The problem you're seeing is probably due to the IBM jdk that you're using. When I tested with it (over a year ago) it would segfault quite often on startup. See http://nsjava.sourceforge.net for a summary of jdk's that I used for testing. For linux, the only jdk that seemed reliable was the blackdown 1.1.8 version.

Collapse
Posted by Jason Tauber on
I switched back to aolserver3.4 and installed nsjava-0.0.10.  I also installed blackdown's jdk1.1.8_v3 to get rid of the segfaults but am now not able to get my server running with java enabled.  I must have not installed the jdk correctly since the server log ends on this entry:

[09/Aug/2001:17:28:52][25414.1024][-main-] Notice: modload: loading '/usr/local/aolserver/bin/libnsjava.so'

[09/Aug/2001:17:28:52][25414.1024][-main-] Notice: ModuleInit: Java Module ENABLED

I think the next entry should be something about the jvm succeeding so  there must be problems with the jvm since aolserver freezes at that point.  The classpath seems to be set fine since I can run the java compiler from the command line.  I don't know where to go from here since the server log doesn't say much.  Maybe somebody can point me in the right direction?

Thanks again

-Jason Tauber

Collapse
Posted by Dan Wickstrom on
Could you send me your nsd.tcl and your aux init file?  I would like to see if I can recreate the problem that you're talking about.  If you send it to me, copy me at mailto:dcwickstrom@earthlink.net.  The mailto:danw@rtp.ericsson.se address is my email address at work, so I won't get your reply if it's late in the day.