OJS 3.1.2 OAI jats resumptionToken - http error 500

Hi, in one of journal we have problem with error (blank page) when we want to resume resumption Token

http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats

in php error we get:

[Wed Feb 17 14:51:19.977654 2021] [php7:warn] [pid 591] [client 150.254.100.155:59740] PHP Warning: OAIMetadataFormat_JATS::_mungeMetadata(): unterminated entity reference FIRST RESPONSE TEAM IN RELATION TO SAFEGUARDING REFERRALS REGARDING YOUNG PEOPLE SUPERVISED BY THE YOUTH JUSTICE SERVICE in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 245
[Wed Feb 17 14:55:18.419699 2021] [php7:warn] [pid 836] [client 150.254.100.155:59752] PHP Warning: Declaration of AddThisPlugin::register($category, $path) should be compatible with LazyLoadPlugin::register($category, $path, $mainContextId = NULL) in /var/www/ojs/plugins/generic/addThis/AddThisPlugin.inc.php on line 0, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Wed Feb 17 14:55:18.469485 2021] [php7:warn] [pid 836] [client 150.254.100.155:59752] PHP Warning: Declaration of JournalOAI::sets($offset, $limit, &$total) should be compatible with OAI::sets($offset, &$total) in /var/www/ojs/classes/oai/ojs/JournalOAI.inc.php on line 0, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Wed Feb 17 14:55:18.583167 2021] [php7:warn] [pid 836] [client 150.254.100.155:59752] PHP Warning: Declaration of SubmissionKeywordEntryDAO::getByControlledVocabId($controlledVocabId, $rangeInfo = NULL) should be compatible with ControlledVocabEntryDAO::getByControlledVocabId($controlledVocabId, $rangeInfo = NULL, $filter = NULL) in /var/www/ojs/lib/pkp/classes/submission/SubmissionKeywordEntryDAO.inc.php on line 20, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Wed Feb 17 14:55:19.201264 2021] [php7:warn] [pid 836] [client 150.254.100.155:59752] PHP Warning: DOMDocument::loadXML(): PCDATA invalid Char value 31 in Entity, line: 78 in /var/www/ojs/plugins/generic/jatsTemplate/JatsTemplatePlugin.inc.php on line 56, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Wed Feb 17 14:55:19.201402 2021] [php7:notice] [pid 836] [client 150.254.100.155:59752] PHP Notice: Trying to get property ‘nodeName’ of non-object in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 116, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Wed Feb 17 14:55:19.201418 2021] [php7:notice] [pid 836] [client 150.254.100.155:59752] PHP Notice: Undefined index: in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 116, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Wed Feb 17 14:55:19.201430 2021] [php7:warn] [pid 836] [client 150.254.100.155:59752] PHP Warning: array_search() expects parameter 2 to be array, null given in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 117, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Wed Feb 17 14:55:19.201440 2021] [php7:warn] [pid 836] [client 150.254.100.155:59752] PHP Warning: array_slice() expects parameter 1 to be array, null given in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 120, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Wed Feb 17 14:55:19.201449 2021] [php7:notice] [pid 836] [client 150.254.100.155:59752] PHP Notice: Trying to get property ‘childNodes’ of non-object in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 122, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Wed Feb 17 14:55:19.201458 2021] [php7:warn] [pid 836] [client 150.254.100.155:59752] PHP Warning: Invalid argument supplied for foreach() in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 122, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Wed Feb 17 14:55:19.201601 2021] [php7:error] [pid 836] [client 150.254.100.155:59752] PHP Fatal error: Uncaught Error: Call to a member function insertBefore() on null in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php:129\nStack trace:\n#0 /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php(146): OAIMetadataFormat_JATS->_addChildInOrder(NULL, Object(DOMElement))\n#1 /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php(96): OAIMetadataFormat_JATS->_mungeMetadata(Object(DOMDocument), Object(Journal), Object(PublishedArticle), Object(Section), Object(Issue))\n#2 /var/www/ojs/lib/pkp/classes/oai/OAI.inc.php(785): OAIMetadataFormat_JATS->toXml(Object(OAIRecord))\n#3 /var/www/ojs/lib/pkp/classes/oai/OAI.inc.php(530): OAI->formatMetadata(‘jats’, Object(OAIRecord))\n#4 /var/www/ojs/lib/pkp/classes/oai/OAI.inc.php(85): OAI->ListRecords()\n#5 /var/www/ojs/pages/oai/OAIHandler.inc.php(39): OAI->execute()\n#6 /var/www/ojs/lib/pkp/classes/core/PKPRouter.inc.php(390): OAIHandler->index(Array, Object(Request))\n#7 /var/www/ojs/lib/pkp/classes/core/PK in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 129, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats

I checked solution from here OJS 3.2.0 - OAI ListRecords causes PHP Fatal Error · Issue #5573 · pkp/pkp-lib · GitHub but it doesn’t work for me.

OJS 3.1.2-4
PHP 7
Jats Template 1.0.3.0
oaiJats 1.0.2.0

best regards,
Paweł

Hi @Pawel2020,

I’ve filed that issue here:

You should be able to resolve it by applying the appropriate patch for your version of OJS. Can you try it and report back whether it resolves the issue?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi,
thanks for the answer, I have uploaded the patch. Unfortunately it didn’t work. I’m sending the log:

