Chas,
Thanks, I have info here on the shell script and the perl script that I call 
from my java class.
I see the fail happening as we try to make a FTP connection. I have not 
specified any PERLLIB as I see in my script.
Thanks again,
Srini

##########myScript.ksh################
#!/bin/ksh
export PERL_DIR=/opt/perl/5.8.0
$PERL_DIR/bin/perl ./myFtp.pl
exit $?
####END OF myScript.ksh##############


###########myFtp.pl####################
#!/opt/perl/5.8.0/bin/perl
use Time::Local;
use Getopt::Long;
use FileHandle;
use File::Copy;
use File::Basename;
use Net::FTP;
use IO;
use POSIX qw(uname);
use Storable;
use Mail::Mailer;
use Net::SFTP;
use Net::SSH::Perl;

&connectFtp;

sub connectFtp 
{
                my $FTP_CONNECTION;
                my $FTP_ADDR="exampleServer.eg.com";
                my $FTP_SUER="user";
                my $FT_PASSWORD="pwd";
                my  $FTP_CONNECTION = Net::FTP->new($FTP_ADDR, Debug => 0) or 
ErrorExit("Could not establish FTP connection to server $FTP_ADDR", 11);
                $FTP_CONNECTION->login($FTP_USER, $FTP_PASSWORD) or 
ErrorExit("Could not login to $FTP_ADDR", 12);
}

###########END OF myFtp.pl#############

And this is what I call from java:::

String scriptsDir = "/home/sriniram/..";
Runtime r = Runtime.getRuntime();
//call the perl script FTP send with env file location
String cmdString = scriptsDir + "/myFtp.ksh";
try
{
     Process p = null;
     p = r.exec(cmdString); //execute the perl script
     p.waitFor();
     if (p.exitValue() == 0)
         System.out.println("FTP Connection success");
     else
         System.out.println("Exception with making a connection");
}
catch (Exception e)
{
    ///handle exception here....
}
--- On Fri, 11/21/08, Chas. Owens <[EMAIL PROTECTED]> wrote:
From: Chas. Owens <[EMAIL PROTECTED]>
Subject: Re: Perl Call from Java dumps core while making a FTP connection
To: [EMAIL PROTECTED]
Cc: beginners@perl.org
Date: Friday, November 21, 2008, 8:20 AM

On Thu, Nov 20, 2008 at 21:43,  <[EMAIL PROTECTED]> wrote:
> I need help with an issue with executing a perl program from java. I
> have a perl script that does a FTP. The perl program works well when I
> run it from command line or on a cron job.
>
> The same command I am also running from a Java program, it used to run
> fine on Solaris 8 and Perl 5.8.0. When we moved to Solaris 10 now,
> perl version being the same but this java to perl call results in a
> core dump. We did an initial core read, it points to an error like
> "Can't find LocalCfg.pm in the path @INC".
>
> Is this a right error message or does it point to some perl module not
> being installed correctly in the new environment. I do not even see
> any LocalCfg as a perl module in our install tree.
snip

Hmm.  How are you executing the Perl script from Java?  Also, what are
the values of the environment variables $PERL5LIB and $PERLLIB.  We
would also benefit from seeing the script itself (after you sanitize
it, of course).  Baring that, what modules and pragmas are being used
by the script?

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.



      

Reply via email to