Installation

Can't locate Mojolicious/WeBWorK/Controller/Home.pm

Can't locate Mojolicious/WeBWorK/Controller/Home.pm

by Andras Balogh -
Number of replies: 7

I am trying to test internally the installation of  2.19 with Mojolicious App in /opt/webwork

from the terminal window w3m http://127.0.0.1/webwork2/ throw server error.

The log file  /opt/webwork/webwork2/logs/webwork2.log shows

[error] [Jx9Gw0LpnNva] Can't locate Mojolicious/WeBWorK/Controller/Home.pm:   /opt/webwork/pg/lib/Mojolicious/WeBWorK/Controller/Home.pm: Permission denied at (eval 819) line 1.

The directory /opt/webwork/pg/lib/ does not have subdirectory Mojolicious

There is a directory /opt/webwork/webwork2/lib/Mojolicious/WeBWorK, but that directory does not have  Controller/Home.pm

I did find a Home.pm file in subdirectory 
/opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Home.pm

The beginning of the log file  /opt/webwork/webwork2/logs/webwork2.log shows

WeBWorK server is starting

WeBWorK root directory set to /opt/webwork/webwork2
PG root directory set to /opt/webwork/pg
The webwork url on this site is http://127.0.0.1/webwork2
Listening at "http://*:80"
Manager 124777 started
Worker 124778 started
...
Creating process id file "/run/webwork2/webwork2.pid"



In reply to Andras Balogh

Re: Can't locate Mojolicious/WeBWorK/Controller/Home.pm

by Andras Balogh -

I am still stuck at this point with webwork2 service via hypnotoad not working.

I found two files named Home.pm :

/opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Home.pm
/usr/share/perl5/Mojo/Home.pm


In reply to Andras Balogh

Re: Can't locate Mojolicious/WeBWorK/Controller/Home.pm

by Glenn Rice -

The file it is looking for is /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Home.pm.  In /opt/webwork/webwork2/lib/Mojolicious/WeBWorK.pm the WeBWorK::ContentGenerator namespace is added to the list of modules namespaces to use for controller files.

You were testing this before using some directory other /opt/webwork, right?  I suspect you still have some remnant of that setup in your configuration files.  I don't really know what is going wrong though.  This isn't a problem that I have encountered.

In reply to Glenn Rice

Re: Can't locate Mojolicious/WeBWorK/Controller/Home.pm

by Andras Balogh -

Strangely, this might have been the result of a mistyped domain name, although I have other related issues that I will explain in a separate post. 

In reply to Glenn Rice

Re: Can't locate Mojolicious/WeBWorK/Controller/Home.pm

by George Jennings -

Did you guys figure out what causes this problem with WW2.19?  I'm having the same problem, using a directory that's not /opt to contain WeBWorK.  (My computer is not accessible from the internet; I just use it to fix broken WW problems and then upload the fixed problems to the OPL).  Here's the relevant part of my log file:

[2025-03-04 16:03:57.03859] [1981] [info] WeBWorK server is starting
[2025-03-04 16:03:57.03893] [1981] [info] WeBWorK root directory set to /home/gj
ennings/webwork/webwork2
[2025-03-04 16:03:57.03895] [1981] [info] PG root directory set to /home/gjennin
gs/webwork/pg
[2025-03-04 16:03:57.03896] [1981] [info] The webwork url on this site is http:/
/localhost/webwork2
[2025-03-04 16:03:57.10919] [1981] [info] Listening at "http://*:80"
[2025-03-04 16:03:57.11249] [2242] [info] Manager 2242 started
[2025-03-04 16:03:57.11541] [2243] [info] Worker 2243 started
[2025-03-04 16:03:57.11905] [2244] [info] Worker 2244 started
(...several more lines like the previous line)

[2025-03-04 16:03:57.16786] [2242] [info] Creating process id file "/run/webwork2/webwork2.pid"
[2025-03-04 16:03:57.16798] [2271] [info] Worker 2271 started
[2025-03-04 16:13:36.62625] [2269] [error] [ntiXY3a20fgc] Can't locate Mojolicious/WeBWorK/Controller/Home.pm:   /home/gjennings/webwork/pg/lib/Mojolicious/WeBWorK/Controller/Home.pm: Permission denied at (eval 819) line 1.

It can't find he file because it should be looking for it in the WeBWorK root directory, not the PG root directory.

In reply to George Jennings

Re: Can't locate Mojolicious/WeBWorK/Controller/Home.pm

by Glenn Rice -

Webwork2 automatically detects its root directory from the current working directory.  So if you are using the systemd webwork2.service file, then you need to change /opt/webwork everywhere in that file to the directory where webwork is located.  If you  are running morbo or hypnotoad manually, then you must do so from the webwork2 directory.

Also check that permissions are set correctly for all files in the webwork2 directory.  All files need to be readable by the server user, but only the DATA, logs, and htdocs/tmp directories should be writable by server user.

Another thing to check is that you have pg_dir set correctly in webwork2.mojolicious.yml, and that you do NOT have $pg_dir set in site.conf (or any other configuration file).

I am able to successfully run webwork2 from a directory other than /opt/webwork using the default configuration files and only modifying $server_root_url and $database_password in site.conf, pg_dir in webwork2.mojolicious.yml, and the directories in the webwork2.service file.

In reply to Glenn Rice

Re: Can't locate Mojolicious/WeBWorK/Controller/Home.pm

by George Jennings -
You're right, it *was* permissions. Instead of /opt I was using my home directory, which wasn't world-readable.
In reply to George Jennings

Re: Can't locate Mojolicious/WeBWorK/Controller/Home.pm

by Andras Balogh -


If I remember correctly, in site.conf the  $server_root_url contained a mistyped domain name.

Is this supposed to be correct for you: http://localhost/webwork2