[xwiki-devs] Export/Import batch mode

Thomas Mortagne thomas.mortagne at xwiki.com
Tue Jul 1 09:33:40 CEST 2008


On Mon, Jun 30, 2008 at 8:59 PM,  <acannone at imolinfo.it> wrote:
> Invoking directly the class  com.xpn.xwiki.tool.backup.ExporterMain I have the following Exception:
>
> Exception in thread "main" java.lang.RuntimeException: Component manager has not been initialized before lookup for [org.xwiki.cache.CacheFactory] for hint [default]
>        at com.xpn.xwiki.web.Utils.getComponent(Utils.java:553)
>        at com.xpn.xwiki.XWiki.getCacheFactory(XWiki.java:5130)
>        at com.xpn.xwiki.store.XWikiCacheStore.initCache(XWikiCacheStore.java:86)
>        at com.xpn.xwiki.store.XWikiCacheStore.initCache(XWikiCacheStore.java:80)
>        at com.xpn.xwiki.store.XWikiCacheStore.<init>(XWikiCacheStore.java:62)
>        at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:675)
>        at com.xpn.xwiki.XWiki.<init>(XWiki.java:618)
>        at com.xpn.xwiki.XWiki.<init>(XWiki.java:612)
>        at com.xpn.xwiki.tool.backup.AbstractPackager.createXWikiContext(AbstractPackager.java:73)
>        at com.xpn.xwiki.tool.backup.Exporter.exportDocuments(Exporter.java:53)
>        at com.xpn.xwiki.tool.backup.ExporterMain.main(ExporterMain.java:57)

This error is because you are trying to use XWiki Platform without
initializing it. This particular error is about plexuw component
manager needed because since versio 1.5M2 XWiki cache service is a
plexus component. You should look at shared-test
(trunks//xwiki-platform-tools/xwiki-shared-tests/src/main/java/com/xpn/xwiki/test/AbstractXWikiComponentTestCase.java)
project for a way to create and initialize one you will need the
plexus.xml also in shared-tests. You could directly extends
AbstractXWikiComponentTestCase like unit tests do but it's... for unit
tests and extends junit, jmock etc.

>
> Any ideas or suggestions?
>
> I have the previous error calling a script that contains something like this:
> java -classpath $XWIKICLASSPATH com.xpn.xwiki.tool.backup.ExporterMain /home/acannone/xwiki/prova/export xwiki /home/acannone/xwiki/prova/hibernate.cfg.xml
>
> There is someone that can tell me how to invoke and configure the maven packager plugin in my example?
>
>
>
> Thanks
>
>
> Thomas Mortagne wrote:
>>
>> Hi,
>>
>> I doubt there is any java level documentation on import/export but you
>> can look at some good examples of how to use packager plugin :
>>  - com.xpn.xwiki.web.ExportAction#exportXAR(XWikiContext)
>>  - com.xpn.xwiki.web.ImportAction#render(XWikiContext)
>>
>> On Mon, May 5, 2008 at 3:19 PM, Lorenzo Manzoni <lmanzoni at imolinfo.it>
>> wrote:
>>> I would like to execute an export of all/some of the wiki pages in a
>>>  batch mode (ex. with a script and a java program).
>>>  In the same way I would like to execute an import.
>>>  Is there an easy way to do this?
>>>
>>>  Looking forward in the xwiki sources I found two classes that seem to do
>>>  what I want:
>>>
>>>     * com.xpn.xwiki.tool.backup.ExporterMain
>>>     * com.xpn.xwiki.tool.backup.ImporterMain
>>>
>>>  Both classes are in the maven plugin called xwiki-packager-plugin.
>>>  Is there any documentation that explain how use that plugin?
>>>
>>>
>>>  thanks,
>>>  Lorenzo
>>>  _______________________________________________
>>>  devs mailing list
>>>  devs at xwiki.org
>>>  http://lists.xwiki.org/mailman/listinfo/devs
>>>
>>
>>
>>
>> --
>> Thomas Mortagne
>> _______________________________________________
>> devs mailing list
>> devs at xwiki.org
>> http://lists.xwiki.org/mailman/listinfo/devs
>>
>>
> Quoted from:
> http://www.nabble.com/Export-Import-batch-mode-tp17061634p17062120.html
>
>



-- 
Thomas Mortagne


More information about the devs mailing list