Exception in kilbill catalog plugin

132 views
Skip to first unread message

athira sasikumar

unread,
May 8, 2021, 1:36:54 PM5/8/21
to Kill Bill users mailing-list
Hi Team,

We are creating catalog plugin and i have created my StandaloneCatalog object and i want to convert the POJO into xml string. i have used the XMLWriter.writeXML() for the same.
Have added the below dependency to the pom. 
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>

While running the code, i encountered below exception. 

"message": "Implementation of JAXB-API has not been found on module path or classpath.",
    "stacktrace": [
        "javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.",
        " - with linked exception:",
        "[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory not found by com.hp.cloud.stratus.ico.plugin.spa-ico-catalog-plugin [2]]",
        "\tat javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278)",

I could resolve the exception by adding below dependency and i could create the xml string successfully.
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.3</version>
</dependency>

But the moment i added this dependency, i am not able to call the other KillBill APIs(osgiKillbillAPI.getCatalogUserApi().getCurrentCatalog()  ), Getting the below exception.

"message": "java.lang.IllegalStateException: Failed to de-serialize catalog for tenantRecordId=&#39;1&#39;",
    "stacktrace": [
        "java.lang.RuntimeException: java.lang.IllegalStateException: Failed to de-serialize catalog for tenantRecordId='1'",
Caused by: java.util.concurrent.ExecutionException: javax.xml.bind.JAXBException: ClassCastException: attempting to cast bundle://2.0:1/javax/xml/bind/JAXBContext.class to jar:file:/C:/Program%20Files/Java/jdk1.8.0_281/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class.  Please make sure that you are specifying the proper ClassLoader.
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:192)
        

I have tried to add several libraries to resolve the issue. But issue still persist. Could you please check and let me know what needs to be done to resolve this error. 


Reshma Bidikar

unread,
May 13, 2021, 4:39:20 AM5/13/21
to Kill Bill users mailing-list
Hello Athira,

This issue is most probably because some packages are missing in the Import-package header in the manifest.mf file of your plugin jar. Since Kill Bill plugins are packaged as OSGi bundles, the manifest.mf file in the plugin jar needs to have an import-package header that specifies the packages imported from Kill Bill. Normally, this header is automatically computed for you without you having to do anything explicitly. 

Would it be possible for you to share the contents of your manifest.mf here just to confirm the issue? You can extract it from the META-INF folder of your plugin JAR and open it with any text editor. Alternatively, you can also run the bnd tool on your JAR file to obtain the manifest.mf contents. You can install the bnd command-line tool as per the instructions specified here.

We are also working on updating our plugin development document instructions to explain/document this better.

Regards,
Reshma

Reply all
Reply to author
Forward
0 new messages