Hi Everyone,

I am novice to XWiki. I want to use XWiki standalone rendering module outside 
XWiki. I followed the instructions on the following page.

http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule

I've configured a project in NetBeans IDE and included following JAR to the 
classpath.

xwiki-core-rendering-standalone-2.2.4.jar

Here is the hello world example:

package xwikitest;

import java.io.StringReader;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.xwiki.component.embed.EmbeddableComponentManager;
import org.xwiki.rendering.converter.Converter;
import org.xwiki.rendering.renderer.printer.*;
import org.xwiki.rendering.syntax.Syntax;

public class HelloWorld {

    public static void main(String[] args) {
        new HelloWorld().sayHello();
    }

    public void sayHello() {
        EmbeddableComponentManager ecm = new EmbeddableComponentManager();
        ecm.initialize(this.getClass().getClassLoader());
        WikiPrinter printer = new DefaultWikiPrinter();
        Converter converter;
        try {
            converter = ecm.lookup(Converter.class);
            converter.convert(new StringReader("Hello **World**"), 
Syntax.MEDIAWIKI_1_0, Syntax.XHTML_1_0, printer);
            System.out.println(printer.toString());
        } catch (Exception ex) {
            Logger.getLogger(HelloWorld.class.getName()).log(Level.SEVERE, 
null, ex);
        }
    }
}

But it's raising following exception at line 
ecm.initialize(this.getClass().getClassLoader());

Exception in thread "main" java.lang.RuntimeException: Failed to dynamically 
load components with annotations
        at 
org.xwiki.component.annotation.ComponentAnnotationLoader.initialize(ComponentAnnotationLoader.java:136)
        at 
org.xwiki.component.embed.EmbeddableComponentManager.initialize(EmbeddableComponentManager.java:69)
        at xwikitest.Main.test(Main.java:32)
        at xwikitest.Main.main(Main.java:27)
Caused by: java.lang.ClassNotFoundException: 
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
        at 
org.xwiki.component.annotation.ComponentAnnotationLoader.initialize(ComponentAnnotationLoader.java:97)
        ... 3 more
Java Result: 1

Am I missing any other jar(s)? 

Any prompt help will be highly appreciated.

Farrukh

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

Reply via email to