Forum OpenACS Q&A: nsjk2 module

Collapse
Posted by Nick Carroll on
Hi, Has anyone used nsjk2 with OpenACS? The nsjk2 module is suppose to allow tomcat to run with aolserver. There is also a tcl-java bridge so you can execute tcl procs in aolserver from tomcat. I'm trying to get this module to compile. So far I'm having problems compiling the patched version of tomcat 5.0.28 on debian. The main reason I want tomcat to work with aolserver is so that I can use apache axis as a soap engine for openacs. However I'm sure there are other possibilities for Java integration. Cheers, Nick.
Collapse
2: Re: nsjk2 module (response to 1)
Posted by Claudio Pasolini on
I used nsjk2 and got tomcat working within AS4, but the installation was painful and unfortunately not documented. I never used nsjk2 to call tcl API from within Java, but simply to run existing apps within AS4.<p> I used soap-gateway in several projects, both providing web services from OpenACS and accessing third party services via some client tcl procs.<br>Actually these client procs are not well engineered and I had to hack them to deal with different web services. <p>I have no time now, but I think that, without resorting to java, it could be possible to exploit the much better engineered client procs of tclsoap.
Collapse
3: Re: nsjk2 module (response to 1)
Posted by Dossy Shiobara on
Nick, what compile problems are you having? I tested on Debian 3.1 (sarge) and everything worked fine for me. Using Apache Axis as a SOAP engine for OpenACS seems like overkill. As Claudio mentions, you may want to investigate TclSOAP first. -- Dossy
Collapse
4: Re: Re: nsjk2 module (response to 3)
Posted by Nick Carroll on
Hi Dossy,

I managed to compile nsjk2. However when I startup the openacs config.tcl file with the extras needed to configure nsjk2, I get the following error in the log file...

[14/Dec/2004:14:07:26][3272.16384][-main-] Notice: modload: loading '/usr/local/aolserver/bin/nsjk2.so'
[14/Dec/2004:14:07:26][3272.16384][-main-] Notice: nsjk2: initialized nsjk2 environment
[14/Dec/2004:14:07:26][3272.16384][-main-] Notice: modload: loading '/usr/local/aolserver/bin/nsjavatclbridge.so'
[14/Dec/2004:14:07:26][3272.16384][-main-] Notice: nsjavatclbridge initializing
[14/Dec/2004:14:07:26][3272.16384][-main-] Notice: nsjk2: initialized on 'openacs'
[14/Dec/2004:14:07:26][3272.16384][-main-] Error: Ns_GetJvmEnv: global JVM handle is NULL.
[14/Dec/2004:14:07:26][3272.16384][-main-] Error: Ns_Jk2AddJavaCmds: Unable to access JVM
[14/Dec/2004:14:07:26][3272.16384][-main-] Error:

The settings in my config file for nsjk2 are...

# nsjk2 configuration

ns_section ns/module/nsjk2
ns_param serverroot $env(TOMCAT_HOME)

ns_section ns/server/${server}/modules
ns_param nsjk2 ${bindir}/nsjk2.so

ns_section ns/server/${servername}/module/nsjk2/gzip
ns_param enabled on
ns_param level 4
ns_param minsize 0

ns_section ns/server/${server}/module/nsjk2/utils
ns_param nsjavatclbridge ${bindir}/nsjavatclbridge.so

# -------------------------------------------------------

Would you know why the jvmGLOBAL variable isn't being assigned a jvm instance?

Thanks,
Nick.

Collapse
5: Re: Re: Re: nsjk2 module (response to 4)
Posted by Steve Manning on
Is it possible that it just isn't seeing the JVM? Might be worth checking your paths and environment variabls for the user that aols runs as.

- Steve
Collapse
Posted by Nick Carroll on
I set the JAVA_HOME variable as follows:

sudo /usr/bin/env -i JAVA_HOME=/usr/local/j2sdk1.4.2_04 TOMCAT_HOME=/usr/local/tomcat LD_LIBRARY_PATH=/usr/local/tomcat/lib:/usr/local/j2sdk1.4.2_04/jre/lib/i386:/usr/local/j2sdk1.4.2_04/jre/lib/i386/server /usr/local/aolserver/bin/nsd -ft /usr/local/aolserver/sample-config.tcl -u ncarroll -g web

I don't think the paths are the problem.

Collapse
7: Re: nsjk2 module (response to 1)
Posted by Nick Carroll on
I've tried to compile and install nsjk2, tomcat and apr from scratch again. I followed the instructions to the letter, and I still get the error:

[23/Dec/2004:15:46:29][29787.16384][-main-] Error: Ns_GetJvmEnv: global JVM handle is NULL.
[23/Dec/2004:15:46:29][29787.16384][-main-] Error: Ns_Jk2AddJavaCmds: Unable to access JVM
[23/Dec/2004:15:46:29][29787.16384][-main-] Error:

I am starting to wonder if it is a permissions problem. There is no documentation on permissions in the nsjk2 readme file.

Could anybody that has managed to get this aolserver module to work please help?

Thanks,
Nick.

Collapse
8: Re: nsjk2 module (response to 1)
Posted by Steve Manning on
Nick

I had the nsjk2 module running in openacs a few months back as a possible way of introducing some legacy Java code. I didn't go much further than running up the Tomcat samples but it did work.

Looking at your config settings I notice mine was a little simpler. It might help if you cut down the settings to the minimum and try that. Specifically I just had:

ns_section ns/server/${server}/modules
ns_param nsjk2 ${bindir}/nsjk2.so

ns_section "ns/module/nsjk2"
ns_param serverRoot /usr/local/tomcat
ns_param loggerName aolserver

ns_section "ns/server/${servername}/module/nsjk2"
ns_param serverName "${hostname}"

To simplify your problem its probably worth running Aolserver up outside of OACS with the nsjk2 module loading to see if it works standalone. I used the nsjk2 supplied startup script and had all the verbose settings turned on in the tomcat configs to see what was happening.

- Steve

Collapse
9: Re: nsjk2 module (response to 1)
Posted by Jo Chand on
Hi,

Have anyone got a chance to prepare an installation instructions for nsjk2 module. If so or if anyone know of any reference to nsjk2 links pls post it.

thanks in advance,
Jo

Collapse
10: Re: nsjk2 module (response to 1)
Posted by Nima Mazloumi on
Hi,

I am looking for a way to talk to java from tcl? Can you recommend any solution?

I found this link for the documentation but it seems broken:
http://www.aolserver.com/docs/nsjk2.pdf

Is anyone using nsjk2 on a productive site? If yes could you post a little snippet on how you talk to tomcat and pass parameters?

Thx

Collapse
11: Re: nsjk2 module (response to 10)
Posted by Andrew Piskorski on
Nima, you should also ask your nsjk2 question on the AOLserver list. It was folks inside AOL who wrote the nsjk2 module in the first place, so they're probably actually using it for real. As of 2004, the two AOL deveopers committing nsjk2 stuff to the AOLserver CVS on SourceForge were Elizabeth Thomas and Timothy Suh.