Forum OpenACS Q&A: nsjava improvements available

Collapse
Posted by Jonathan Ellis on
I've extended nsjava to allow static methods returning Strings from java. First application is including an exec replacement that works when nsjava is loaded; the builtin tcl exec gets frustrated by nsjava's signal handler and dies. I've also fixed some memory leaks in the old invocation code.

uploaded to new-file-storage

details for people familiar with the code

  • includes my last patch for fixing running with JDK >= 1.2
  • added CallJava.java
  • CallJava does some of the work that was done in C before; also the ability to find methods returning Strings; fixed memory leaks in remaining NsJava_JavaEvalCmd code
  • added ExecCmd.java and nsjava.tcl for the nsd library that handles the replacing of the builtin exec
  • rm'd the unused remnants of envcache.c
  • added evalSingle static method to NsTcl.java; handy when the NsTcl object isn't going to be re-used
  • updated tcl-api in doc/ (but didn't rerun javadoc for NsTcl)
Collapse
Posted by Vlad Seryakov on
i was trying to run it with Blackdown JDK13, i set classpath but i cannot run any java class.
i looked into sources and noticed that for jdk > 1.1 init module
doesn't use classpath param from nsd.tcl.

8/Apr/2002:16:18:37][7647.14350][-nscp:1-] Debug: RegisterTclJavaFunctions: registering ns_java cmd

[28/Apr/2002:16:18:47][7647.14350][-nscp:1-] Debug: GetThreadEnv: attach to JVM

[28/Apr/2002:16:18:47][7647.14350][-nscp:1-] Notice: GetThreadEnv: attach to JVM worked

[28/Apr/2002:16:18:47][7647.14350][-nscp:1-] Debug: GetThreadEnv: save env 142510660 tid = 14350

[28/Apr/2002:16:18:47][7647.14350][-nscp:1-] Error: could not find nsjava.CallJava class

[28/Apr/2002:16:18:47][7647.14350][-nscp:1-] Error: could not find nsjava.CallJava class

[28/Apr/2002:16:18:47][7647.14350][-nscp:1-] Error: JavaEvalCmd: couldn't look up callStaticMethod

[28/Apr/2002:16:18:47][7647.14350][-nscp:1-] Error: JavaEvalCmd: couldn't look up callStaticMethod
Args:
ns_java
test::test

Collapse
Posted by Jonathan Ellis on
from the README:
for JNI 1.2, specify any JVM options directly, e.g.:
JavaOption="-Djava.class.path=/home/aolserver/bin/nsjava.jar:/web/prod/www/jbe_java"
JavaOption="-verbose:class"
JavaOption="-verbose:jni"
JavaOption="-verbose:gc"
(jni docs say "-verbose:class,jni,gc" is shorthand for the above 3 but it doesn't
actually work.)
JavaOption="-Xrs"
Collapse
Posted by Vlad Seryakov on
Thank you
i just started to look in Java/Jni specs, you saved me some time.
May be it would be nice to have some nsd.tcl examples included in the
distribution for different JDK.

also, when i typed just ns_java without any arguments the server crashed,
i will try to run it inside gdb to catch the problem.