You are here: Foswiki>Tasks Web>Item9139 (01 May 2017, GeorgeClark)Edit Attach

Item9139: trunk: Can't locate object method "new" via package "Foswiki::Engine::Apache2::MP20"

pencil
Priority: Normal
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Extension
Component: ModPerlEngineContrib
Branches: master
Reported By: PaulHarvey
Waiting For:
Last Change By: GeorgeClark
The error:

[Fri Jun 11 13:41:22 2010] [error] Can't locate object method "new" via package "Foswiki::Engine::Apache2::MP20" at (eval 30) line 1.\n at (eval 30) line 1\n\teval 'use Foswiki::Engine::Apache2::MP20; Foswiki::Engine::Apache2::MP20->new\n;' called at /usr/local/src/git.foswiki.org/trunk/core/lib/Foswiki.pm line 544\n\tFoswiki::BEGIN() called at (eval 30) line 0\n\teval {...} called at (eval 30) line 0\n\trequire Foswiki.pm called at /usr/local/src/git.foswiki.org/trunk/core/lib/Foswiki/Engine/Apache.pm line 75\n\tFoswiki::Engine::Apache::BEGIN() called at (eval 30) line 0\n\teval {...} called at (eval 30) line 0\n\trequire Foswiki/Engine/Apache.pm called at /usr/local/src/git.foswiki.org/trunk/core/tools/mod_perl_startup.pl line 41\n\tmain::BEGIN() called at (eval 30) line 0\n\teval {...} called at (eval 30) line 0\n\trequire /usr/local/src/git.foswiki.org/trunk/core/tools/mod_perl_startup.pl called at (eval 2) line 1\n\teval 'require qCompilation failed in require at /usr/local/src/git.foswiki.org/trunk/core/lib/Foswiki/Engine/Apache.pm line 75.\n at /usr/local/src/git.foswiki.org/trunk/core/lib/Foswiki/Engine/Apache.pm line 75\n\tFoswiki::Engine::Apache::BEGIN() called at /usr/local/src/git.foswiki.org/trunk/core/lib/Foswiki.pm line 75\n\teval {...} called at /usr/local/src/git.foswiki.org/trunk/core/lib/Foswiki.pm line 75\n\trequire Foswiki/Engine/Apache.pm called at /usr/local/src/git.foswiki.org/trunk/core/tools/mod_perl_startup.pl line 41\n\tmain::BEGIN() called at /usr/local/src/git.foswiki.org/trunk/core/lib/Foswiki.pm line 75\n\teval {...} called at /usr/local/src/git.foswiki.org/trunk/core/lib/Foswiki.pm line 75\n\trequire /usr/local/src/git.foswiki.org/trunk/core/tools/mod_perl_startup.pl called at (eval 2) line 1\n\teval 'require qCompilation failed in require at /usr/local/src/git.foswiki.org/trunk/core/tools/mod_perl_startup.pl line 41.\n at /usr/local/src/git.foswiki.org/trunk/core/tools/mod_perl_startup.pl line 41\n\tmain::BEGIN() called at /usr/local/src/git.foswiki.org/trunk/core/lib/Foswiki/Engine/Apache.pm line 41\n\teval {...} called at /usr/local/src/git.foswiki.org/trunk/core/lib/Foswiki/Engine/Apache.pm line 41\n\trequire /usr/local/src/git.foswiki.org/trunk/core/tools/mod_perl_startup.pl called at (eval 2) line 1\n\teval 'require qCompilation failed in require at (eval 2) line 1.\n at (eval 2) line 1\n\teval 'require q
[Fri Jun 11 13:41:22 2010] [error] Can't load Perl file: /usr/local/src/git.foswiki.org/trunk/core/tools/mod_perl_startup.pl for server peperomia-bp:0, exiting...

Adding this method to Foswiki::Engine::Apache::MP20 seems to make everything happy:

sub new {
    my $proto = shift;
    my $class = ref($proto) || $proto;
    my $this  = {};
    return bless $this, $class;
}

Which is a bit odd, given that this ISA Foswiki::Engine::Apache2 which itself ISA Foswiki::Engine::Apache which ISA Foswiki::Engine that implements new()...

Server env:
DOCUMENT_ROOT /usr/local/src/svn.foswiki.org/trunk/core
GATEWAY_INTERFACE CGI/1.1
HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_ACCEPT_ENCODING gzip,deflate
HTTP_ACCEPT_LANGUAGE en-us,en;q=0.5
HTTP_CONNECTION keep-alive
HTTP_COOKIE FOSWIKIPREF= TwistyPlugin _topicform= TwistyPlugin _twistyIdSystemTrinSkin1= TwistyPlugin _twistyIdSandboxWebHome1= TwistyPlugin _twistyIdHubRISWebHome1=; FOSWIKISTRIKEONE=949cb33e7806c47f71ce4f5287a3990a; FOSWIKISID=1679414cd53d8792994c981e050eae54

