Regarding error in uploadCatalog

34 views
Skip to first unread message

Astha Jyoti

unread,
Jul 8, 2024, 9:56:56 AMJul 8
to Kill Bill users mailing-list
Hi Team,
I created a test tenant. Then i hit uploadCatalog from CatalogUserapi of osgikillbill. But i am getting below error in uploadCatalog in XMLLoader.java file  at following
public static Unmarshaller unmarshaller(final Class<?> clazz) throws JAXBException, SAXException, IOException, TransformerException {
JAXBContext context = JAXBContext.newInstance(new Class[]{clazz});

Error:
RuntimeException: Invalid catalog for tenant : 37
caused by
java.util.concurrent.FutureTask@61b7a44d[Completed exceptionally: javax.xml.bind.JAXBException: ClassCastException: attempting to cast bundle://9f88e3b6-4f9f-449e-8aaa-de012c418006_1.0:1/javax/xml/bind/JAXBContext.class to jar:file:/Users/asthajyoti/.m2/repository/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar!/javax/xml/bind/JAXBContext.class.  Please make sure that you are specifying the proper ClassLoader.    ]

I have tried to remove and add relevant dependencies and the recent dependency is following:

<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>

Has anyone faced any similar issue or resolved it?

Thanks
Astha

karan bansal

unread,
Jul 8, 2024, 2:08:31 PMJul 8
to Kill Bill users mailing-list
Hi Astha,

Could you share the catalog that you are trying to upload.

Regards
Karan

karan bansal

unread,
Jul 9, 2024, 2:36:21 PMJul 9
to Kill Bill users mailing-list
Hi Astha,

The catalog is indeed valid. 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 check the contents of your manifest.mf 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.

Regards
Karan
On Monday, July 8, 2024 at 7:26:56 PM UTC+5:30 Astha Jyoti wrote:

Astha Jyoti

unread,
Jul 11, 2024, 3:20:59 AMJul 11
to Kill Bill users mailing-list
Hi Karan,
Below is the import-package i got from my Jar file
Import-Package: org.joda.time.format;version="2.9",org.joda.time;versi on="2.9",org.killbill.billing.account.api;version="0.0.0",org.killbil l.billing.catalog.api.rules;version="0.0.0",org.killbill.billing.cata log.api;version="0.0.0",org.killbill.billing.catalog.plugin.api;versi on="0.0.0",org.killbill.billing.control.plugin.api;version="0.0.0",or g.killbill.billing.currency.api;version="0.0.0",org.killbill.billing. currency.plugin.api;version="0.0.0",org.killbill.billing.entitlement. api;version="0.0.0",org.killbill.billing.entitlement.plugin.api;versi on="0.0.0",org.killbill.billing.invoice.api.formatters;version="0.0.0 ",org.killbill.billing.invoice.api;version="0.0.0",org.killbill.billi ng.invoice.plugin.api;version="0.0.0",org.killbill.billing.notificati on.plugin.api;version="0.0.0",org.killbill.billing.osgi.api.config;ve rsion="0.0.0",org.killbill.billing.osgi.api;version="0.0.0",org.killb ill.billing.osgi.libs.killbill;version="0.0.0",org.killbill.billing.o verdue.api;version="0.0.0",org.killbill.billing.payment.api;version=" 0.0.0",org.killbill.billing.payment.plugin.api;version="0.0.0",org.ki llbill.billing.security.api;version="0.0.0",org.killbill.billing.secu rity;version="0.0.0",org.killbill.billing.tenant.api;version="0.0.0", org.killbill.billing.usage.api;version="0.0.0",org.killbill.billing.u sage.plugin.api;version="0.0.0",org.killbill.billing.util.api;version ="0.0.0",org.killbill.billing.util.audit;version="0.0.0",org.killbill .billing.util.callcontext;version="0.0.0",org.killbill.billing.util.c ustomfield;version="0.0.0",org.killbill.billing.util.entity;version=" 0.0.0",org.killbill.billing.util.nodes;version="0.0.0",org.killbill.b illing.util.tag;version="0.0.0",org.killbill.billing;version="0.0.0", org.osgi.service.log;version="1.5",org.slf4j;version="1.7.2",com.sun. activation.registries;resolution:=optional,com.sun.tools.javac.proces sing;resolution:=optional,com.sun.tools.javac.util;resolution:=option al,com.sun.xml.fastinfoset.sax;resolution:=optional,com.sun.xml.fasti nfoset.stax;resolution:=optional,javax.annotation.processing;resoluti on:=optional,javax.crypto;resolution:=optional,javax.crypto.spec;reso lution:=optional,javax.imageio;resolution:=optional,javax.imageio.str eam;resolution:=optional,javax.lang.model;resolution:=optional,javax. lang.model.element;resolution:=optional,javax.net.ssl;resolution:=opt ional,javax.persistence;resolution:=optional,javax.security.auth.x500 ;resolution:=optional,javax.servlet;resolution:=optional;version="[4. 0,5)",javax.servlet.http;resolution:=optional;version="[4.0,5)",javax .sql;resolution:=optional,javax.tools;resolution:=optional,javax.xml. datatype;resolution:=optional,javax.xml.namespace;resolution:=optiona l,javax.xml.parsers;resolution:=optional,javax.xml.stream;resolution: =optional,javax.xml.stream.events;resolution:=optional,javax.xml.stre am.util;resolution:=optional,javax.xml.transform;resolution:=optional ,javax.xml.transform.dom;resolution:=optional,javax.xml.transform.sax ;resolution:=optional,javax.xml.transform.stream;resolution:=optional ,javax.xml.validation;resolution:=optional,javax.xml.xpath;resolution :=optional,org.apache.tools.ant;resolution:=optional,org.apache.tools .ant.types;resolution:=optional,org.eclipse.core.resources;resolution :=optional,org.eclipse.core.runtime;resolution:=optional,org.eclipse. core.runtime.adaptor;resolution:=optional,org.eclipse.jdt.core;resolu tion:=optional,org.eclipse.jdt.core.dom;resolution:=optional,org.ecli pse.jdt.core.dom.rewrite;resolution:=optional,org.eclipse.jdt.core.se arch;resolution:=optional,org.eclipse.jdt.internal.compiler.ast;resol ution:=optional,org.eclipse.jdt.internal.compiler.lookup;resolution:= optional,org.eclipse.jdt.internal.core;resolution:=optional,org.eclip se.jdt.internal.core.dom.rewrite;resolution:=optional,org.eclipse.jdt .internal.corext.refactoring;resolution:=optional,org.eclipse.jdt.int ernal.corext.refactoring.structure;resolution:=optional,org.joda.conv ert;resolution:=optional,org.junit.rules;resolution:=optional,org.jvn et.fastinfoset;resolution:=optional,org.jvnet.staxex;resolution:=opti onal,org.osgi.framework;resolution:=optional;version="[1.10,2)",org.p ostgresql.util;resolution:=optional,org.w3c.dom;resolution:=optional, org.w3c.dom.ls;resolution:=optional,org.xml.sax;resolution:=optional, org.xml.sax.ext;resolution:=optional,org.xml.sax.helpers;resolution:= optional,sun.misc;resolution:=optional,org.apache.shiro.subject;versi on="1.3",org.apache.shiro.util;version="1.3",org.apache.shiro;version ="1.3",org.killbill.billing.beatrix.bus.api;version="0.0.0",org.killb ill.billing.notification.api;version="0.0.0",org.killbill.billing.not ification.plugin;version="0.0.0",org.killbill.billing.overdue;version ="0.0.0",org.killbill.billing.util.email;version="0.0.0",org.killbill .billing.util.template.translation;version="0.0.0",org.killbill.billi ng.util.template;version="0.0.0",org.killbill.clock;version="0.0.0",o rg.osgi.service.deploymentadmin;version="1.1.0",org.osgi.service.even t;version="1.2.0",org.osgi.service.http;version="1.2.0",org.slf4j.eve nt;resolution:=optional;version="1.7.2",org.slf4j.helpers;resolution: =optional;version="1.7.2",org.slf4j.spi;resolution:=optional;version= "1.7.2" Tool: Bnd-6.3.1.202206071316


I am still not able to understand why class cast exception is coming,, now its coming in getCatalog also, even when i am hitting the get catalog api from postman. Can you please help ?

Error in get Catalog:
java.lang.RuntimeException: java.lang.IllegalStateException: Failed to de-serialize catalog for
tenantRecordId=&#39;37&#39

{cause=java.util.concurrent.ExecutionException: javax.xml.bind.JAXBException:
ClassCastException: attempting to cast bundle://1b3e2e60-d16b-435d-990f-278e00fc9b9a_1.0:1/javax/xml/bind/JAXBContext.class to jar:file:/Users/asthajyoti/.m2/repository/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar!/javax/xml/bind/JAXBContext.class.
Please make sure that you are specifying the proper ClassLoader. , code=2080, formattedMsg='Invalid catalog for tenant : 37'}

Thanks,
Astha Jyoti

Pierre-Alexandre Meyer

unread,
Jul 11, 2024, 3:32:01 AMJul 11
to Astha Jyoti, Kill Bill users mailing-list
Hi Astha,

This is quite difficult to debug on this mailing-list without having access to the code unfortunately.

That being said, I suspect the following missing imports from your MANIFEST.MF are the culprit:

javax.xml.bind;resolution:=optional;version="[2.3,3)",javax.xml.bind.annotation;resolution:=optional;version="[2.3,3)",javax.xml.bind.annotation.adapters;resolution:=optional;version="[2.3,3)"

Make sure the plugin jar doesn't contain any of these libraries (javax.xml.bind:jaxb-api, etc.) and import the jakarta equivalents (jakarta.servlet:jakarta.servlet-api, etc.) as provided (they come from Kill Bill).

--
You received this message because you are subscribed to the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/bd59dc94-9666-4d38-805f-b5e97749ad83n%40googlegroups.com.


--
Pierre

Astha Jyoti

unread,
Jul 17, 2024, 10:02:21 AM (10 days ago) Jul 17
to Kill Bill users mailing-list
Hi Pierre,

Thanks for your guidance. Previously, i used killbill commons xmlLoader library to marshal it so the dependency you mentioned was an indirect dependency. I will look into it more. For now, i have used a different library for marshalling so no conflict issue is coming.

Thanks
Astha

Reply all
Reply to author
Forward
0 new messages