Forum OpenACS Q&A: ns_java problem

Collapse
Posted by amit singh on
I am using openacs3.2.5 on RH7.2. I have installed jdk118_v3,
nsjava-1.0.4, qmail-1.03 and webmail. My problem
is whenever i try to send a mail it gives me an error "invalid command
ns_java". My log shows that ns_java is enabled. What is missing or
where am i going wrong?

Can anyone help me?

Collapse
Posted by Dan Wickstrom on
I've changed ns_java significantly since I ported webmail, and the command interface no longer supports the original ns_java command. To emulate the old command using nsjava version 1.0.0 or greater, add the something like the following (untested) in webmail-defs.tcl

if ![string length [info commands ns_java]] {
    proc ns_java { args } {
        set i 0
        if [string equal [lindex $args 0] -detach] {
            incr i
        }
        foreach {class dummy method} [split [lindex $args $i] ::] break
        set size [expr [llength $args] - $i - 1]
        set iargs [nsjava::new {String[]} $size]
        for {incr i} {$i < [llength $args]} {incr i} {
            $iargs set $i [lindex $args $i]
        }
        nsjava::call $class [list $method {String[]}] $iargs
    }
}

I will add this into the 3.2.x sources.

Collapse
Posted by amit singh on
Thanks I got rid of the previous error now I get
An error occured while we attempted to compose your message: 

can't read "arg": no such variable
Collapse
Posted by amit singh on
aolserver log
14/Sep/2002:14:24:58][2497.7176][-sched:102-] Notice: registerTclJavaFunctions: registering commands
Notice: Running scheduled proc wm_process_queue...
[14/Sep/2002:14:24:58][2497.7176][-sched:102-] Debug: NsJava_GetThreadEnv: attach to JVM 
[14/Sep/2002:14:24:58][2497.7176][-sched:102-] Debug: NsJava_GetThreadEnv: attach to JVM worked
[14/Sep/2002:14:24:58][2497.7176][-sched:102-] Debug: NsJava_GetThreadEnv: save env 136102516 tid = 7176
[Loaded nsjava/internal/Commands.class from /var/lib/aolserver/bin/nsjava.jar]
[Loaded java/lang/Long.class from /usr/java/jdk118_v3/lib/classes.zip]
[Loaded nsjava/NsLog.class from /var/lib/aolserver/bin/nsjava.jar]
[Loaded java/lang/Runtime.class from /usr/java/jdk118_v3/lib/classes.zip]
[Loaded nsjava/internal/TclString.class from /var/lib/aolserver/bin/nsjava.jar]
[Loaded nsjava/internal/InternalRep.class from /var/lib/aolserver/bin/nsjava.jar]
[Loaded nsjava/internal/TclObject.class from /var/lib/aolserver/bin/nsjava.jar]
[Loaded nsjava/internal/TclList.class from /var/lib/aolserver/bin/nsjava.jar]
[Loaded java/util/Vector.class from /usr/java/jdk118_v3/lib/classes.zip]
[Loaded nsjava/internal/Util.class from /var/lib/aolserver/bin/nsjava.jar]
[Loaded nsjava/internal/FindElemResult.class from /var/lib/aolserver/bin/nsjava.jar]
[Loaded java/lang/ClassNotFoundException.class from /usr/java/jdk118_v3/lib/classes.zip]
[Loaded nsjava/internal/TclInteger.class from /var/lib/aolserver/bin/nsjava.jar]
[Loaded nsjava/internal/TclBoolean.class from /var/lib/aolserver/bin/nsjava.jar]
[Loaded nsjava/internal/StrtoulResult.class from /var/lib/aolserver/bin/nsjava.jar]
[Loaded java/lang/reflect/Array.class from /usr/java/jdk118_v3/lib/classes.zip]
[Loaded nsjava/internal/Interp.class from /var/lib/aolserver/bin/nsjava.jar]
[Loaded java/lang/Boolean.class from /usr/java/jdk118_v3/lib/classes.zip]
[Loaded java/lang/Float.class from /usr/java/jdk118_v3/lib/classes.zip]
[Loaded java/lang/Double.class from /usr/java/jdk118_v3/lib/classes.zip]
[Loaded java/lang/Byte.class from /usr/java/jdk118_v3/lib/classes.zip]
[Loaded java/lang/Short.class from /usr/java/jdk118_v3/lib/classes.zip]
[Loaded java/lang/Void.class from /usr/java/jdk118_v3/lib/classes.zip]
Error: can't read "arg": no such variable
Notice: Done running scheduled proc wm_process_queue.


