Import/Export between OJS 3 instances failing

When importing an issue exported from another OJS instance, it is failing with the error:

# php tools/importExport.php NativeImportExportPlugin import /tmp/issue.xml journal admin
PHP Notice:  Undefined offset: -1 in /var/www/html/plugins/importexport/native/filter/NativeXmlSupplementaryFileFilter.inc.php on line 78
PHP Fatal error:  Call to a member function setDescription() on null in /var/www/html/plugins/importexport/native/filter/NativeXmlSupplementaryFileFilter.inc.php on line 78

The export statement is:

# php tools/importExport.php NativeImportExportPlugin export issue.xml journal issue 34

I have validated with xmllint and, besides a missing DTD warning, it validates.

Using the WebUI to import simply results in neither a success nor failure message and there is nothing in the error logs.

Any help much appreciated.

Thanks

Hayden Young
KnowledgeArc Ltd
http://knowledgearc.com

Hi @haydenyoung

Both instances are OJS 3.1 ? Which is your webserver conf?
When you ran in web based mode did you take a look in your php error log?

Regards,
Israel Cefrin
Public Knowledge Project Team

Hi

I have upgraded OJS I am importing into from 3.1.0.0 to 3.1.0.1 so both source and destination are running the latest 3.x version. Running the importer again, I get the same error on the command line:

# php5.6 tools/importExport.php NativeImportExportPlugin import /tmp/issue.xml journal admin
PHP Notice:  Undefined offset: -1 in /var/www/html/plugins/importexport/native/filter/NativeXmlSupplementaryFileFilter.inc.php on line 78
PHP Fatal error:  Call to a member function setDescription() on null in /var/www/html/plugins/importexport/native/filter/NativeXmlSupplementaryFileFilter.inc.php on line 78

It looks like the issue imports as I can see something in Back Issues but it has no title, I get Vol No () and there is no information within the issue (no galley, issue data, etc). The number of items are correct.

Trying to import a different issue gives me a different set of warnings and no Back Issue is created:

PHP Warning:  DOMDocument::loadXML(): Memory allocation failed : growing buffer in /var/www/html/lib/pkp/classes/xslt/XMLTypeDescription.inc.php on line 120
PHP Warning:  DOMDocument::loadXML(): Memory allocation failed : growing buffer in /var/www/html/lib/pkp/classes/xslt/XMLTypeDescription.inc.php on line 120
PHP Warning:  DOMDocument::schemaValidate(): The document has no document element. in /var/www/html/lib/pkp/classes/xslt/XMLTypeDescription.inc.php on line 133

I have also tried through the web ui. The first error was memory related so I pumped it to 512M to solve it:

[Fri Dec 22 15:42:04.834889 2017] [:error] [pid 1575] [client 121.44.38.108:48092] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 49514751 bytes) in /var/www/html/lib/pkp/classes/db/DAO.inc.php on line 87, referer: .../journal/management/importexport/plugin/NativeImportExportPlugin

Next I got:

[Fri Dec 22 15:43:05.709933 2017] [:error] [pid 1778] [client 121.44.38.108:48184] PHP Fatal error: Call to a member function setDescription() on null in /var/www/html/plugins/importexport/native/filter/NativeXmlSupplementaryFileFilter.inc.php on line 78, referer: …/journal/management/importexport/plugin/NativeImportExportPlugin

This results in the same as the command line outcome, I.e. an empty issue with no name (Vol No ()).

Thanks

Was there any solution to this?

Hi @haydenyoung,

Is there a reason you’re using the import/export tools to upgrade your OJS contents? The upgrade tool is a much better thing to use for this.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

We’re not using it to upgrade OJS contents, we’re using it to import back issues that were added to another journal. Rather than have two separate journals, we would like to consolidate everything into one.

Thanks.

1 Like

Hi all,

Regarding the error message:

PHP Fatal error: Call to a member function setDescription() on null in /var/www/html/plugins/importexport/native/filter/NativeXmlSupplementaryFileFilter.inc.php on line 78, referer: …/journal/management/importexport/plugin/NativeImportExportPlugin

Could someone turn on the show_stacktrace setting in config.inc.php, trigger the error, and post the resulting stack trace?

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Above statements are from OJS configurations with show_stacktrace = on.

I re-ran to check again and the output in the logs is the same:

