Hi Developers,

I implement an ant task that allows the import of xar files into a xwiki database. This Tasks uses a class that is derived from AbstractPackager. Whenever an object of this class calls AbstractPackager.createXWikiContext I get an exception with the following root cause:

Caused by: java.lang.NullPointerException
at org.xwiki.context.internal.DefaultExecutionContextManager.initialize(DefaultExecutionContextManager.java:138) at com.xpn.xwiki.tool.backup.AbstractPackager.createXWikiContext(AbstractPackager.java:75)
        at
...

It seems that this AbstractPackager.createXWikiContext method works only on some circumstances. I assume that the injection mechanism is not working in my case.

In a seconds test I implemented a main method in the AntTask, and provided the parameter via command line. And it worked but only under the condition that the required classpath is defined in the manifest of the jar and the program is started via

   java -jar xarImportAntTask.jar

When I setup the classpath externally and start it with

   java -cp ... de.hierlmeier.xwiki.ant.XarImportTask

I get the same NullPointerException as within ant.

Can someone give me a hint to solve the problem?


If anyone is interrested I can contribute the ant task to the open source community (once it is working). Here is a sample ant configuration:

                
<taskdef name="importXar"
    classname="de.hierlmeier.xwiki.ant.XarImportTask">
  <classpath>
    <pathelement location="${instdir}/xwiki/WEB-INF"/>
    <pathelement location="${instdir}/xwiki/WEB-INF/classes"/>
    <fileset dir="${instdir}/xwiki/WEB-INF/lib">
       <include name="*.jar"/>
    </fileset>
  </classpath>
</taskdef>

<importXar hibernateConfig="${instdir}/xwiki/WEB-INF/hibernate.cfg.xml"
           xwikidb="xwiki">
   <xarFiles dir="${basedir}/xars">
      <include name="*.xar"/>
   </xarFiles>
</importXar>

Thank you in advance

    Richard

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to