Andy, I've performed various tests and came up with problems similar to yours.
My setup is quite different though: Apache 2, mod_perl 1.99, perl 5.8.0, Inline::Java 0.48_91. Even with regular CGI I had a minor problems: it seems the first time the CGI is called the instance hangs and doesn't produce any output. But it does manage to start the JVM properly so the next calls work OK. The only way I got this to work properly was by modifying Inline::Java to pass /dev/null as STDIN/STDOUT/STDERR, but then you can't see the debug info. Maybe a logfile is the key here... With ModPerl::Registry (that what it's called with mod_perl 1.99) I get issues similar to yours: some handles can't be closed/opened. Basically what is happenning is that ModPerl::Registry replaces STDIN/STDOUT/STDERR by special objects that are not really file descriptors. This breaks Open3.pm which tries to dup these filehandles. Basically the "clean" solution is to start you shared JVM server beforehand (manually) and then your CGIs (with or without mod_perl) should work properly. Can you confirm this on your side? Thanks, Patrick On Fri, 2004-04-23 at 17:41, Andy Lowe wrote: > ok. understood. my prototype is up and running with the cgi workaround: > everything runs under mod_perl, except the java callouts which operate as separate > subrequest invocations to the cgi > > that's obviously not ideal, but its good enough for what I need for now. > > when I get a chance, I'll see if I can dig in a little deeper to figure out what's > going on. > > thanks for your efforts & regards, > Andy > > > -----Original Message----- > From: Patrick LeBoutillier [mailto:[EMAIL PROTECTED] > Sent: Friday, April 23, 2004 3:20 PM > To: Andy Lowe > Subject: RE: Inline::Java with mod_perl Apache::Registry > > > Andy, > > When I said I had used mod_perl under Libux, I had actually written a > mod_perl module. I have never user Apache::* wrappers to load "plain" > CGI into mod_perl. > > That seems to be what you are doing, so I can't confirm it ever worked > that way. I will try to perform more tests when I have time. > > Patrick > > > On Fri, 2004-04-23 at 15:26, Andy Lowe wrote: > > Patrick, > > > > fwiw, I tried without success on Linux and Solaris, though if my problem was some > > configuration error, I no doubt made the same one on all three systems. :-) > > > > if you get a chance, I'd be very interested to know if your results were > > different. my WindowsXP and Linux Redhat9 systems are running the same releases > > of Apache, mod_perl and Inline::Java, that is: Inline-Java-0.47, Apache/1.3.27 > > (Unix) mod_perl/1.27 > > > > I tried playing around with using the Apache::PerlRun handler instead of the > > Apache::PerlRegistry handler, and setting different options, including DEBUG => 4, > > and so have lots of logs that pretty much tell me nothing: > > > > e.g. for the sample from Java.pod, I get > > ... > > [Fri Apr 23 12:46:43 2004] [error] PerlRun: `Can't locate object method "new" > > via package "Pod_counter" (perhaps you forgot to load "Pod_counter"?) at > > /z/mod_perl/test9 line 17. > > ... > > > > I don't get this when running the (slightly modified) sample from the command > > line. this sample also works fine as a plain old cgi. (so I guess that will be > > my backup plan :) > > > > fyi, here's the slightly modified sample. as you can see I made Pod_counter > > public, and rewrote the output section so it puts out something meaningful when > > run from the commandline. the DIRECTORY option pointing to a writable dir is > > necessary on Linux if you run httpd as an unprivileged user like 'nobody'. Apache > > on windows also requires the shbang to tell it what program to apply to a .cgi > > > > since it runs as a cgi, it seems this program should work under mod_perl too. > > perhaps the root cause has something to do with Open3 failing to close STDIN, but > > I don't know. > > > > ---------------------------------------------------------------------------------------------------- > > #!/usr/local/bin/perl > > use CGI qw/:standard :html3/; > > use Apache::Constants ; > > use Inline ( Java => << 'END', > > public class Pod_counter { > > public static int cnt = 0 ; > > public Pod_counter(){ > > cnt++ ; > > } > > } > > END > > DIRECTORY=>'/var/www/_Inline', > > SHARED_JVM => 1, > > ) ; > > > > # reset signal handlers unless JVM is shared > > Inline::Java::release_JVM() ; > > > > my $c = new Pod_counter() ; > > > > print header; > > print start_html(-title=>"test9" ); > > print "This page has been accessed " . $c->{cnt} . " times." ; > > print($val . "\n") ; # prints value > > > > print end_html; > > > > > > -----Original Message----- > > From: Patrick LeBoutillier [mailto:[EMAIL PROTECTED] > > Sent: Thursday, April 22, 2004 4:44 PM > > To: Andy Lowe > > Subject: RE: Inline::Java with mod_perl Apache::Registry [was: Re: > > InlineCwith mod_perl Apache::Registry] > > > > > > On Thu, 2004-04-22 at 14:47, Andy Lowe wrote: > > > Patrick, > > > > > > thanks for your prompt reply! > > > > > > first, let me say that Inline::Java is highly magical. thanks for your efforts. > > > > > > I am using Inline-Java-0.47. > > > > > > to reduce the number of variables, I've backed up to trying the example at > > > http://search.cpan.org/~patl/Inline-Java-0.32/Java.pod#USING_Inline::Java_UNDER_MOD_PERL > > > > > > as you know, that example has a simple class definition directly inline with the > > > source, uses SHARED_JVM=>1 and no other options. it exhibits the same behavior. > > > maybe this is something windows-specific? has anyone tried this on windows? > > > > > > > I will try again tomorrow on Linux to make sure it still works. > > > > Patrick > > > > > > > > -----Original Message----- > > > From: Patrick LeBoutillier [mailto:[EMAIL PROTECTED] > > > Sent: Thursday, April 22, 2004 12:46 PM > > > To: Andy Lowe > > > Cc: [EMAIL PROTECTED] > > > Subject: Re: Inline::Java with mod_perl Apache::Registry [was: Re: > > > Inline Cwith mod_perl Apache::Registry] > > > > > > > > > Hi A., > > > > > > A while back I had gotten Inline::Java to work under mod_perl, but in > > > Linux. I have never used mod_perl in Windows. > > > > > > What Inline::Java version and what options (SHARED_JVM, ...) are you > > > using? > > > > > > Do you know what $fd is supposed to point to when it fails? > > > > > > Patrick > > > > > > > > > > > > On Thu, 2004-04-22 at 11:25, A. Lowe wrote: > > > > I've been trying to do something similar, but with Inline::Java. > > > > > > > > I can get a proxy module to bridge between my perl application to java code > > > > inside a jar, but when I try to deploy this same code as a web application, > > > > it bombs out with errors like: > > > > > > > > [Wed Apr 21 22:17:33 2004] [error] Can't exec JVM: open3: Can't call method > > > > "close" on an undefined value at > > > > c:\usr\local\lib\perl-5.6.1\lib/IPC/Open3.pm line 335. > > > > > > > > the whacky path should give you a clue that this is perl 5.6.1, on windows. > > > > the server is: Apache/1.3.27 (Win32) mod_perl/1.27_01-dev > > > > > > > > What I can't figure is why the same config would work standalone, but not > > > > under mod_perl. > > > > > > > > I've checked everything I can think of, including the environment, PATH and > > > > CLASSPATH, even to the point of debugging inside JVM.pm. > > > > > > > > fwiw, i've taken it to the point in Open3.pm where the line: > > > > > > > > $fd->{tmp_copy} = IO::Handle->new_from_fd($fd->{handle}, $fd->{mode}); > > > > > > > > appears to fail, returning null, errno says $fd is a bad file descriptor. > > > > > > > > now I'm wondering should Inline::Java even be expected to work under > > > > mod_perl? > > > > > > > > thanks, > > > > > > > > A. Lowe > > > > > > > > "Roger Moffatt" <[EMAIL PROTECTED]> wrote in message > > > > news:[EMAIL PROTECTED] > > > > > Hi > > > > > > > > > > I'm integrating a C API with my mod_perl application which runs using > > > > > Apache::Registry as it is a recent port from a standard CGI environment. > > > > > > > > > > I've got things to work MOST of the time by using the following > > > > > configuration; > > > > > > > > > > use strict; > > > > > use CGI; > > > > > use Crypt::SKey qw(compute_md5); > > > > > > > > > > use Inline ( C=>'/var/www/perl/clipmail.c', > > > > > AUTO_INCLUDE=>'#include "/var/www/perl/API.h"', > > > > > DIRECTORY => '/var/www/perl/_Inline/', > > > > > ENABLE => 'UNTAINT' ); > > > > > > > > > > With all my C code in the clipmail.c file and the _Inline directory > > > > > configured so apache can read and write to it. > > > > > > > > > > My problem is that if I leave the browser for a while and then come back > > > > and > > > > > use it again, I get a server 500 error and looking in my error logs I get > > > > an > > > > > entry as follows NOTE that the _inline directory option listed in the > > > > error > > > > > IS NOT the same as the one I actually am using which starts with a capital > > > > > "I"; > > > > > > > > > > >> ModPerl::Registry Invalid value '/var/www/perl/_inline' for config > > > > option > > > > > DIRECTORY ... blah compilation aborted. > > > > > > > > > > I don't quite understand this, I am specifying which directory to use - > > > > and > > > > > it's not that one!! I'm suspecting this is something to do with > > > > persistance > > > > > and the way mod_perl under Apache::Registry works - I wonder if the error > > > > is > > > > > cropping up when a new child process is spawned and maybe mod_perl is > > > > trying > > > > > to re-compile the C code but for some reason is ignoring the config > > > > > option??? > > > > > > > > > > Any help much appreciated > > > > > > > > > > Regards > > > > > Roger Moffatt > > > > > UK > > > > > > > > > > > > > > > > > > > > > > > > > >