My bad, with that, it is working well in my xwiki page :-) xc = xcontext.getContext() gArch.removeVersions(gArch.getLatestVersion(), gArch.getPrevVersion(gArch.getPrevVersion(gArch.getLatestVersion())),xc)
-------------------------------------------- En date de : Lun 4.4.16, Pascal BASTIEN <pbasnews-xw...@yahoo.fr> a écrit : Objet: Error with groovy script from a page but not in scheduler À: "XWiki Users" <users@xwiki.org> Date: Lundi 4 avril 2016, 11h46 Hi, I can't understand an error when I launch a groovy script from a wiki page but I haven't error when my groovy script is launched in scheduler... My nice script delete previous version of MyPage with removeVersions methods: MyGroupAuto = xwiki.getDocument("Space.MyPage") // remove last version gArch = MyGroupAuto.getDocumentArchive() gArch.removeVersions(gArch.getLatestVersion(), gArch.getPrevVersion(gArch.getPrevVersion(gArch.getLatestVersion())), context) MyGroupAuto.save() *************** public void removeVersions(org.suigeneris.jrcs.rcs.Version newerVersion, org.suigeneris.jrcs.rcs.Version olderVersion, XWikiContext context) throws XWikiException Remove document versions from vfrom to vto, inclusive. *************** When I launch same script in a wiki page (betwwen {{groovy}} tags and page recorded by Admin with PR), I obtain this error and my script stopped but same script working well in scheduler: Caused by: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.xpn.xwiki.doc.XWikiDocumentArchive.removeVersions() is applicable for argument types: (org.suigeneris.jrcs.rcs.Version, org.suigeneris.jrcs.rcs.Version, com.xpn.xwiki.api.Context) values: [29.1, 27.1, com.xpn.xwiki.api.Context@3f45ea13] Possible solutions: removeVersions(org.suigeneris.jrcs.rcs.Version, org.suigeneris.jrcs.rcs.Version, com.xpn.xwiki.XWikiContext) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:151) All ideas why this behavours is welcome :-) thxs Pascal B _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users