Tags:
create new tag
view all tags

Question

Hi,

I have a problem with include of web page. For example, after as I wrote

%INCLUDE{"http://localhost:80/index.html"}%

I got an error on the web browser

TWiki detected an internal error - please check your TWiki logs and webserver logs for more information.  Can't locate object method "new" via package "TWiki::Net::HTTPResponse" 

Here is log from twiki

| 29 Dec 2008 - 13:48 | Can't locate object method "new" via package "TWiki::Net::HTTPResponse" at /var/www/twiki/lib/TWiki/Net.pm line 202.  at /var/www/twiki/lib/TWiki/Net.pm line 202         TWiki::Net::__ANON__('Error::Simple=HASH(0x959bc60)', 'SCALAR(0x8a51370)') called at /var/www/twiki/lib/CPAN/lib//Error.pm line 305         eval {...} called at /var/www/twiki/lib/CPAN/lib//Error.pm line 296         Error::subs::run_clauses('HASH(0x957f180)', 'socket failed: Permission denied at /usr/lib/perl5/5.8.8/CGI/...', 'undef', 'ARRAY(0x941e3e8)') called at /var/www/twiki/lib/CPAN/lib//Error.pm line 390         Error::subs::try('CODE(0x957ed9c)', 'HASH(0x957f180)') called at /var/www/twiki/lib/TWiki/Net.pm line 203         TWiki::Net::getExternalResource('TWiki::Net=HASH(0x955d5b8)', 'http://localhost:80/index.html') called at /var/www/twiki/lib/TWiki.pm line 1899         TWiki::_includeUrl('TWiki=HASH(0x89b769c)', 'http://localhost:80/index.html', 'undef', 'Sandbox', 'TestTopic0', '', 'TWiki::Attrs=HASH(0x955d4ec)', 'on') called at /var/www/twiki/lib/TWiki.pm line 3192         TWiki::INCLUDE('TWiki=HASH(0x89b769c)', 'TWiki::Attrs=HASH(0x955d4ec)', 'TestTopic0', 'Sandbox', 'TWiki::Meta=HASH(0x921ab3c)') called at /var/www/twiki/lib/TWiki.pm line 2711         TWiki::_expandTagOnTopicRendering('TWiki=HASH(0x89b769c)', 'INCLUDE', '"http://localhost:80/index.html"', 'TestTopic0', 'Sandbox', 'TWiki::Meta=HASH(0x921ab3c)') called at /var/www/twiki/lib/TWiki.pm line 2625         TWiki::_processTags('TWiki=HASH(0x89b769c)', '%TOC%\x{a}\x{a}---+ Writing Test\x{a}\x{a}Now you can write English letters\x{a}\x{a}...', 'CODE(0x8c27140)', 16, 'TestTopic0', 'Sandbox', 'TWiki::Meta=HASH(0x921ab3c)') called at /var/www/twiki/lib/TWiki.pm line 2549         TWiki::expandAllTags('TWiki=HASH(0x89b769c)', 'SCALAR(0x8c27878)', 'TestTopic0', 'Sandbox', 'TWiki::Meta=HASH(0x921ab3c)') called at /var/www/twiki/lib/TWiki.pm line 2908         TWiki::handleCommonTags('TWiki=HASH(0x89b769c)', '%TOC%\x{a}\x{a}---+ Writing Test\x{a}\x{a}Now you can write English letters\x{a}\x{a}...', 'Sandbox', 'TestTopic0', 'TWiki::Meta=HASH(0x921ab3c)') called at /var/www/twiki/lib/TWiki/UI/View.pm line 392         TWiki::UI::View::_prepare('%TOC%\x{a}\x{a}---+ Writing Test\x{a}\x{a}Now you can write English letters\x{a}\x{a}...', 'TWiki=HASH(0x89b769c)', 'Sandbox', 'TestTopic0', 'TWiki::Meta=HASH(0x921ab3c)', 0) called at /var/www/twiki/lib/TWiki/UI/View.pm line 373         TWiki::UI::View::view('TWiki=HASH(0x89b769c)') called at /var/www/twiki/lib/TWiki/UI.pm line 159         TWiki::UI::__ANON__() called at /var/www/twiki/lib/CPAN/lib//Error.pm line 379         eval {...} called at /var/www/twiki/lib/CPAN/lib//Error.pm line 371         Error::subs::try('CODE(0x89b7654)', 'HASH(0x911dfe4)') called at /var/www/twiki/lib/TWiki/UI.pm line 197         TWiki::UI::run('CODE(0x8c963c8)', 'view', 1) called 