Cookie string decoded for readability.

HTTP_HOST peperomia-bp
HTTP_KEEP_ALIVE 300
HTTP_REFERER http://peperomia-bp/foswikigit-trunk/bin/configure
HTTP_USER_AGENT Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100501 Iceweasel/3.5.9 (like Firefox/3.5.9)
PATH /usr/local/bin:/usr/bin:/bin
QUERY_STRING  
REMOTE_ADDR 127.0.1.1
REMOTE_PORT 33026
REQUEST_METHOD GET
REQUEST_URI /foswikigit-trunk/bin/configure
SCRIPT_FILENAME /usr/local/src/git.foswiki.org/trunk/core/bin/configure
SCRIPT_NAME /foswikigit-trunk/bin/configure
SCRIPT_URI http://peperomia-bp/foswikigit-trunk/bin/configure
SCRIPT_URL /foswikigit-trunk/bin/configure
SERVER_ADDR 127.0.1.1
SERVER_ADMIN webmaster@peperomia-bp
SERVER_NAME peperomia-bp
SERVER_PORT 80
SERVER_PROTOCOL HTTP/1.1
SERVER_SIGNATURE Apache/2.2.15 (Debian) Server at peperomia-bp Port 80
SERVER_SOFTWARE Apache/2.2.15 (Debian)
Operating system Linux 2.6.32-3-amd64 (x86_64-linux-gnu-thread-multi)
Perl version 5.010001 (linux)

Note that by convention "Perl version 5.008" is referred to as "Perl version 5.8" and "Perl 5.008004" as "Perl 5.8.4" (i.e. ignore the leading zeros after the .)

@INC library path /usr/local/src/git.foswiki.org/trunk/core/lib
/usr/local/src/git.foswiki.org/trunk/core/lib
.
/etc/perl
/usr/local/lib/perl/5.10.1
/usr/local/share/perl/5.10.1
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.10
/usr/share/perl/5.10
/usr/local/lib/site_perl
/usr/local/lib/perl/5.10.0
/usr/local/share/perl/5.10.0
/usr/local/src/git.foswiki.org/trunk/core/lib/CPAN/lib//arch
/usr/local/src/git.foswiki.org/trunk/core/lib/CPAN/lib//5.10.1/x86_64-linux-gnu-thread-multi
/usr/local/src/git.foswiki.org/trunk/core/lib/CPAN/lib//5.10.1
/usr/local/src/git.foswiki.org/trunk/core/lib/CPAN/lib/
/usr/local/src/git.foswiki.org/trunk/core/lib/CPAN/lib//arch
/usr/local/src/git.foswiki.org/trunk/core/lib/CPAN/lib//5.10.1/x86_64-linux-gnu-thread-multi
/usr/local/src/git.foswiki.org/trunk/core/lib/CPAN/lib//5.10.1
/usr/local/src/git.foswiki.org/trunk/core/lib/CPAN/lib/

This is the Perl library path, used to load Foswiki modules, third-party modules used by some plugins, and Perl built-in modules.

System temporary directory /tmp
CGI bin directory /usr/local/src/git.foswiki.org/trunk/core/bin
Foswiki module in @INC path Foswiki.pm (Version: $Date$ $Rev$ ) found
Perl modules
Apache::Htpasswd

1.8 installed

may be required for ApacheHtpasswd password manager
Archive::Tar

1.52 installed

may be required by the Extensions Installer in configure if command line tar or unzip is not available
B::Deparse

0.89 installed

for base Foswiki
CGI

3.49 installed

for base Foswiki (Versions 2.89, 3.37, 3.43, and 3.47 must be avoided. Most version from 3.15 and onwards should work)
CGI::Cookie

1.29 installed

required for Sessions support, available from the CPAN archive.
CGI::Session

4.41 installed

required for Sessions support, available from the CPAN archive.
Carp

1.11 installed

for base Foswiki
Config

Unknown version installed

for base Foswiki
Cwd

3.31 installed

for base Foswiki
Data::Dumper

2.124 installed

for base Foswiki
Digest::MD5

2.39 installed

for base Foswiki
Digest::SHA

5.47 installed

may be required for password encryption
Encode

2.35 installed

for international characters
Encode::compat

0.07 installed

may be required for international characters
Error

0.17010 installed

for base Foswiki
Exporter

5.63 installed

for base Foswiki
File::Basename

2.77 installed

for base Foswiki
File::Glob

1.06 installed

for base Foswiki
File::Path

2.07 installed

