Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-62654

Liferay Upgrade error: VerifyJournal: Unable to update content for article <xy> (NullPointerException)

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Won't Fix
    • Affects Version/s: 6.2.0 CE GA1, 6.2.4 CE GA5, 6.2.5 CE GA6
    • Fix Version/s: None
    • Component/s: ~[Archived] WCM
    • Labels:
      None
    • Databases:
      PostgreSQL 9.3

      Description

      We are using 6.2.0 CE GA1 with dynamic data structures. After upgrading directly to 6.2 CE GA5 (later failed with GA 6 too, identical behaviour) exceptions were raised on the first startup during verification/upgrade process.
      "Unable to update content for article <xy>
      java.lang.NullPointerException
      at com.liferay.portal.verify.VerifyJournal.updateDynamicElements(VerifyJournal.java:106)"

      On second and further startup no errors occur. The affected articles (containing DDM structures) are no longer shown on the web presence, probaly due to the failed/skipped transformation. They are sill visible in the web content section of the site administration.

      The cause of this problem is probably an missing type attribute in the xml representation of stored integer values (DDM). This results in a NULL return from attributeValue("type") and so in a exception on 'if (type.equals("image")) {' (line 106) (more details below the stack trace)
      According to http://dom4j.sourceforge.net/dom4j-1.6.1/apidocs/org/dom4j/Element.html#attributeValue%28java.lang.String%29 the method dynamicElement.attributeValue returns NULL if the requested attribute is not available as it is the case for integer values. As consequence the type check fails with NullPointerException

      Creating a new structure/template definition and new content including integer values within GA5 or GA6 created the missing type attributes (type="ddm-integer") in contrast to GA1.
      GA6 shows the identical errors as GA5. Both versions tested with the same db dump and the same quick fix.

      Steps to reproduce it: (not tested due to missing machine to run another instance)

      • GA1: Creating a DDM structure/template and content with an integer value.
        structure definition xml will include type, content xml will not include type attribute
      • Stopping liferay
      • Upgrade to GA5:
      • Starting liferay

      Possible fix unless new release is available:
      (in our case all values without type attribute were integers, maybe other types are also affected)

      • Stop liferay
      • Dump database
      • Modify dump (adding type="ddm-integer" where no type is defined)
        In our case the following command worked, affected only the entries causing problems and the first startup caused no errors, all content was visible as expected
        sed -i – 's/index="0" index-type="keyword"/index="0" type="ddm-integer" index-type="keyword"/g' db.pgdump
      • Restore dump
      • Start liferay

      Further details:

      • Stack trace
      • VerifyJournal.java snippet
      • ddmstructure definition example (correct)
      • journalarticle content example (missing type for integer value)

      ==============
      Stack Trace

      Starting Liferay Portal Community Edition 6.2 CE GA5 (Newton / Build 6204 / November 25, 2015)
      ...
      17:31:55,586 ERROR [localhost-startStop-1][VerifyJournal:379] Unable to update content for article 43701
      java.lang.NullPointerException
              at com.liferay.portal.verify.VerifyJournal.updateDynamicElements(VerifyJournal.java:106)
              at com.liferay.portal.verify.VerifyJournal.verifyDynamicElements(VerifyJournal.java:402)
              at com.liferay.portal.verify.VerifyJournal$1.performAction(VerifyJournal.java:376)
              at com.liferay.portal.kernel.dao.orm.BaseActionableDynamicQuery.performActionsInSingleInterval(BaseActionableDynamicQuery.java:324)
              at com.liferay.portal.kernel.dao.orm.BaseActionableDynamicQuery.performActions(BaseActionableDynamicQuery.java:46)
              at com.liferay.portal.verify.VerifyJournal.verifyDynamicElements(VerifyJournal.java:388)
              at com.liferay.portal.verify.VerifyJournal.doVerify(VerifyJournal.java:81)
              at com.liferay.portal.verify.VerifyProcess.verify(VerifyProcess.java:68)
              at com.liferay.portal.verify.VerifyProcess.verify(VerifyProcess.java:76)
              at com.liferay.portal.verify.VerifyProcessSuite.doVerify(VerifyProcessSuite.java:45)
              at com.liferay.portal.verify.VerifyProcess.verify(VerifyProcess.java:68)
              at com.liferay.portal.verify.VerifyProcessUtil._verifyProcess(VerifyProcessUtil.java:111)
              at com.liferay.portal.verify.VerifyProcessUtil._verifyProcess(VerifyProcessUtil.java:76)
              at com.liferay.portal.verify.VerifyProcessUtil.verifyProcess(VerifyProcessUtil.java:46)
              at com.liferay.portal.events.StartupHelper.verifyProcess(StartupHelper.java:146)
              at com.liferay.portal.events.StartupHelperUtil.verifyProcess(StartupHelperUtil.java:67)
              at com.liferay.portal.tools.DBUpgrader.verify(DBUpgrader.java:240)
              at com.liferay.portal.events.StartupAction.doRun(StartupAction.java:231)
              at com.liferay.portal.events.StartupAction.run(StartupAction.java:74)
              at com.liferay.portal.servlet.MainServlet.processStartupEvents(MainServlet.java:1246)
              at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:231)
              at javax.servlet.GenericServlet.init(GenericServlet.java:158)
              at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
              at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
              at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
              at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5266)
              at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5554)
              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
              at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
              at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
              at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
              at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:677)
              at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1912)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
              at java.util.concurrent.FutureTask.run(FutureTask.java:262)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at java.lang.Thread.run(Thread.java:745)
      

      VerifyJournal.java (line 90-112)

      Bar.java
      090 protected void updateDynamicElements(List<Element> dynamicElements)
      091		throws PortalException, SystemException {
      092
      093		DDMFieldsCounter ddmFieldsCounter = new DDMFieldsCounter();
      094
      095		for (Element dynamicElement : dynamicElements) {
      096			updateDynamicElements(dynamicElement.elements("dynamic-element"));
      097
      098			String name = dynamicElement.attributeValue("name");
      099
      100			int index = ddmFieldsCounter.get(name);
      101
      102			dynamicElement.addAttribute("index", String.valueOf(index));
      103
      104			String type = dynamicElement.attributeValue("type");
      105
      106			if (type.equals("image")) {
      107				updateImageElement(dynamicElement, name, index);
      108			}
      109
      110			ddmFieldsCounter.incrementKey(name);
      111		}
      112	}
      

      ddmstructure definition (wcm-image/ddm-integer available, as it should be)

      <?xml version="1.0"?>
      <root available-locales="en_US" default-locale="en_US">
      	<dynamic-element dataType="image" fieldNamespace="wcm" indexType="keyword" name="Logo" readOnly="false" repeatable="false" required="false" showLabel="true" type="wcm-image" width="">
      		<meta-data locale="en_US">
      			<entry name="label">
      				<![CDATA[Logo]]>
      			</entry>
      			<entry name="predefinedValue">
      				<![CDATA[]]>
      			</entry>
      			<entry name="tip">
      				<![CDATA[]]>
      			</entry>
      		</meta-data>
      	</dynamic-element>
      	<dynamic-element dataType="integer" fieldNamespace="ddm" indexType="keyword" name="Test" readOnly="false" repeatable="false" required="false" showLabel="true" type="ddm-integer" width="small">
      		<meta-data locale="en_US">
      			<entry name="label">
      				<![CDATA[Test]]>
      			</entry>
      			<entry name="predefinedValue">
      				<![CDATA[null]]>
      			</entry>
      			<entry name="tip">
      				<![CDATA[]]>
      			</entry>
      		</meta-data>
      	</dynamic-element>
      </root>
      

      journalarticle content (type="image" only for the logo, missing type for the second variable)

      <?xml version="1.0"?>
      <root available-locales="en_US" default-locale="en_US">
      	<dynamic-element name="Logo" index="0" type="image" index-type="keyword">
      		<dynamic-content language-id="en_US" id="43702">/image/journal/article?img_id=43702&amp;t=1438067234599</dynamic-content>
      	</dynamic-element>
      	<dynamic-element name="Count" index="0" index-type="keyword">
      		<dynamic-content language-id="en_US"><![CDATA[12]]></dynamic-content>
      	</dynamic-element>
      </root>
      

        Attachments

          Activity

            People

            Assignee:
            lu.liu Lu Liu
            Reporter:
            hpcbuch Jochen Buchholz (Inactive)
            Participants of an Issue:
            Recent user:
            Marta Elicegui
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              5 years, 33 weeks, 5 days ago

                Packages

                Version Package