You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chong Yu Meng <ch...@cymulacrum.net> on 2003/05/26 05:46:48 UTC

Need Clarification - ChannelJNI and mod_jk2

I received an email a few days ago asking if I got ChannelJNI to work 
for my combination (which is : Apache 2.0.45 (Falsehope rpm) + Tomcat 
4.1.24 + mod_jk2 (v 2.0.1)). As I am using Channelsockets now, I thought 
it would be interesting to see if the JNI channel works as well. As it 
turned out, whether I tried the inprocess configuration or 
out-of-process configuration, I was still unable to get the combination 
to work (my jk2.properties and workers2.properties are shown below). The 
error, when I start Apache is :

[Mon May 26 11:23:35 2003] [error] Fail-> could not create JVM, code: -1
[Mon May 26 11:23:35 2003] [notice] jni.validate() class= 
org/apache/jk/apr/TomcatStarter
[Mon May 26 11:23:35 2003] [error] workerJni.init() Can't attach to VM
[Mon May 26 11:23:35 2003] [error] workerEnv.initWorkers() init failed 
for worker.jni:onStartup

At this point, I am not able to access the servlet and jsp examples 
through Apache. Looking through the original workers2.properties that 
came with my mod_jk2 rpm, it appears that the sections for channelJni 
were marked "disabled=1". This raised a red flag in my mind. Does this 
mean that the JNI channel does not work ?

Also, mod_jk2 has the choice of 3 kinds of connections : UNIX sockets, 
channel sockets and JNI. What are the differences between these 3 
approaches -- any improvements in speed or reliability, or are these 
just a result of creativity (i.e. let's see if we can make it work using 
[insert approach here]? I got channel sockets working fine on my system, 
and  it seems faster than my previous configuration with mod_jk (a 
subjective view only).

Ok, here are my configuration files :

jk2.properties
==========
# Set the desired handler list
handler.list=apr,container,channelJni
#channelJni.disabled=0

# Dynamic library needs to be defined because we are using
# Tomcat out of process
#jtc=/usr/lib/apache2
#apr.NativeSo=${jtc}/jkjni.so

# Or, using mod_jk2 directly
apr.jniModeSo=${jtc}/mod_jk2.so

# Starting Tomcat from inside the web server
apr.jniModeSo=inprocess

-----------------------------------------------------------------------------------------------
workers.properties
==============

[logger]
level=DEBUG

# Alternate file logger
[logger.file:0]
level=DEBUG
file=/var/log/httpd2/jk2.log

[shm:]
info=Scoreboard. Required for reconfiguration and status with multiprocess
servers
file=/var/run/jk2.shm
size=1000000
debug=0
disabled=0

[channel.jni:jni]
info=The jni channel, used if tomcat is started inprocess

[status:]
info=Status worker, displays runtime informations

[vm:]
info=Parameters used to load a JVM in the server process
#JVM=C:\jdk\jre\bin\hotspot\jvm.dll
OPT=-Djava.class.path=${TOMCAT_HOME}/lib/tomcat-jni.jar;${TOMCAT_HOME}/server/lib/commons-logging.jar
OPT=-Dtomcat.home=${TOMCAT_HOME}
OPT=-Dcatalina.home=${TOMCAT_HOME}
OPT=-Xmx128M
#OPT=-Djava.compiler=NONE
#disabled=1

[worker.jni:onStartup]
info=Command to be executed by the VM on startup. This one will start 
tomcat.
class=org/apache/jk2/apr/TomcatStarter
ARG=start
#disabled=1
stdout=/var/log/httpd2/stdout.log
stderr=/var/log/httpd2/stderr.log

[worker.jni:onShutdown]
info=Command to be executed by the VM on shutdown. This one will stop 
tomcat.
class=org/apache/jk2/apr/TomcatStarter
ARG=stop
#disabled=1

[uri:/jkstatus/*]
info=Display status information and checks the config file for changes.
group=status:

[uri:/examples]
info=Example webapp in the default context.
context=/examples
debug=0

[uri:/examples/servlet/*]
info=Prefix mapping

[uri:/examples/*.jsp]
info=Extension mapping

[uri:/examples/*]
info=Map the whole webapp


-------------------------------------------------------------------------------------------------------------------


Regards,
pascal chong
 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org