for base Foswiki
File::Spec

3.31 installed

for base Foswiki
File::Temp

0.22 installed

for base Foswiki
FileHandle

2.02 installed

for base Foswiki
FindBin

1.50 installed

required if you want to use the Extensions Installer in configure
Getopt::Long

2.38 installed

may be required for international characters
HTML::Entities

3.64 installed

for WysiwygPlugin
HTML::Parser

3.65 installed

for WysiwygPlugin
I18N::Langinfo

0.02 installed

may be required for international characters
Lingua::EN::Sentence

0.25 installed

may be required for generating new language files
Locale::Maketext::Lexicon

0.82 installed

may be required for international characters
LWP

5.836 installed

needed for the Configure Extensions installer, and for external URL based INCLUDEs
MIME::Base64

3.08 installed

for base Foswiki
Net::SMTP

2.31 installed

may be required for sending mail
POSIX

1.17 installed

for base Foswiki
Socket

1.82 installed

for base Foswiki
Symbol

1.07 installed

may be required for international characters
Unicode::MapUTF8

1.11 installed

may be required for international characters
Win32::Console

Not installed. may be required for Windows

PATH_INFO For a URL such as http://peperomia-bp/foswikigit-trunk/bin/configure/foo/bar, the correct PATH_INFO is /foo/bar, without any prefixed path components. Test PATH_INFO now - particularly if you are using mod_perl, Apache or IIS, or are using a web hosting provider. Look at the new path info here. It should be /foo/bar.
mod_perl Not used for this script (correct). mod_perl may be enabled for the other scripts. You can check this by visiting System in your wiki.

mod_perl is not loaded into Apache

CGI user userid = www-data groups = www-data, www-data

Your CGI scripts are executing as this user.

Original PATH /usr/local/bin:/usr/bin:/bin

This is the PATH value passed in from the web server to this script - it is reset by Foswiki scripts to the PATH below, and is provided here for comparison purposes only.

Current PATH /usr/local/bin:/usr/bin:/bin

This is the actual PATH setting that will be used by Perl to run programs. It is normally identical to {SafeEnvPath}, unless that variable is empty, in which case this will be the webserver user's standard path..

-- PaulHarvey - 11 Jun 2010

Don't you have to at least do a $this = $class->SUPER::new() ?

-- CrawfordCurrie - 11 Jun 2010

Paul,

How did you configure apache? There should be something like:
   PerlResponseHandler Foswiki::Engine::Apache

-- GilmarSantosJr - 11 Jun 2010

Crawford, the superclass does not implement new either (still get missing method error).

Gilmar, yes, this is the line, as per ApacheConfigGenerator

-- PaulHarvey - 12 Jun 2010

I just installed ModPerlEngineContrib (from trunk) on a clean checkout and it worked well. tools/mod_perl_startup.pl loads Foswiki::Engine::Apache, that adjusts $Foswiki::{Engine} to Foswiki::Engine::Apache2::MP20 (in my environment). This one loads Foswiki::Engine::Apache2. Foswiki::Engine::Apache was already loaded, so was Foswiki::Engine. It's very strange... try to test on a clean checkout and report the steps to reproduce, if the bug still shows.

I'm using Apache 2.2.15 with mod_perl 2.0.4 (Debian unstable).

-- GilmarSantosJr - 12 Jun 2010

mod_perl documentation has this to say about the use of PerlRequire:
PerlRequire does the same thing as PerlPostConfigRequire, but you have almost no control of when this code is going to be executed. Therefore you should be using either PerlConfigRequire (executes immediately) or PerlPostConfigRequire (executes just before the end of the server startup) instead. Most of the time you want to use the latter.
(emphasis mine)

I think my problem is related the order in which my apache2 servers are loading various modules. Today I am on a new test host and have been getting the same problems.

Replacing the PerlRequire had interesting results:
  • PerlRequire - failed to start, stupid error message:
    [error] Can't load Perl file: /usr/.../tools/mod_perl_startup.pl for server foo.org.au:0, exiting...
    , but works after adding 'missing' new() method
  • PerlModule - success starting, success accessing wiki
  • PerlLoadModule - success starting, success accessing wiki
  • PerlConfigRequire - failed to start apache2 (same error as PerlRequire), but success after after adding the 'missing' new() method
  • PerlPostConfigRequire - failed to start apache2 (same as PerlRequire), but success after after adding the 'missing' new() method

Obviously we need to fix ApacheConfigGenerator (and NewApacheConfigGenerator). Any ideas?

-- PaulHarvey - 15 Oct 2010

Closing this. No activity or feedback since 2010, The new() method has been added.

-- GeorgeClark - 01 May 2017
 
Topic revision: r10 - 01 May 2017, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy