Error message entering new resources

11 posts / 0 new
Last post
mbeckstrom
Error message entering new resources

I have a brand-new,  barely configured installation of 3.9.1 on a SuSe linux server.  I am attempting to create a new resource, but when I click on the add resource button, I get the following error message:

Uncaught Exception
Message: Attempt to load Resource with unknown ID (-1).
Location: lib/ScoutLib/Item.php[48]
Trace:

#0 objects/Resource.php(27): Item->__construct(-1)
#1 objects/Resource.php(73): Resource->__construct(-1)
#2 pages/EditResource.php(51): Resource::Create(0)
#3 lib/ScoutLib/ApplicationFramework.php(585): include('/srv/www/htdocs...')
#4 index.php(65): ApplicationFramework->LoadPage('EditResource')
#5 {main}

I am on PHP5 with Apache 2.  I have another cwis 3.9.1 server running in another folder, and it works great. 

Any ideas?

Matt

chalpin
Re: Error message entering new resources

What version of mysql are you running?  And which exact version of PHP (e.g., 5.4.45, 5.5.38, etc)?

When you ran the installation, there were no errors or warnings and you have the sample resources? The installer uses the same Resource::Create() call that pages/EditResource does; I would have expected the installer to error out if that call were failing.

If you run the following SQL against your database (e.g., with the mysql command-line tool), does it succeed or give an error?

INSERT INTO Resources SET ResourceId='-1', SchemaId='0', DateLastModified=NOW();

(This is the SQL that should have been run on line 63 of Resource::Create(), just prior to the new Resource() call on line 73 that is failing for you.)

mbeckstrom
Re: Error message entering new resources

Thanks for the quick response!  I should have inlcuded that information, my apologies. 

I have Mysql version 5.0.94, PHP version 5.6.27.

Installation was normal, and I had the sample entries, but I did get an error message when I wanted to delete the sample entries using the administration option.  The error is: Parse error: syntax error, unexpected '{', expecting '(' in /srv/www/htdocs/cwis2/pages/PurgeSampleDataExecute.php on line 94

When I run that command against the database, I get the following error:

ERROR 1364 (HY000): Field 'DateOfRecordCreation' doesn't have a default value

 

 

 

chalpin
Re: Error message entering new resources

Regarding PurgeSampleDataExecute.php, if you change line 93 from catch to catch (Exception $e), that should resolve the problem.  Thank you for reporting this, we'll have it fixed in the next CWIS release.

The SQL error is... perplexing. The Resources table is created by install/CreateTables.sql, and line 308 in that file gives gives a DEFAULT NULL for DateOfRecordCreation. If you run SHOW CREATE TABLE Resources, does it list a DEFAULT for DateOfRecordCreation?

Is it possible that the database you are using was created by an earlier version of CWIS?  The 'DEFAULT NULL' wasn't always there for DoRC, we added it in May 2015 to appease versions of MySQL in which sql_mode defaults to STRICT_TRANS_TABLES (previously it had been TRADITIONAL, which wasn't so fussy about requiring defaults for everything).

mbeckstrom
Re: Error message entering new resources

I checked the Resources table, and the default for DateOfRecordCreation is not set to null. 

I think I did install the current version of CWIS and then upgraded it to the 3.9.1 version.  I did the same thing when I installed the other copy I have running because it had some feature that I wanted or needed. 

I tried to update the table to add DEFAULT null to the Resources table, and that made things worse.  Apparently my Mysql skills are lacking.  I will try to restore the table.  If not, I will reinstall the application.  I had no records in yet anyway!

Matt

mbeckstrom
Re: Error message entering new resources

I was not able to restore the table, so I just re-installed the application.  Now I am getting an error message during the install.  It gets to "initializing application framework" and then throws this error:

Uncaught Exception
Message: Attempt to load metadata schema with invalid ID (0) at MetricsRecorder.php:46.
Location: objects/MetadataSchema.php[89]
Trace:

#0 plugins/MetricsRecorder.php(46): MetadataSchema->__construct()
#1 lib/ScoutLib/PluginManager.php(550): MetricsRecorder->Initialize()
#2 lib/ScoutLib/PluginManager.php(99): PluginManager->ReadyPlugin(Object(MetricsRecorder))
#3 include/StartUp.php(120): PluginManager->LoadPlugins()
#4 installcwis.php(822): require_once('/srv/www/htdocs...')
#5 installcwis.php(1773): InitializeAF()
#6 {main}

Any ideas on that one?

Thanks!

Matt

 

chalpin
Re: Error message entering new resources

Looks like you've still got a 'VERSION' file in your site directory from your earlier install. This file makes CWIS think you're doing an upgrade or possibly a reinstall, such that there will be existing data in your database. When no such data exists, it casues the above exception.

It should work to just delete the VERSION file and try again, but I'd suggest completely wiping out the earlier installation (i.e., rm -rf your site folder and drop the database) to be sure you're really starting from scratch, without any leftover bits of the previous install for the new one to trip on.

mbeckstrom
Re: Error message entering new resources

Actually, I did.  I dropped the mysql tables and deleted the directories. This error message is from a brand-new freshly downloaded installation.

 

 

chalpin
Re: Error message entering new resources

Can you attach a copy of your local/logs/install.log ?

mbeckstrom
Re: Error message entering new resources

Attached.

chalpin
Re: Error message entering new resources

There doesn't appear to be an attachment.