Can anybody know how to fix this problem ?

Environment

TWiki version: TWikiRelease04x02x04
TWiki plugins: DefaultPlugin, InterwikiPlugin
Server OS: CentOS 5.2 - Linux 2.6.18-53.1.14.el5pae (i386-linux-thread-multi)
Web server: Apache/2.2.3
Perl version: 5.008008 (linux)
Client OS: CentOS 5.2 - Linux 2.6.18-53.1.14.el5pae (i386-linux-thread-multi)
Web Browser: FireFox
Categories: Platform

-- JacekBednarczuk - 29 Dec 2008

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

Hmm, that looks like a bug. May be related to CPAN:LWP not being installed on yoru system. Could you check if LWP is installed, and if not, install it?

See also HowToInstallCpanModules

-- PeterThoeny - 29 Dec 2008

In fact the CPAN:LWP not being installed on my OS. I have installed the CPAN:LWP and a problem disappear. Thanks for suggestion

Now I have the problem with permissions

 Failed to include URL http://localhost/ Can't connect to localhost:80 (Permission denied) 
I have no idea how to configure it. I can display the page using the web browser but can not include this page from the twiki

-- JacekBednarczuk - 31 Dec 2008

Can you include other pages, such as www.google.com?

-- PeterThoeny - 31 Dec 2008

I filed TWikibug:Item6159 for the issue if LWP is not installed.

-- PeterThoeny - 31 Dec 2008

It does not matter what is the page (internal if external) a result is the same how above I look for a reason in the configuration of the Apache, Twiki but without effects Permissions for the internal page http://localhost/index.html are set up 755

In the configuration of the Twiki an allowURLs is set up correctly

$TWiki::cfg{INCLUDE}{AllowURLs} = 1;

I can send a http request from a lwp command and get a response

bash-3.2$ lwp-request http://localhost
<HTML>
<HEAD>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
</HEAD>
<BODY>
<center>Example an easy page</center>
</BODY>
</HTML> 
bash-3.2$ 

I am not able to solve this problem so far

-- JacekBednarczuk - 01 Jan 2009

I dont know where maybe the problem. I wrote a easy plugin which gets any www page by using LWP. I have a strange situation because when use this plugin from the Twiki it appears an error 500 Can't connect to localhost:80 (Permission denied). In case of calls it from line command as a perl script the error disappear. Below is a basic code of the plugin

sub _GETURL {
    my($session, $params, $theTopic, $theWeb) = @_;
    my $response = CheckGetUrl($params->{_DEFAULT});
    return "$response";
}

sub CheckGetUrl {
        my($url) = @_;
        my $ua = LWP::UserAgent->new();
        my $request = HTTP::Request->new('GET', $url);
        my $response = $ua->request($request);
        my $answer = $response->content();
        return "$answer";
}

When I call the CheckGetUrl function of new Plugin from the perl script then get the corectly result

#!/usr/bin/perl -w 
use strict;
push(@INC, "/var/www/twiki/lib/");

require TWiki;
require TWiki::Plugins::GetUrlPlugin;
use LWP::UserAgent;
my $response = TWiki::Plugins::GetUrlPlugin::CheckGetUrl("http://localhost");
print "$response";
exit;

-- JacekBednarczuk - 05 Jan 2009

Peter,

I have checked this functionality (include website) on another OS with the same version of TWiki and It works properly so it is not the problem of TWiki only my OS. I am changing a status to Answered Questions

-- JacekBednarczuk - 06 Jan 2009

Change status to:
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2009-01-06 - JacekBednarczuk
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.