Uploaded image for project: 'Admin Tools Application'
  1. Admin Tools Application
  2. ADMINTOOL-41

Database to Filesystem porter does not work

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.8
    • Fix Version/s: 4.2
    • Labels:
    • Similar issues:

      Description

      When accessing the Database to Filesystem porter it gives the following error :

      "Failed to execute the [groovy] macro. Cause: [startup failed: Script3.groovy: -1: Mixing private and public/protected methods of the same name causes multimethods to be disabled and is forbidden to avoid surprising behaviour. Renaming the private methods will solve the problem. @ line -1, column -1. Script3.groovy: 62: Mixing private and public/protected methods of the same name causes multimethods to be disabled and is forbidden to avoid surprising behaviour. Renaming the private methods will solve the problem. @ line 62, column 1. private void main() ^ 2 errors ]. Click on this message for details."
      
      org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Script Macro for content [import com.xpn.xwiki.doc.XWikiAttachment;
      import com.xpn.xwiki.doc.XWikiDocument;
      import com.xpn.xwiki.doc.DeletedAttachment;
      import org.xwiki.store.legacy.doc.internal.ListAttachmentArchive;
      import com.xpn.xwiki.store.XWikiAttachmentStoreInterface;
      import org.xwiki.store.legacy.store.internal.FilesystemAttachmentStore;
      import com.xpn.xwiki.store.AttachmentVersioningStore;
      import org.xwiki.store.legacy.store.internal.XWikiHibernateTransaction;
      import com.xpn.xwiki.store.AttachmentRecycleBinStore;
      import com.xpn.xwiki.web.Utils;
      import com.xpn.xwiki.XWikiContext;
      import com.xpn.xwiki.XWiki;
      import com.xpn.xwiki.XWikiException;
      import org.xwiki.store.filesystem.internal.FilesystemStoreTools;
      import org.apache.commons.lang.exception.ExceptionUtils;
      import org.hibernate.ObjectNotFoundException;
      
      private void printIntro(final XWiki wiki)
      {
          println("= Filesystem attachment storage porting script =");
      
          println("== Step 1: Switch to Filesystem attachments. ==");
      
          boolean ret = isFilesystemStore(wiki.getAttachmentStore()) \
              && isFilesystemStore(wiki.getAttachmentVersioningStore()) \
              && isFilesystemStore(wiki.getAttachmentRecycleBinStore());
      
          println(getStoreLine(isFilesystemStore(wiki.getAttachmentStore()),
                               wiki.getAttachmentStore()));
          println(getStoreLine(isFilesystemStore(wiki.getAttachmentVersioningStore()),
                               wiki.getAttachmentVersioningStore()));
          println(getStoreLine(isFilesystemStore(wiki.getAttachmentRecycleBinStore()),
                               wiki.getAttachmentRecycleBinStore()));
      
          if (!ret) {
              println("Please edit your xwiki.cfg file by modifying "
                  + "the attachment store lines to read as follows:");
              println("xwiki.store.attachment.hint = file");
              println("xwiki.store.attachment.versioning.hint = file");
              println("xwiki.store.attachment.recyclebin.hint = file");
              println("Also make sure they are not commented out.");
          }
      
          println("== Step 2: Add this directory to your backup routine. ==");
          println("This is your storage directory, "
              + "when filesystem attachments are enabled you have to back this up "
              + "as part of your data backup routine.\n");
          println(Utils.getComponent(FilesystemStoreTools.class).storageDir.getAbsolutePath());
      
          println("== Step 3: Copy attachments from database to filesystem. ==");
          println("Now you are ready to copy the data over from your database to the filesystem. "
              + "It is prudent to leave the attachments in the database since this is still experimental "
              + "and in most situations the attachment data is not bothersome just sitting in the "
              + "database. As such, this script contains no facility to delete entries from the database.");
          println("If anything goes wrong in this function, it will fail with an error message, "
              + "you should get the stack trace (probably in the log file) and keep it to "
              + "confuse and humiliate the developers with. No harm should be done since this only loads "
              + "from the database and only saves to the filesystem.");
      }
      
      main();
      private void main()
      {
          final XWikiContext xc = xcontext.getContext();
          final XWiki wiki = xc.getWiki();
      
          int startAt = 0;
          int seconds = 20;
          boolean dryRun = true;
          boolean verbose = false;
          boolean go = request.getMethod().equals("POST") && request.getParameter("doIt") != null;
          boolean ajax = "plain".equals(request.getParameter("xpage"));
          int endedAt = 0;
      
          if (!ajax) {
              this.printIntro(wiki);
          }
      
          if (go) {
              startAt = Integer.parseInt(request.getParameter("startAt"));
              seconds = Integer.parseInt(request.getParameter("seconds"));
              dryRun = "on".equals(request.getParameter("dryRun"));
              verbose = "on".equals(request.getParameter("verbose"));
              endedAt = this.doIt(startAt, seconds, dryRun, verbose, ajax);
              if (ajax) {
                  if (endedAt == -1) {
                      this.printFooter();
                  } else {
                      println("\n{{html clean=false}}<meta name='endedAt' content='"
                              + endedAt + "' />{{/html}}");
                  }
                  return;
              }
          }
      
          this.printJs();
      
          if (!go || endedAt > startAt) {
              println("\n{{html clean=false}}");
              println("<div id='javascriptSpace'></div>");
              println("<form action='?time=" + System.nanoTime()
                      + "#doItForm' id='doItForm' method='POST'>");
              println("<input type='hidden' name='seconds' value='" + seconds + "' />");
              println("<input type='hidden' id='startAt' name='startAt' value='" + endedAt + "' />");
              println("<dl>");
              println("<dt><label for='dryRun'>Dry Run, don't save any files.</label></dt>");
              println("<dd><input type='checkbox' name='dryRun' checked='"
                  + ((dryRun) ? "checked" : "") + "' /></dd>");
      
              println("<dt><label for='verbose'>Verbose, show every attachment.</label></dt>");
              println("<dd><input type='checkbox' name='verbose' checked='"
                  + ((verbose) ? "checked" : "") + "' /></dd>");
              println("</dl>");
              println("<input type='hidden' name='doIt' value='yes' />")
              println("<input type='submit' name='start' value='"
                  + ((endedAt > startAt) ? "Continue" : "Start") + "' />");
              println("</form>");
              println("<style>#xwikidata { display:none }</style>")
              println("{{/html}}\n");
              return;
          }
      
          this.printFooter();
      }
      
      private void printFooter()
      {
          println("== Step 4: make sure everything is working. ==");
          println("Check to make sure your attachments are still there, if an attachment is broken, "
              + "it will appear to be there but on opening it will tell you the attachment does not exist. "
              + "If something goes terribly wrong with filesystem attachments, you may have your old "
              + "attachment system back simply by changing the lines in the xwiki.cfg file and restarting "
              + "the container. HOWEVER: This will not preserve attachments which were uploaded **after** "
              + "switching to filesystem attachments so as users edit the system you will become "
              + "locked in to filesystem attachments unless a script is written to do the "
              + "inverse of this one.");
          println("Despite being experimental, the filesystem attachment storage is quite stable and the "
              + "risk of actually losing something so that it is unrecoverable is very remote.");
          println("NOTE: This must be run seperately in each subwiki.");
          println("\n\nEnjoy and give feedback.");
      
      }
      
      private static boolean isFilesystemStore(final Object store)
      {
          return store.getClass().getName().contains("Filesystem");
      }
      
      private static String getStoreLine(final boolean isFilesystem, final Object store)
      {
          return "(%style='color:" + (isFilesystem ? "#080" : "#d00") + "'%)(((* " + store + ")))";
      }
      
      private void printJs()
      {
      println("""\n{{html}}<script>
              var isAtBottom = function() {
                  var vp = document.viewport;
                  return vp.getScrollOffsets().top + vp.getHeight() + 30 > window.body.getHeight();
              };
      
              Event.observe(document, "dom:loaded", function() {
                  var doItForm = document.getElementById("doItForm");
                  var workspace = document.getElementById("javascriptSpace");
                  var params = {
                      xpage: "plain",
                      seconds: doItForm.seconds.value,
                      startAt: doItForm.startAt.value,
                      doIt: "yes"
                  };
                  var shouldContinue;
      
                  var doBlock = function(startAt) {
                      params.startAt = startAt;
                      new Ajax.Request(window.location.href, {
                          method: "POST",
                          parameters: params,
                          onSuccess: function(transport) {
                              var div = document.createElement("div");
                              div.innerHTML = transport.responseText;
      
                              var wasAtBottom = isAtBottom();
                              workspace.innerHTML += transport.responseText;
                              if (wasAtBottom || startAt == 0) {
                                  doItForm.scrollTo();
                              }
      
                              var metas = div.getElementsByTagName("meta");
                              if (metas.length > 0 && shouldContinue) {
                                  doBlock(metas[0].content);
                                  return;
                              } else if (metas.length > 0) {
                                  doItForm.startAt.value = metas[0].content;
                                  doItForm.start.value = "Continue";
                              } else {
                                  doItForm.parentNode.removeChild(doItForm);
                              }
                              reachedEnd();
                          }
                      });
                  };
      
                  var reachedEnd = function() {
                      Event.observe(doItForm, "submit", start);
                      Event.stopObserving(doItForm, "submit", stop);
                  };
      
                  var stop = function(ev) {
                      event.stop();
                      shouldContinue = false;
                      reachedEnd();
                  };
      
                  var start = function(ev) {
                      event.stop();
                      params.dryRun = (doItForm.dryRun.checked) ? "on" : undefined;
                      params.verbose = (doItForm.verbose.checked) ? "on" : undefined;
                      workspace.innerHTML = "";
                      shouldContinue = true;
                      doBlock(doItForm.startAt.value);
                      doItForm.start.value = "Abort";
                      Event.stopObserving(doItForm, "submit", start);
                      Event.observe(doItForm, "submit", stop);
                  };
      
                  Event.observe(doItForm, "submit", start);
              });
              </script>{{/html}}""");
      }
      
      /**
       * Port all attachments from the original form to filesystem attachment store.
       * Do one batch at a time so the user can see the progress and it won't time out.
       *
       * @param startAt the index of the first job to do, 0 to start at the beginning.
       * @param seconds the number of seconds to run for before returning.
       * @param dryRun don't save any files if this is true.
       * @return the number of the first job which was not done. This can be startAt in the next call.
       *         -1 if the operation is complete.
       */
      private int doIt(int startAt, int seconds, boolean dryRun, boolean verbose, boolean ajax)
      {
          final XWikiContext xc = this.xcontext.getContext();
          final XWiki wiki = xc.getWiki();
          final FilesystemAttachmentStore fileAttachStore =
              Utils.getComponent(XWikiAttachmentStoreInterface.class, "file");
          final XWikiAttachmentStoreInterface defAttachStore =
              Utils.getComponent(XWikiAttachmentStoreInterface.class, "hibernate");
          final AttachmentVersioningStore defAttachmentVersioningStore =
              Utils.getComponent(AttachmentVersioningStore.class, "hibernate");
      
          int count = 0;
          long stopTime = System.currentTimeMillis() + (1000 * seconds);
      
          println("(%style='color:#00d'%)(((");
          if (verbose && startAt == 0) {
              println("\n== Attachments ==\n");
          }
          for (String docName : xwiki.searchDocuments("where 1=1")) {
              if (count < startAt) {
                  count++;
                  continue;
              } else if (stopTime < System.currentTimeMillis()) {
                  println(")))");
                  return count;
              } else {
                  count++;
              }
              final XWikiDocument doc = xwiki.getDocument(docName).getDocument();
              try {
                  final XWikiHibernateTransaction transaction = new XWikiHibernateTransaction(xc);
      
                  if (verbose) {
                      println("* [[" + doc.getFullName() + "]]");
                  }
                  // This is the equivilant of doc.getAttachmentList() but there is an issue which
                  // causes some attachments to be lost.
                  // http://jira.xwiki.org/browse/XWIKI-7936
                  def hql = "select att from XWikiAttachment att WHERE att.docId=?";
                  for (XWikiAttachment attach : xwiki.search(hql, [doc.getId()])) {
                      attach.setDoc(doc);
                      if (verbose) {
                          println("** [[attach:" + doc.getFullName() + "@" + attach.getFilename() + "]]");
                      }
                      try {
                          fileAttachStore.loadAttachmentContent(attach, xc, false);
                          continue;
                      } catch (XWikiException noAttachmentInFilesystem) {
                          // no such attachment, let's save it.
                      }
                      try {
                          try {
                              defAttachStore.loadAttachmentContent(attach, xc, true);
                          } catch (XWikiException notInHibernate) {
                               final Throwable wrapped = notInHibernate.getException();
                               if (wrapped && wrapped instanceof ObjectNotFoundException) {
                                   println("(%style='color:#c80'%)(((");
                                   println("Unable to find this attachment [[attach:" + attach.getFilename()
                                           + "@" + doc.getFullName() + "]] in the database, "
                                           + "it may be the result of database corruption from a failed "
                                           + "upload prior to the fixing of "
                                           + "[[http://jira.xwiki.org/browse/XWIKI-5055]]");
                                   println("xwikiattachment_content.XWA_ID = " + attach.getId());
                                   println(")))");
                               }
                          }
                          defAttachmentVersioningStore.loadArchive(attach, xc, true);
                          try {
                              // http://jira.xwiki.org/jira/browse/XWIKI-6199
                              attach.getAttachment_archive().getVersions();
                          } catch (NullPointerException e) {
                              attach.setAttachment_archive(new ListAttachmentArchive([attach]));
                          }
                          // Setup the runnables to do the save but don't save just yet.
                          fileAttachStore.getAttachmentContentSaveRunnable(attach, false, xc)
                              .runIn(transaction);
                      } catch (Exception e) {
                          println("(%style='color:#d00'%)(((");
                          println("Error in [" + doc.getFullName() + ":" + attach.getFilename() + "]"
                                  + e.getMessage());
                          println(ExceptionUtils.getStackTrace(e));
                          println(")))");
                      }
                  }
                  if (!dryRun) {
                      transaction.start();
                  }
              } catch (Exception e) {
                  println("(%style='color:#d00'%)(((");
                  println("Failed to port attachments for document [" + doc.getFullName() + "]");
                  println(e.getMessage());
                  println(ExceptionUtils.getStackTrace(e));
                  println(")))");
              }
          }
          println(")))");
          if (startAt < count) {
              int attachCount =
                  xwiki.search("select count(at) from XWikiDocument as doc, "
                               + "XWikiAttachment as at where at.docId = doc.id").get(0).intValue();
              println("**[" + attachCount + "] attachments.**");
          }
      
      
          // And now for the deleted attachments.
          final AttachmentRecycleBinStore fileBin =
              Utils.getComponent(AttachmentRecycleBinStore.class, "file");
          final AttachmentRecycleBinStore defaultBin =
              Utils.getComponent(AttachmentRecycleBinStore.class, "hibernate");
      
          if (verbose && startAt < count) {
              println("\n== Deleted Attachments ==\n");
          }
          List<Object[]> entries =
              xwiki.search("select da.id, da.docName, da.filename, da.date from DeletedAttachment as da");
          if (verbose && entries.size() == 0) {
              println("\nnone.");
          }
          int delAttachCount = 0;
          for (Object[] o : entries) {
              long delAttachId = o[0];
              final String docName = o[1];
              final String fileName = o[2];
              final Date deleteDate = o[3];
              delAttachCount++;
              if (count < startAt) {
                  if (verbose && !ajax) {
                      println("* [[" + docName + "]] - " + fileName);
                  }
                  count++;
                  continue;
              } else if (stopTime < System.currentTimeMillis()) {
                  return count;
              }
              count++;
      
              try {
                  final DeletedAttachment delAttach = 
                      defaultBin.getDeletedAttachment(delAttachId, xc, true);
                  // Can't use the transaction runnable here because (non-filesystem)
                  // deleted attachments hold all content in memory so they have to be
                  // handled one at a time.
                  final XWikiAttachment attach = delAttach.restoreAttachment(null, xc);
                  try {
                      // http://jira.xwiki.org/jira/browse/XWIKI-6199
                      attach.getAttachment_archive().getVersions();
                  } catch (NullPointerException e) {
                      attach.setAttachment_archive(new ListAttachmentArchive([attach]));
                  }
                  if (!dryRun) {
                      fileBin.saveToRecycleBin(attach,
                                               delAttach.getDeleter(),
                                               delAttach.getDate(),
                                               xc,
                                               false);
                  }
      
                  if (verbose) {
                      println("* [[" + docName + "]]");
                      println("** " + fileName + " - Deleted: " + deleteDate);
                  }
              } catch (Exception e) {
                  println("(%style='color:#d00'%)(((");
                  println("* [[" + docName + "]] - " + fileName + " - Deleted: " + deleteDate);
                  println(e.getMessage());
                  println(")))");
                  println(ExceptionUtils.getStackTrace(e));
              }
          }
          println("\n**[" + delAttachCount + "] deleted attachments.**");
          return -1;
      }]
      	at org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluateBlock(AbstractJSR223ScriptMacro.java:199)
      	at org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluateBlock(AbstractJSR223ScriptMacro.java:60)
      	at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:182)
      	at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:58)
      	at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:272)
      	at org.xwiki.rendering.internal.transformation.DefaultRenderingContext.transformInContext(DefaultRenderingContext.java:183)
      	at org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:95)
      	at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:263)
      	at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:133)
      	at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:58)
      	at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:96)
      	at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:39)
      	at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:123)
      	at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:52)
      	at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:68)
      	at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:42)
      	at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1173)
      	at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1136)
      	at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1188)
      	at com.xpn.xwiki.api.Document.getRenderedContent(Document.java:717)
      	at sun.reflect.GeneratedMethodAccessor462.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)
      	at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:567)
      	at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
      	at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.xwiki.velocity.introspection.TryCatchDirective.render(TryCatchDirective.java:72)
      	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluateInternal(DefaultVelocityEngine.java:259)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:222)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:198)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.evaluateContent(InternalTemplateManager.java:726)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:627)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:605)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:571)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:557)
      	at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:65)
      	at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1896)
      	at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1874)
      	at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:822)
      	at sun.reflect.GeneratedMethodAccessor230.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)
      	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:369)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:216)
      	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:311)
      	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:230)
      	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluateInternal(DefaultVelocityEngine.java:259)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:222)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:198)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.evaluateContent(InternalTemplateManager.java:726)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:627)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:605)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:571)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:557)
      	at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:65)
      	at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1896)
      	at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1874)
      	at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:822)
      	at sun.reflect.GeneratedMethodAccessor230.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)
      	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:369)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:216)
      	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:311)
      	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:230)
      	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluateInternal(DefaultVelocityEngine.java:259)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:222)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:198)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.evaluateContent(InternalTemplateManager.java:726)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:627)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:605)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:571)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:557)
      	at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:65)
      	at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1896)
      	at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:180)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:449)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:193)
      	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
      	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
      	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
      	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
      	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:115)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:127)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:137)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
      	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      	at org.eclipse.jetty.server.Server.handle(Server.java:499)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
      	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      Script4.groovy: -1: Mixing private and public/protected methods of the same name causes multimethods to be disabled and is forbidden to avoid surprising behaviour. Renaming the private methods will solve the problem.
       @ line -1, column -1.
      Script4.groovy: 62: Mixing private and public/protected methods of the same name causes multimethods to be disabled and is forbidden to avoid surprising behaviour. Renaming the private methods will solve the problem.
       @ line 62, column 1.
         private void main()
         ^
      
      2 errors
      
      	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:159)
      	at org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.eval(AbstractJSR223ScriptMacro.java:340)
      	at org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluateBlock(AbstractJSR223ScriptMacro.java:249)
      	at org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluateBlock(AbstractJSR223ScriptMacro.java:194)
      	... 145 more
      Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      Script4.groovy: -1: Mixing private and public/protected methods of the same name causes multimethods to be disabled and is forbidden to avoid surprising behaviour. Renaming the private methods will solve the problem.
       @ line -1, column -1.
      Script4.groovy: 62: Mixing private and public/protected methods of the same name causes multimethods to be disabled and is forbidden to avoid surprising behaviour. Renaming the private methods will solve the problem.
       @ line 62, column 1.
         private void main()
         ^
      
      2 errors
      
      	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
      	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1075)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
      	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:254)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:212)
      	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getScriptClass(GroovyScriptEngineImpl.java:374)
      	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:151)
      	... 148 more
      

        Attachments

          Activity

            People

            • Assignee:
              acotiuga Alex Cotiugă
              Reporter:
              vbuzila Buzila Vlad
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: