Jan Berwich wrote:
> Hi
> 
> I have a small Java class which I'd like to embed into a mod_perl module.
> The class imports several packages from a .jar file. It works when embedded
> into a Perl CGI script, but not under mod_perl. It fails with a message
> like "package org.example.widget.document does not exist". The CLASSPATH
> is correct and the .jar files exist at the specified locations and are the
> same ones which work for the CGI script.

How do you know that the CLASSPATH is set? Whenever there is a problem
with something that runs under mod_cgi but not mod_perl it's typically
user, permission and environment differences. What user are you running
apache as?

Inside of you mod_perl module, before you load your java classes in a
BEGIN block, print out $ENV{CLASSPATH} and see what value you get. If
you don't get what you expected, you can set that value either in you
httpd.conf or your startup script.

> I'm using: Apache 2.0.54 with mod_perl 2.0, JDK 1.4.2. Inline::Java is 0.50;
> while building with perl Makefile.PL I said "yes" to building with JNI, 
> "server" when there was a choice between server and client (apologies, I 
> can't recall exactly what) and "no" to all the options.

I've used Inline::Java with mod_perl and it has been working just fine.
But I've never used it with JNI under mod_perl so I couldn't tell you if
that might be an issue or not.

-- 
Michael Peters
Developer
Plus Three, LP

Reply via email to