In bsfperl.pl, method BSF::UNIVERSAL::import should not try to call a java method DESTROY on a perl object. If the perl class does not have a DESTROY method defined, bsfperl will try to call a java DESTROY method on the class and java will throw a "class not found" exception.
Recommend the following line of code be added
return if $method eq 'DESTROY';
as in
sub UNIVERSAL::import {
my ($class) = @_;
my $short = ($class =~ /([^:]+)$/)[0] || $class;
no strict 'refs';
my %h = %{$short . "::"};
unless (exists $h{"AUTOLOAD"}) {
*{$short . "::AUTOLOAD"} = sub {
my ($givenClass) = shift;
my $method = ($AUTOLOAD =~ /([^:]+)$/)[0] || $AUTOLOAD;
return if $method eq 'DESTROY';
my $javaClassName = $class;
$javaClassName =~ s/::/./g;
my $beanName = $javaClassName . ".class";
my $javaClass = BSF::JavaObject->new($beanName);
return $javaClass->_callMethod($method, @_);
};
}
}