I have now painfully learned to use the Tomcat shared area to supply
JNI code for my web application. However there are still a few
questions that linger:
1) Using the Axis 1.3 (binary distribution) webapp, I modified
EchoHeaders (as shown below) to load a shared library which
predictably works only once as I now understand because of the
class loading issue. Subsequent attempts to rerun the EchoHeaders
service fails with the response indicated below. What I don't
understand is why the exception is not caught by EchoHeaders.jws
instead of Axis such that I'd see "took exc".
2) (More of a Tomcat issue) Using the
.../tomcat/shared/... directories to contain classes and jarballs
containing JNI seriously breaks the loose coupling between Tomcat
and a webapp. Where deploying a war file is simple, reliable and
satisfying on each release of the app, dealing with getting the
webapp that consumes JNI code deployed or updated is a multi stage,
tightly coupled process and requires restarting the container
(unless I have overlooked some Tomcat provided feature to
auto-reload shared jar files or classes). So I wonder why Tomcat
does not treat this as an issue/bug and fix it in the future.
Perhaps it is in the plan.
-pmr
EchoHeaders.jws:
...
public String jni() {
String result = "failed";
try {
System.loadLibrary("nativelib");
result = "worked";
} catch ( Exception exc ) {
savedExc = (Throwable) exc;
result = "took exc"
}
return result;
}
...
Axis response:
soapenv:Server.userException
java.lang.reflect.InvocationTargetException
copa.pajato.com