users@jaxb.java.net

Re: jaxb.properties and bgm.ser files in a jar

From: Marek Malowidzki <maom_onet_at_poczta.onet.pl>
Date: Mon, 30 Dec 2002 13:57:51 +0100

----- Original Message -----
From: "Brett Porter" <bporter_at_f2network.com.au>
To: <JAXB-INTEREST_at_JAVA.SUN.COM>
Sent: Monday, December 09, 2002 10:14 PM
Subject: Re: jaxb.properties and bgm.ser files in a jar


> I've also found that you can specify the classloader when getting a new
> instance to workaround this:
>
> JAXBContext.newInstance( "some.package",
> some.package.ClassInJar.class.getClassLoader());
>
> Cheers,
> Brett

Thanks for the hint, but ... I could not make it work. I have a few JAXB
packages and thus a few jaxb.properties files. I have packed everything in a
jar, modified the code as above in all places I am creating a new instance of
JAXBContext. I hve the follwing exception:

javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package mao.s
nmp.screens.xmlbindings.screens
        at
javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:176)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:126)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:274)
        at mao.snmp.screens.Screen.readTemplate(Screen.java:2054)
        at mao.snmp.screens.Screen.main(Screen.java:2163)

Where 2054 line in Screen.java is the following:

JAXBContext jc = JAXBContext.newInstance("some.my.package",
some.my.package.WindowTemplate.class.getClassLoader());


So, is there any workaroud or should I wait for a new version?

Marek