http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Fri Mar 19 14:46:02.146573 2021] [php7:warn] [pid 23092] [client 150.254.100.155:10741] PHP Warning: Declaration of JournalOAI::sets($offset, $limit, &$total) should be compatible with OAI::sets($offset, &$total) in /var/www/ojs/classes/oai/ojs/JournalOAI.inc.php on line 0, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Fri Mar 19 14:46:02.236079 2021] [php7:warn] [pid 23092] [client 150.254.100.155:10741] PHP Warning: Declaration of SubmissionKeywordEntryDAO::getByControlledVocabId($controlledVocabId, $rangeInfo = NULL) should be compatible with ControlledVocabEntryDAO::getByControlledVocabId($controlledVocabId, $rangeInfo = NULL, $filter = NULL) in /var/www/ojs/lib/pkp/classes/submission/SubmissionKeywordEntryDAO.inc.php on line 20, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Fri Mar 19 14:46:02.753994 2021] [php7:warn] [pid 23092] [client 150.254.100.155:10741] PHP Warning: DOMDocument::loadXML(): PCDATA invalid Char value 31 in Entity, line: 78 in /var/www/ojs/plugins/generic/jatsTemplate/JatsTemplatePlugin.inc.php on line 56, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Fri Mar 19 14:46:02.754109 2021] [php7:notice] [pid 23092] [client 150.254.100.155:10741] PHP Notice: Trying to get property ‘nodeName’ of non-object in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 116, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Fri Mar 19 14:46:02.754125 2021] [php7:notice] [pid 23092] [client 150.254.100.155:10741] PHP Notice: Undefined index: in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 116, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Fri Mar 19 14:46:02.754147 2021] [php7:warn] [pid 23092] [client 150.254.100.155:10741] PHP Warning: array_search() expects parameter 2 to be array, null given in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 117, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Fri Mar 19 14:46:02.754158 2021] [php7:warn] [pid 23092] [client 150.254.100.155:10741] PHP Warning: array_slice() expects parameter 1 to be array, null given in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 120, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Fri Mar 19 14:46:02.754167 2021] [php7:notice] [pid 23092] [client 150.254.100.155:10741] PHP Notice: Trying to get property ‘childNodes’ of non-object in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 122, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Fri Mar 19 14:46:02.754176 2021] [php7:warn] [pid 23092] [client 150.254.100.155:10741] PHP Warning: Invalid argument supplied for foreach() in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 122, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats
[Fri Mar 19 14:46:02.754314 2021] [php7:error] [pid 23092] [client 150.254.100.155:10741] PHP Fatal error: Uncaught Error: Call to a member function insertBefore() on null in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php:129\nStack trace:\n#0 /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php(146): OAIMetadataFormat_JATS->_addChildInOrder(NULL, Object(DOMElement))\n#1 /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php(96): OAIMetadataFormat_JATS->_mungeMetadata(Object(DOMDocument), Object(Journal), Object(PublishedArticle), Object(Section), Object(Issue))\n#2 /var/www/ojs/lib/pkp/classes/oai/OAI.inc.php(785): OAIMetadataFormat_JATS->toXml(Object(OAIRecord))\n#3 /var/www/ojs/lib/pkp/classes/oai/OAI.inc.php(530): OAI->formatMetadata(‘jats’, Object(OAIRecord))\n#4 /var/www/ojs/lib/pkp/classes/oai/OAI.inc.php(85): OAI->ListRecords()\n#5 /var/www/ojs/pages/oai/OAIHandler.inc.php(39): OAI->execute()\n#6 /var/www/ojs/lib/pkp/classes/core/PKPRouter.inc.php(390): OAIHandler->index(Array, Object(Request))\n#7 /var/www/ojs/lib/pkp/classes/core/PK in /var/www/ojs/plugins/oaiMetadataFormats/oaiJats/OAIMetadataFormat_JATS.inc.php on line 129, referer: http://150.254.115.151/index.php/sr/oai?verb=ListRecords&metadataPrefix=jats

Regards, Paweł

Hi @Pawel2020,

I believe the key message is this one:

Warning: DOMDocument::loadXML(): PCDATA invalid Char value 31 in Entity, line: 78

It looks as though the OAI JATS plugin is trying to load a JATS document that is uploaded to one of your submissions, but is unable to parse it. The other errors/messages follow from there. I would suggest validating the XML attached to that submission.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

I don’t know if I understood correctly, the error is caused by the xml file attached to the some submissions?.

I validate https://pressto.amu.edu.pl/index.php/sr/oai on https://validator.oaipmh.com/ ListRecordsJats - and it looks good.

I also check in import/export tools CrossRef XML Export Plugin, and whole submission have status active, that suggest that there is no error I think.

I checked many submission, and I did not find any attached xml file.

Maybe I don’t understand something or I’m looking for something wrong?

Regards, Paweł

Hi @Pawel2020,

You should be able to identify what XML file is causing the problem by editing OAIMetadataFormat_JATS.inc.php to add some debug information. Find:

$doc->loadXML(file_get_contents($candidateFile->getFilePath()));

…and add a new line just before this:

error_log('Loading XML file: ' . $candidateFile->getFilePath());

This should cause the path to be logged to the PHP error log just before it is loaded by the XML parser.

Regards,
Alec Smecher
Public Knowledge Project Team

For first many thanks fot help about this.

I found solution, after many days :). That was problem in references with single chars, which would not be visible in ojs, and then you could find them by copying the whole thing to an external editor like notepad ++ and check line by line. In my references it was ascii char and invisible char “us”.

Regards,
Paweł

Hi @Pawel2020,

Glad it’s resolved, and thanks for the follow-up!

Regards,
Alec Smecher
Public Knowledge Project Team