Thanks Caleb and Marius for suggestions.
Caleb, your suggestion worked, however, I don't know now which files to exclude from
the classpath as there are many jar files in WEB-INF/lib folder.
Any ideas?
Farrukh
On 2010-07-21, at 8:11 PM, Marius Dumitru Florea wrote:
On 07/19/2010 04:22 PM, Caleb James DeLisle wrote:
I appears that you are missing some
dependencies.
What you can try to verify that is run java with classpath in xwiki/WEB-INF/lib/*
xwiki being the folder which you get when you decompress the .war file.
If that works you can look into maven because I think it will allow you to build the
rendering module and pull all of the dependencies into the target directory.
Caleb
Farrukh Ijaz wrote:
> 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
This jar might depend on other jars (transitive dependencies). Best is
to create a maven project in NetBeans (there should be a maven plugin
for NetBeans like there is m2eclipse for Eclipse) and add
xwiki-core-rendering-standalone as a dependency in your pom.
Hope this helps,
Marius
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
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs