Hello...
I've been trying to implement any of the suggestions for loading the
properties file when the code is in a jar. None have seemed to work.
jc = JAXBContext.newInstance( "com.explosivo.shsmith.jaxb",
com.explosivo.shsmith.jaxb.Shsmith.class.getClassLoader() );
I have tried this, and putting the properties and ser files in a normal
structure outside the jar and putting it in the classpath
All to no avail.
ERROR [main] - appModel accessXMLData produced Unable to locate
jaxb.properties for package com.explosivo.shsmith.jaxb
javax.xml.bind.JAXBException: Unable to locate jaxb.properties for
package com.explosivo.shsmith.jaxb
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
com.explosivo.shsmith.appModel.accessXMLData(appModel.java:66)
at com.explosivo.shsmith.appModel.<init>(appModel.java:52)
at
com.explosivo.shsmith.appController.<init>(appController.java:61)
at com.explosivo.shsmith.start.<init>(start.java:24)
at com.explosivo.shsmith.start.main(start.java:33)
My code works, when not in a stinkin jar
What is going wrong with this? Any help would be both appreciated and
cherished!
-----Original Message-----
From: Discussion list for the Java Architecture for XML Binding
[mailto:JAXB-INTEREST_at_JAVA.SUN.COM] On Behalf Of Brett Porter
Sent: Thursday, January 02, 2003 4:16 PM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Re: jaxb.properties and bgm.ser files in a jar
I have successfully used the method of specifying the class loader to
get them from a JAR in WEB-INF/lib from a web application, and from the
command line when running test cases. I'm not sure what your scenario
is, but it seems strange that this wouldn't work. If you look at the
source in JAXB (jaxb-api-src.zip I believe) for this portion, it is
quite simple (this lead me on to specifying the class loader to resolve
the same problem).
Cheers,
Brett
Marek Malowidzki wrote:
> you said you used:
<snip>
> Nonetheless, the workarounbd I am using with success is to place both
> bgm.ser and jaxb.properties files in a plain directory (or, to be more
> precide, in a directory tree that corresponds to the package name),
> somewhere in a classpath. Someone suggested here that this approach
> with ClassLoader was used with success to refer to these files when
> they are in a jar. I could not get this behavior and would like to
> explain a possible cause. Has anyone tried it with success?
>
> Best regards in 03,
>
> Marek