Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-7045

Property names in GroupsClass, LevelsClass and UsersClass are not set when new properties are created, which may cause upgrade failure.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.2 RC1
    • Fix Version/s: 3.3-milestone-1, 3.2.1
    • Component/s: Old Core
    • Labels:
      None
    • keywords:
      patch
    • Difficulty:
      Trivial
    • Similar issues:

      Description

      Short story

      I believe that the property name should be set in the method GroupsClass.fromString:

      diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/objects/classes/GroupsClass.java b/xwiki-platform-core/xwiki-platfor
      index 9491304..2a750a9 100644
      --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/objects/classes/GroupsClass.java
      +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/objects/classes/GroupsClass.java
      @@ -99,6 +99,7 @@ public BaseProperty fromString(String value)
           {
               BaseProperty prop = newProperty();
               prop.setValue(value);
      +        prop.setName(getName());
               return prop;
           }
      

      Long story

      When upgrading to 3.2-rc-1, an update is triggered on the class document XWiki.RightsClass to add the default sheet. This in turn will in turn trigger an update of all properties 'groups' of the class XWiki.RightsClass which are not of type 'LargeStringProperty', which I had three of (at XWikiHibernateStore.java:632):

      http://wiki:8080/xw/bin/view/Main/[1] print brokenProperties
       brokenProperties = "[<?xml version="1.0" encoding="UTF-8"?>
      
      <groups>XWiki.XWikiAdminGroup</groups>
      , <?xml version="1.0" encoding="UTF-8"?>
      
      <groups>XWiki.XWikiAdminGroup</groups>
      , <?xml version="1.0" encoding="UTF-8"?>
      
      <groups>XWiki.XWikiAdminGroup</groups>
      ]"
      

      After the property has been converted with the statement:

          BaseProperty newProperty = prop.fromString(brokenProperty.toText());
      

      the property name has not been set:

      http://wiki:8080/xw/bin/view/Main/[1] print newProperty
       newProperty = "<?xml version="1.0" encoding="UTF-8"?>
      
      <>XWiki.XWikiAdminGroup</>
      "
      

      Hence, it seems that the property name should have been set in the method GroupsClass.fromString().

      http://wiki:8080/xw/bin/view/Main/[1] print prop.getClass();
       prop.getClass(); = "class com.xpn.xwiki.objects.classes.GroupsClass"
      

      Stack dump

      com.xpn.xwiki.XWikiException: Error number 3 in 0: Could not initialize main XWiki context
      Wrapped Exception: Error number 3201 in 3: Exception while saving document xwiki:XWiki.XWikiRights
      Wrapped Exception: Failed to commit or rollback transaction. Root cause []
      	at com.xpn.xwiki.XWiki.getMainXWiki(XWiki.java:422)
      	at com.xpn.xwiki.XWiki.getXWiki(XWiki.java:491)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:136)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:116)
      	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
      	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
      	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:128)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:144)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:217)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
      	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      	at java.lang.Thread.run(Thread.java:636)
      
      
      Wrapped Exception:
      
      com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving document xwiki:XWiki.XWikiRights
      Wrapped Exception: Failed to commit or rollback transaction. Root cause []
      	at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:690)
      	at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:174)
      	at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:167)
      	at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1406)
      	at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1362)
      	at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1357)
      	at com.xpn.xwiki.XWiki.getRightsClass(XWiki.java:3348)
      	at com.xpn.xwiki.XWiki.getRightsClass(XWiki.java:3355)
      	at com.xpn.xwiki.XWiki.initializeMandatoryClasses(XWiki.java:846)
      	at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:817)
      	at com.xpn.xwiki.XWiki.<init>(XWiki.java:743)
      	at com.xpn.xwiki.XWiki.getMainXWiki(XWiki.java:405)
      	at com.xpn.xwiki.XWiki.getXWiki(XWiki.java:491)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:136)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:116)
      	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
      	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
      	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:128)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:144)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:217)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
      	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      	at java.lang.Thread.run(Thread.java:636)
      
      
      Wrapped Exception:
      
      org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
      	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
      	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
      	at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:114)
      	at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)
      	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2419)
      	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2874)
      	at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
      	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
      	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
      	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
      	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
      	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
      	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
      	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
      	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)
      	at com.xpn.xwiki.store.XWikiHibernateBaseStore.endTransaction(XWikiHibernateBaseStore.java:881)
      	at com.xpn.xwiki.store.XWikiHibernateBaseStore.endTransaction(XWikiHibernateBaseStore.java:852)
      	at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:680)
      	at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:174)
      	at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:167)
      	at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1406)
      	at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1362)
      	at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1357)
      	at com.xpn.xwiki.XWiki.getRightsClass(XWiki.java:3348)
      	at com.xpn.xwiki.XWiki.getRightsClass(XWiki.java:3355)
      	at com.xpn.xwiki.XWiki.initializeMandatoryClasses(XWiki.java:846)
      	at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:817)
      	at com.xpn.xwiki.XWiki.<init>(XWiki.java:743)
      	at com.xpn.xwiki.XWiki.getMainXWiki(XWiki.java:405)
      	at com.xpn.xwiki.XWiki.getXWiki(XWiki.java:491)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:136)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:116)
      	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
      	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
      	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:128)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:144)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:217)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
      	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      	at java.lang.Thread.run(Thread.java:636)
      Caused by: java.sql.BatchUpdateException: Column 'XWP_NAME' cannot be null
      	at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2007)
      	at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1443)
      	at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
      	at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
      	at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
      	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
      	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
      	... 63 more
      

        Attachments

          Activity

            People

            • Assignee:
              aj Andreas Jonsson
              Reporter:
              aj Andreas Jonsson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: