Jan,

I am on vacation right now. I'll take a closer look at your problem when I get
back. 

I have not yet tried Inline::Java under mod_perl2. One question
though: are you loading the (Inline::Java) Perl code at parent startup
(using PerlRequire or PerlModule), or are you just loading it normally
with the handler?

Patrick

On 8/1/05, Jan Berwich <[EMAIL PROTECTED]> wrote:
> On Monday 01 August 2005 00:52, Michael Peters wrote:
> > 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?
> 
> It's in the debug output:
> [perl]
> [2] classpath: 
> /usr/data/www/java/example-1.4.3.jar:/usr/data/www/java/example-widget-1.9-rc1-dev.jar:/usr/lib/perl5/site_perl/5.8.5/i586-linux-thread-multi/Inline/Java/InlineJavaServer.jar
> 
> > 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.
> 
> That was also showing the value I expected.
> 
> > 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?
> 
> Initially the default "nobody" user, but changing it to a dedicated
> "www" user doesn't make any difference.
> 
> > > 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.
> 
> Have you used it with mod_perl2 by any chance?
> 
> > 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.
> 
> I've tryed  Inline::Java with and without the JNI option, that doesn't seem
> to be making any difference either.
> 
> However, experimenting with Inline/Java.pm shows that the CLASSPATH set
> in Inline::Java is not passed to the environment when system() is executed.
> Inserting
> 
>   system('env > /tmp/somefile');
> 
> just before
>   my $res = system($cmd) ;
> 
> produces a list of environment variables where CLASSPATH is not set
> Changing system($cmd) to
>     system("CLASSPATH=$ENV{CLASSPATH} $cmd") ;
> ($ENV{CLASSPATH} is set prior to this, and contains the correct values, as
> supplied by the debug output) then gives me a different set of errors like
> this:
> 
> [perl][1] starting JVM...
> [perl][1] client/server mode
> [perl][4]    portable: GOT_ALARM for linux is default 'define'
> [perl][4]    portable: EXE_EXTENSION for linux is default ''
> [perl][4]    portable: SUB_FIX_CMD_QUOTES => "/usr/bin/java"
> org.perl.inline.java.InlineJavaServer 5 7891 true false for linux is default
> '"/usr/bin/java"  org.perl.inline.java.InlineJavaServer 5 7891 true false'
> [perl][2]  "/usr/bin/java"  org.perl.inline.java.InlineJavaServer 5 7891 true
> false
> [perl][4]    portable: DEV_NULL for linux is default '/dev/null'
> [perl][4]    portable: GOT_ALARM for linux is default 'define'
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/perl/inline/java/InlineJavaServer
> [Mon Aug 01 08:26:51 2005] [notice] child pid 7877 exit signal Alarm clock
> (14)
> 
> After manually executing "perl -MInline::Java::Server=start" the code
> then seems to compile without error. Haven't got it to run yet, but I've
> probably borked something else along the way.
> 
> 
> Thanks
> 
> Jan Berwich
> 


-- 
=====================
Patrick LeBoutillier
Laval, Québec, Canada

Reply via email to