[14/Sep/2002:14:25:17][2497.8200][-conn0-] Notice: Querying 'select creation_user
from wm_outgoing_messages
where outgoing_msg_id = 31;'
[14/Sep/2002:14:25:17][2497.8200][-conn0-] Notice: dbinit: sql(localhost::balaton): 'select creation_user
from wm_outgoing_messages
where outgoing_msg_id = 31'
[14/Sep/2002:14:25:17][2497.8200][-conn0-] Notice: Querying 'begin transaction;'
[14/Sep/2002:14:25:17][2497.8200][-conn0-] Notice: Ns_PgExec: Entering transaction
[14/Sep/2002:14:25:17][2497.8200][-conn0-] Notice: dbinit: sql(localhost::balaton): 'begin transaction'
[14/Sep/2002:14:25:17][2497.8200][-conn0-] Debug: NsJava_GetThreadEnv: attach to JVM 
[14/Sep/2002:14:25:17][2497.8200][-conn0-] Debug: NsJava_GetThreadEnv: attach to JVM worked
[14/Sep/2002:14:25:17][2497.8200][-conn0-] Debug: NsJava_GetThreadEnv: save env 143462460 tid = 8200
Notice: error: can't read "arg": no such variable
[14/Sep/2002:14:25:17][2497.8200][-conn0-] Notice: Querying 'abort transaction;'
[14/Sep/2002:14:25:17][2497.8200][-conn0-] Notice: Ns_PgExec: Rolling back transaction
[14/Sep/2002:14:25:17][2497.8200][-conn0-] Notice: dbinit: sql(localhost::balaton): 'abort transaction'
202.88.148.231 - - [14/Sep/2002:14:25:17 +0530] "GET /webmail/message-send-3.tcl?outgoing_msg_id=31&response_to_msg_id= HTTP/1.0" 500 2084 "http://.dyndns.org:8050/webmail/message-send-2.tcl" "Mozilla/4.78 [en] (X11; U; Linux 2.4.7-10 i686)"
[14/Sep/2002:14:25:19][2497.8200][-conn0-] Notice: Querying 'select creation_user
from wm_outgoing_messages
where outgoing_msg_id = 31;'

Collapse
Posted by amit singh on
I am using the latest webmail-defs.tcl from the CVS which has the following code added

<pre>
# if ![string length [info commands ns_java]] {
#    proc ns_java { args } {
#        set i 0
#        if [string equal [lindex $args 0] -detach] {
#            incr i
#        }
#        foreach {class method} [split [lindex $args $i] ::] break
#        set size [expr [llength $args] - $i - 1]
#        set iargs [nsjava::new {String[]} $size]
#        for {incr i} {$i < [llength $args]} {incr i} {
#            $iargs set $i $arg
#        }
#        nsjava::call $class [list $method {String[]}] $iargs
#    }
#}

In line number 11 i changed $arg to $args and got rid of the prevoius error but now i get

"
n error occured while we attempted to compose your message:

array index "2" is out of bounds: must be between 0 and 1

"

thanks in advance

Collapse
Posted by Dan Wickstrom on
I made a mistake in the work-around code. I've fixed it, so please update from cvs and try again.
Collapse
Posted by amit singh on
Thanks Dan I have a fully functional webmail now.
Collapse
Posted by David Kuczek on
Amit,

could you put together a HowTo on setting up webmail for 3.2.5... I might be interested to test it on my own system. Do you know anything about webmail on 4.x?

Collapse
Posted by Dan Wickstrom on
Webmail on 4.x depends on java in oracle and it hasn't been ported to work on postgresql.  I'm considering porting it, but I need to finish up a few other things like my part in the 4.6 release and the integration of ispell dictionaries and snowball stemmers with openfts.

If I do port it, I'm considering adding oracle support to nsjava.  I will then refactor the webmail code to eliminate the java in oracle dependency.

On the other hand, I might just add in service contract support to webmail and setup the postgresql version to use nsjava for mail parsing.  For oracle, the mail parsing can remain in the db, as it exists now.