[Mon Jan 08 07:58:10.209167 2018] [:error] [pid 2075] [client 121.44.38.108:47580] PHP Notice:  Undefined offset: -1 in /var/www/html/plugins/importexport/native/filter/NativeXmlSupplementaryFileFilter.inc.php on line 78, referer: http://.../management/importexport/plugin/NativeImportExportPlugin
[Mon Jan 08 07:58:10.209291 2018] [:error] [pid 2075] [client 121.44.38.108:47580] PHP Fatal error:  Call to a member function setDescription() on null in /var/www/html/plugins/importexport/native/filter/NativeXmlSupplementaryFileFilter.inc.php on line 78, referer: http://.../management/importexport/plugin/NativeImportExportPlugin

Thanks

Hi @haydenyoung,

Do you have a supplementary file entry in your XML that doesn’t have a corresponding submission_file element?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi

Grepped for submission_file and looks fine:

  <submission_file xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" stage="submission" id="4251" xsi:schemaLocation="http://pkp.sfu.ca native.xsd">
  </submission_file>
  <submission_file xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" stage="review_file" id="4253" xsi:schemaLocation="http://pkp.sfu.ca native.xsd">
  </submission_file>
  <submission_file xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" stage="copyedit" id="4254" xsi:schemaLocation="http://pkp.sfu.ca native.xsd">
  </submission_file>
  <submission_file xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" stage="proof" id="4255" xsi:schemaLocation="http://pkp.sfu.ca native.xsd">
  </submission_file>

I tried running xmllint against the file and got:

# xmllint --huge --valid --noout /tmp/issue-32.xml
/tmp/issue-32.xml:2: validity error : Validation failed: no DTD found !
 current="0" access_status="0" xsi:schemaLocation="http://pkp.sfu.ca native.xsd"
                                                                               ^

Not sure if this is related to the initial problem.

Importing a different issue I’m seeing a new error:

##plugins.importexport.common.errorsOccured##
1.##submission.submission##
- ##plugins.importexport.native.error.unknownSection##

This is related to section_ref? Could it be that these two issues are related?

Further to my above post, I have tracked down the problem:

File is: plugins/importexport/native/filter/NativeXmlArticleFilter.inc.php

Line 65

The method getByAbbrev is returning null (I’m assuming it should find the section which corresponds with the section_ref). The section does exist in the xml but is it the case that it is not being created in the db prior to the article xml element being parsed?

I have tracked down the issue to this error also:

The description tag has a locale. When NativeXmlSupplementaryFileFilter’s handleChildElement is called, Line 73, description is handled by the if conditional. This conditional has an empty array on Line 78, $submissionFiles so the $setterFunction call fails trying to call a method on null. I tried working out what $submissionFiles should be populated with but it looks like it is always empty.

Hi @haydenyoung

Concerning this:

You have tried to import an issue, correct? In that issue import XML, the sections part comes before articles part, correct? Was there a section element with that abbrev element (that was referenced in that article element) in that XML file, e.g.:

<issue ...>
...
<sections>
<section...>
...
<abbrev locale="en_US">ART</abbrev>
...
</section>
</sections>
<articles...>
<article... section_ref="ART"...>
...

?

Thanks!
Bozana

Hi @haydenyoung

Regarding this issue:

Does your import XML file has the revision element as a first child element of each supplementary_file element, e.g.:

<supplementary_file ...>
<revision ...>
...
</revision>
<creator locale="en_US">Creator EN</creator>
<subject locale="en_US">Subject 1 EN; Subject 2 EN; Subject 3 EN</subject>
<description locale="en_US">Description EN</description>
...

?
Because the array in the line 78, should be populated earlier, here: https://github.com/pkp/pkp-lib/blob/ojs-3_1_0-1/plugins/importexport/native/filter/NativeXmlSubmissionFileFilter.inc.php#L93-L96, called from here: https://github.com/pkp/pkp-lib/blob/ojs-3_1_0-1/plugins/importexport/native/filter/NativeXmlSubmissionFileFilter.inc.php#L75.

Thanks a lot!
Bozana

Hi @haydenyoung

Regarding the supp file import failure: could you apply the patch from this issue [OJS 3.1.0.0] Native XML import fails on batch insert · Issue #3276 · pkp/pkp-lib · GitHub ? – it should improve the error handling, so that other errors, that happened earlier can be displayed, instead of exiting/terminating the execution…

Best,
Bozana

Hi @bozana

Thanks for the replies. I’ll need to spin up another OJS and test.

Thanks

Hayden