# Can't find descriptor for Parser error (when rendering XWiki to HTML)

**URL:** <https://forum.xwiki.org/t/cant-find-descriptor-for-parser-error-when-rendering-xwiki-to-html/391>\
**Category:** Help / Discuss\
**Created:** [August 1, 2017, 11:46am UTC](https://forum.xwiki.org/t/cant-find-descriptor-for-parser-error-when-rendering-xwiki-to-html/391 "2017-08-01T11:46:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![adelcat](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/a/439d5e/32.png) [@adelcat](https://forum.xwiki.org/u/adelcat)\
**Post date:** [August 1, 2017, 11:46am UTC](https://forum.xwiki.org/t/cant-find-descriptor-for-parser-error-when-rendering-xwiki-to-html/391/1 "2017-08-01T11:46:31Z")

</div>

Hi everyone,

I am trying to write a Java program to transform XWiki code into XHTML using the XWiki rendering framework.  
I’ve followed the [Getting started tutorial](http://rendering.xwiki.org/xwiki/bin/view/Main/GettingStarted) and created a project with maven to manage dependencies. I also tried downloading the standalone ZIP dependencies and use it in an Ant project.

In both cases, I have the following exception :

```auto
    org.xwiki.component.manager.ComponentLookupException: Can't find descriptor for the component [role = [interface org.xwiki.rendering.parser.Parser] hint = [xwiki/2.1]]
            at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:401)
            at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:190) 

```

The source code is fairly simple and can be seen on pastebin : [import org.xwiki.component.embed.EmbeddableComponentManager;import org.xwiki.r - Pastebin.com](https://pastebin.com/GDZqHnes)  
Essentially, reading a file that holds the XWiki code and converting it.

Running the code using eclipe’s integrated run, works fine. However, when I create a jar file (including all dependencies), the above error is always shown.  
Any idea what might be causing it ?

---

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [August 1, 2017, 2:06pm UTC](https://forum.xwiki.org/t/cant-find-descriptor-for-parser-error-when-rendering-xwiki-to-html/391/2 "2017-08-01T14:06:42Z")

</div>

Hi, this error means that you’re missing the xwiki/2.1 parser in your project’s dependencies.

Namely, you need to add the following dependency:

```auto
    <dependency>
      <groupId>org.xwiki.rendering</groupId>
      <artifactId>xwiki-rendering-syntax-xwiki21</artifactId>
      <version>...version here...</version>
    </dependency>

```

Hope it helps

---

<div class="post-metadata">

**Author:** ![adelcat](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/a/439d5e/32.png) [@adelcat](https://forum.xwiki.org/u/adelcat)\
**Post date:** [August 1, 2017, 3:19pm UTC](https://forum.xwiki.org/t/cant-find-descriptor-for-parser-error-when-rendering-xwiki-to-html/391/3 "2017-08-01T15:19:09Z")

</div>

Hi, thanks for your reply.

I already have the dependency in maven, and I also have it in my ant project. Still the same error.  
My pom.xml is at: [\<?xml version="1.0" encoding="UTF-8"?\>\<project xmlns="http://maven.apache.org/ - Pastebin.com](https://pastebin.com/nHy3VNsi)  
My Main class: [package com.catamania.convertXWiki;import java.io.StringReader;import java - Pastebin.com](https://pastebin.com/1gpiWZFw)

With both the pom.xml and the Main class, I am getting the above error. Full stacktrace is:

```auto
org.xwiki.component.manager.ComponentLookupException: Failed to lookup component [org.xwiki.rendering.internal.parser.xwiki21.XWiki21Parser] identified by [role = [interface org.xwiki.rendering.parser.Parser] hint = [xwiki/2.1]]
        at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:394)
        at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:190)
        at com.catamania.convertXWiki.Main.convertMacro(Main.java:41)
        at com.catamania.convertXWiki.Main.main(Main.java:27)
Caused by: org.xwiki.component.manager.ComponentLookupException: Can't find descriptor for the component [role = [interface org.xwiki.rendering.parser.ResourceReferenceParser] hint = [link]]
        at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:401)
        at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:190)
        at org.xwiki.component.embed.EmbeddableComponentManager.getDependencyInstance(EmbeddableComponentManager.java:363)
        at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:312)
        at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:424)
        at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:392)
        ... 3 more

```

---

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [August 1, 2017, 3:34pm UTC](https://forum.xwiki.org/t/cant-find-descriptor-for-parser-error-when-rendering-xwiki-to-html/391/4 "2017-08-01T15:34:38Z")

</div>

This is weird since the component that cannot be found is located in xwiki-rendering-api which you should get transitively. Try adding it:

```auto
    <dependency>
      <groupId>org.xwiki.rendering</groupId>
      <artifactId>xwiki-rendering-api</artifactId>
      <version>...version here...</version>
    </dependency>

```

---

<div class="post-metadata">

**Author:** ![adelcat](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/a/439d5e/32.png) [@adelcat](https://forum.xwiki.org/u/adelcat)\
**Post date:** [August 1, 2017, 3:41pm UTC](https://forum.xwiki.org/t/cant-find-descriptor-for-parser-error-when-rendering-xwiki-to-html/391/5 "2017-08-01T15:41:10Z")

</div>

Still the same error. Running the class from eclipse works fine, however the error happens when running the packaged jar from the terminal.

I’ve also added all the jars from [Index of /releases/org/xwiki/rendering/xwiki-rendering-standalone/9.6](http://maven.xwiki.org/releases/org/xwiki/rendering/xwiki-rendering-standalone/9.6/) into my Ant project’s library and packaged into the jar. Still similar problem. Running it from eclipse works fine, but not from the jar. I guess it might be a dependency issue, but can’t figure out what’s missing as every jar has been added.

---

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [August 2, 2017, 9:22am UTC](https://forum.xwiki.org/t/cant-find-descriptor-for-parser-error-when-rendering-xwiki-to-html/391/6 "2017-08-02T09:22:25Z")

</div>

The only reason you’re getting this error is because you have the wrong classpath for some reason and the xwiki-rendering-api JAR (or xwiki-rendering-legacy-api-9.6 which wraps it and add some legacy APIs on top of it) is not in your classpath. You should check your CP.

---

<div class="post-metadata">

**Author:** ![adelcat](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/a/439d5e/32.png) [@adelcat](https://forum.xwiki.org/u/adelcat)\
**Post date:** [August 2, 2017, 10:16am UTC](https://forum.xwiki.org/t/cant-find-descriptor-for-parser-error-when-rendering-xwiki-to-html/391/7 "2017-08-02T10:16:28Z")

</div>

That was it! I added two things:

- `<addClasspath>true</addClasspath>` in my maven jar plugin,
- Added a maven dependency plugin to copy all dependency jars to my target directory.

Currently works when running it from the jar, but requires all dependency plugins to be in classpath outside the jar (so the fat jar isn’t working yet).
