Installation

WebWork and Moodle upgrade problem

WebWork and Moodle upgrade problem

by Marc BUFFAT -
Number of replies: 13
I am currently running successfully webwork 2.2 and moodle 1.65 using the old wwmoodle bridge (2006042700), i.e. using the same DB for moodle and webwork

I am currently trying to migrate to moodle 1.9 and webwork 2.4. I am trying to doing it on the same computer, but using different databases and locations for the old and new versions.
The moodle 1.9 version is running without problem using mysql moodle19 database.
I have update webwork to webwork2.4 using a mysql database webwork24, but I ran into several problems:
the location of webwork2.4 is in /opt/webwork/webwork2.4 with a symbolic link to /opt/webwork/webwork2 (I run only one version of webwork on my apache server)

1/ I can access the webwork administration, and I can create new courses

2/ But when I try to access my old course which use a moodle_sql database, I got an error messages
DBD::mysql::st execute failed: Table 'moodle19.mdl_sessions' doesn't exist at /opt/webwork/webwork2/lib/WeBWorK/Authen/Moodle.pm line 196

3/ I have install wwassignment4 in moodle1.9
http://www.ufrmeca.univ-lyon1.fr/webwork2_wsdl
works and return an xml page

http://www.ufrmeca.univ-lyon1.fr/webwork2_rpc
fails and return a bad request:
our browser sent a request that this server could not understand.
I am running apache 1.3.34 server

4/ In moodle, I can select a webwork course,
but when I try to select a Webwork Problem set i got an error
No WeBWorK course is linked to this course.
Use the WWLink block to create a connection between this Moodle course and a WeBWorK course.

PS: i am running Ubuntu 7.04 on a x64 sun server, with apache 1.3.34 and mysql 5.0.51, perl 5.8

Any help would be appreciated

regards,
Marc




In reply to Marc BUFFAT

Re: WebWork and Moodle upgrade problem

by Michael Gage -

Hi Marc,


2/ But when I try to access my old course which use a moodle_sql database, I got an error messages

DBD::mysql::st execute failed: Table 'moodle19.mdl_sessions' doesn't exist at /opt/webwork/webwork2/lib/WeBWorK/Authen/Moodle.pm line 196

this is about what I'd expect if the database moodle19 is not in the same mysql repository being used by tne webwork installation. In fact probably the old course was in a database called moodle165 or something like that. Take a look at the references to the moodle database in global.conf and database.conf and you may be able to hook the old courses up again. Also use the "mysql" client to look directly at the database and see if the moodle database and tables are actually there.

http://www.ufrmeca.univ-lyon1.fr/webwork2_rpc
fails and return a bad request:
our browser sent a request that this server could not understand.
I am running apache 1.3.34 server

it looks like you have modified the url at the top of the
WebworkSOAP/WSDL.pm file which you are supposed to do.

Perhaps the new url isn't quite correct however. Should you be using https:// instead of http://? I sometimes get the error message you describe when I use http:// on a secure server.

That's just a guess. I'm not sure what else could cause problems. Let us know what you find out. If the server is on I can look at the _wsdl returned and see if it looks ok.

Use the WWLink block to create a connection between this Moodle course and a WeBWorK course.

After turning "editing on" in moodle you will see a block (probably in the right margin) for adding more "blocks". One of them is called WWLink.

After adding that block, edit it in order to choose the webwork course to which you want to connect the current moodle course.

Hope this helps.

--Mike




In reply to Michael Gage

Re: WebWork and Moodle upgrade problem

by Marc BUFFAT -
Hi Mike,
As I understood, it is difficult to upgrade old webwork course with moodle_db.

So I have try to install a fresh webwork server 2.4, i.e; without courses.
It is almost working: I can create, delete , rename courses
1/ but I cannot archive course: I got the following error
An error occured while archiving the course test:
Failed to dump table 'test_set_locations' with command '2>&1 '' --defaults-extra-file=/tmp/DuQQItkmpp webwork24 test_set_locations > /opt/webwork/courses/test/DATA/mysqldump/set_locations.sql' (exit=72057594037927935 signal=127 core=128): sh: : Permission denied

I have checked the global.conf for mysqldump !
$externalPrograms{mysqldump} = "/usr/bin/mysqldump";

2/ Idem for the Manage LOcation
I got the following error

DBD::mysql::st execute failed: Table 'webwork24.locations' doesn't exist at /opt/webwork/webwork2/lib/WeBWorK/DB/Schema/NewSQL/Std.pm line 753.

3/ for the moodle wwassignement, I can select the webwork course in the
the webworklink
but when I try to add a webwork set to the moodle course, I always got an error:
No WeBWorK course is linked to this course.
Use the WWLink block to create a connection between this Moodle course and a WeBWorK course.

4/ As before, the http://www.ufrmeca.univ-lyon1.fr/webwork2_wsdl seems OK, but the http://www.ufrmeca.univ-lyon1.fr/webwork2_rpc gives:

Bad Request
Your browser sent a request that this server could not understand.


Apache/1.3.34 Server at www.ufrmeca.univ-lyon1.fr Port 80

5/ I have checked the WSDL.pm file and at the beginning

use lib '/opt/webwork/webwork2/lib';

use Pod::WSDL;use WebworkSOAP;

use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and $ENV{MOD_PERL_API_VERSION} >= 2 );use constant RPC_URL => 'http://www.ufrmeca.univ-lyon1.fr/webwork2_rpc';

Does it meens that it required a mod-perl version >2.0 ?

I am running an apache 1.3. server with mode-perl 1.x ?


Marc

In reply to Marc BUFFAT

Re: WebWork and Moodle upgrade problem

by Michael Gage -
Hi Marc,

1/ but I cannot archive course: I got the following error
An error occured while archiving the course test: Failed to dump table 'test_set_locations' with command '2>&1 '' --defaults-extra-file=/tmp/DuQQItkmpp webwork24 test_set_locations > /opt/webwork/courses/test/DATA/mysqldump/set_locations.sql' (exit=72057594037927935 signal=127 core=128): sh: : Permission denied

I believe that I have tracked this bug down. Update the webwork2 directory

cvs update -r rel-2-4-patches -dP

and see if that fixes your problem.

This release rel-2-4-5 will remain fragile when archiving or unarchiving old courses (where the database structure is different from the current one).
I've tried to at least make it fail gracefully.

Test it out first by creating a new course, then archiving it, then deleting it,
then unarchiving it. That is working for me. You should report any errors on archiving older courses -- but we may not be able to fix those right away.


In reply to Michael Gage

Re: WebWork and Moodle upgrade problem

by Marc BUFFAT -
Hi Michael,

thanks for your reply
1/the problem of archiving the course is know solved:
*I had to run 24 times the wwdb_upgrade script in order to have all the tables in my webwork databbase (starting from a new webwork database)
*Comparing my database.conf and database.conf.dist I found that two lines were missing:
# kinda hacky, but needed for table dumping
mysql_path => $externalPrograms{mysql},
mysqldump_path => $externalPrograms{mysqldump},

2/ the moodle connection is still not solved
I selected WWASSIGNMENT_DEBUG=1 in the wwwassignement module and I got some php error, when I try to selected a webwork course
running the wwlink block, I can select a webwork course: test and I got the following message:

Notice: Undefined property: stdClass::$webwork_course in /home/www/html/moodle1.9/blocks/wwlink/block_wwlink.php on line 66

In the wwwlink block i read
Connected to WeBWorK Course

My webwork2.4 server is running with a test course at
http://www.ufrmeca.univ-lyon1.fr/webwork2

Thanks,

Marc




In reply to Marc BUFFAT

Re: WebWork and Moodle upgrade problem

by Michael Gage -
In the wwwlink block i read
Connected to WeBWorK Course

this indicates that for some reason you are not yet connected to the webwork course. -- the name of the course should follow that message and that name appears to be blank. It should look like the image below.

I can use wwlink to connect to your course. The first time I try to create a set I get a "communication error message". I've seen this before -- I'm pretty sure it is an initialization bug in the wwassignment4 software -- I'll track it down. When I try a second time to create a set it works and allows me to choose set demo from your "test" course.

When I try to view the questions in that set I get the
Bad Request
 Your browser sent a request that this server could not understand.

error you have referred to. I'll work on tracking that down as well. You may be able to find more detailed information in the error log on your server.

Here are the error messages I get from moodle:

[Mon Jun 30 08:32:57 2008] [error] PHP Notice: Undefined variable: userid in /Library/WebServer/Documents/moodle/mod/wwassignment/locallib.php on line 527
[Mon Jun 30 08:35:04 2008] [error] PHP Notice: Undefined index: result in /Library/WebServer/Documents/moodle/lib/soap/nusoap.php on line 5905

I'll keep looking at this -- see if you can duplicate my steps above and let me know about any error messages that appear in the server log that indicate why it is unable to handle the request.

-- Mike
Attachment screenshot_01.png
In reply to Marc BUFFAT

Re: WebWork and Moodle upgrade problem

by Michael Gage -
mod_perl version 2 is not required (I run apache 1.3 server also) but webwork should work with mod_perl version 2.

4/ As before, the http://www.ufrmeca.univ-lyon1.fr/webwork2_wsdl seems OK, but the http://www.ufrmeca.univ-lyon1.fr/webwork2_rpc gives:

Bad Request
Your browser sent a request that this server could not understand.

This is puzzling -- I believe that your server is working correctly although
I get no response at all when I use the url http://hosted2.webwork.rochester.edu/webwork2_rpc directly as a test.

The failure for moodle to connect probably has to do with the wwassign4 module in moodle and it's configuration. Send me an email when your server is on and I will try to connect to your server from my moodle installation. You can also try to connect your moodle to our server at http://hosted2.webwork.rochester.edu/....

That will give us some data to work with.


In reply to Michael Gage

Re: WebWork and Moodle upgrade problem

by Jim Logan -
http://online2.byu.edu/webwork2_rpc fails (as described above) in a new installation with perl 5.8.8, webwork 2.4.5, moodle 1.9.2, and using wwassignment4. While tracking down the problem I found the following comments in the file ...

     /usr/local/lib/perl5/site_perl/5.8.8/SOAP/Lite.pm

and wondering if this causes failure because of the following line in webwork.apache-config:

     PerlSetVar dispatch_to "WebworkSOAP"
-----------------------------------------------------
There is a bug in Perl 5.8's C{UNIVERSAL::AUTOLOAD} functionality that prevents the C{+autodispatch} functionality from working properly. The workaround is to use C{dispatch_from} instead. Where you might normally do something like this:

use Some::Module;
use SOAP::Lite +autodispatch =>
uri => 'urn:Foo'
proxy => 'http://...';

You would do something like this:

use SOAP::Lite dispatch_from(Some::Module) =>
uri => 'urn:Foo'
proxy => 'http://...';

If this is the problem, is there a workaround? Maybe go back to perl 5.6.2?

Thanks.
In reply to Jim Logan

Re: WebWork and Moodle upgrade problem

by Michael Gage -
I'm using perl 5.8.8, webwork 2.4.5, moodle 1.9.4+, and apache 1.3x without problems. First, are you using apache 1.3x or 2.x? I suspect this is a configuration problem but perhaps not the one you involving the perl bug.

Here are the relevant stanzas from my configuration file:

#WEBWORK SOAP CONFIGURATION
<Location /webwork2_rpc>
 PerlHandler Apache::SOAP
 SetHandler perl-script
 PerlSetVar dispatch_to "WebworkSOAP"
 PerlSetVar options "compress_threshold => 10000"
 Order Allow,Deny
 Allow from All
</Location>
#WEBWORK SOAP WSDL HANDLER :: TO BE REPLACED WITH A FILE FOR PRODUCTION SERVERS
<Location /webwork2_wsdl>
 PerlSetVar dispatch_to "WebworkSOAP::WSDL"
 PerlSetVar options "compress_threshold => 10000"
 PerlHandler WebworkSOAP::WSDL
 SetHandler perl-script
 Order Allow,Deny
 Allow from All
</Location>


Another thing to check is that the lines at the top of webwork2/lib/WebworkSOAP/WSDL.pm are correct ( the RPC_URL has to be set by hand :-( to your local server.)

package WebworkSOAP::WSDL;

use lib '/ww/webwork/webwork2/lib';
use Pod::WSDL;
use WebworkSOAP;

use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and $ENV{MOD_PERL_API_VERSION} >= 2 );
use constant RPC_URL => 'http://webwork.rochester.edu/webwork2_rpc';

-- Mike

 



In reply to Michael Gage

Re: WebWork and Moodle upgrade problem

by Jim Logan -
As usual, thanks for the quick response, Michael. We're using Apache v1.3.41, mod_perl v1.30, mod_ssl v2.8.31, OpenSSL v0.9.8e, and PHP v5.2.8.

Our configuration stanzas are the same as yours, except for the obvious domain differences, and included below for your inspection. We've tried http and https in the WSDL.pm file. Apparently our webwork.apache-config file is invoked, since we see the WSDL configuration when broswing to the location /webwork2_wsdl.

We're using perl module SOAP v0.71, and curious if you're using the same version of SOAP. Due to a perl compilation problem with Apache::Constants::OK, we had to change the following line in /SOAP/Transport/HTTP.pm from this:
$self->{OK} = &Apache::Constants::OK;
to this:
$self->{OK} = 0;
and a similar change in WeBWorK/ContentGenerator.pm, even though the Apache::Constants module is installed.

Other thoughts and suggestions? Thank you.

---------- Our WSDL.pm file, first part --------------------------------- package WebworkSOAP::WSDL;

use lib '/opt/webwork/webwork2/lib';
use Pod::WSDL;
use WebworkSOAP;

use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and $ENV{MOD_PERL_API_VERSION} >= 2 );
use constant RPC_URL => 'https://online2.byu.edu/webwork2_rpc';
------------ Our webwork.apache-config file, last part ------------------------- PerlModule WebworkSOAP

#WEBWORK SOAP CONFIGURATION
</Location /webwork2_rpc>
PerlHandler Apache::SOAP
SetHandler perl-script
PerlSetVar dispatch_to "WebworkSOAP"
PerlSetVar options "compress_threshold => 10000"
Order Allow,Deny
Allow from All
</Location>

#WEBWORK SOAP WSDL HANDLER :: TO BE REPLACED WITH A FILE FOR PRODUCTION SERVERS
</Location /webwork2_wsdl>
PerlSetVar dispatch_to "WebworkSOAP::WSDL"
PerlSetVar options "compress_threshold => 10000"
PerlHandler WebworkSOAP::WSDL
SetHandler perl-script
Order Allow,Deny
Allow from All
</Location>
In reply to Jim Logan

Re: WebWork and Moodle upgrade problem

by Michael Gage -
What does the apache log file say when you send the url

https://online2.byu.edu/webwork2_rpc

(or the http version).

I can see that one can reach the WSDL file without a problem.

--Mike
In reply to Michael Gage

Re: WebWork and Moodle upgrade problem

by Jim Logan -
The access log with http or https in WSDL.pm shows an access code of 400, bad request:

10.5.91.10 - - [21/Apr/2009:15:11:09 -0600] "GET /webwork2_rpc HTTP/1.1" 400 299 "-" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv:1.9.0.8) Gecko/2009032608 Firefox/3.0.8"

The error log gets no entry.

We're going to try upgrading our perl SOAP module, and report back.

Thanks.
In reply to Jim Logan

Re: WebWork and Moodle upgrade problem

by Michael Gage -
We're using SOAP.pm version 1.2 which might be relevant:

# $Id: SOAP.pm,v 1.2 2004/11/14 19:30:49 byrnereese Exp $

-- Mike

In reply to Michael Gage

Re: WebWork and Moodle upgrade problem

by Jim Logan -
The SOAP.pm version and developer name (byrnereese) was very helpful ...

The problem was fixed by installing the CPAN module SOAP-Lite-0.69, instead of the FreeBSD 7.1 default (latest version) SOAP-Lite-0.710.08.

Thanks, Mike!