users@jaxb.java.net

Re: Bug Report: jaxb2-reflection: ClassCastException in ModelBuilder

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 30 Jul 2007 12:17:25 -0700

It looks like property files are not at all included in the
jaxb2-reflection!

Must be a bug in the packaging...

Malachi de Ælfweald wrote:
> If you attempt to use the jaxb2-reflection with the JDK7 codebase, you are
> supposed to get this message:
>
> JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI
> (from {1}) needs 2.1 API.
> Use the endorsed directory mechanism to place jaxb-api.jar in the
> bootstrap classloader.
> (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
>
>
>
> Instead, you get a CCE:
>
> Exception in thread "main" java.lang.ExceptionInInitializerError
> at org.jvnet.jaxb.reflection.model.impl.ModelBuilder.<clinit>(Unknown
> Source)
> at org.jvnet.jaxb.reflection.JAXBModelFactory.create(Unknown Source)
> at org.jvnet.jaxb.reflection.JAXBModelFactory.create(Unknown Source)
> at org.jvnet.jaxb.reflection.JAXBModelFactory.create(Unknown Source)
> at org.eoti.xml.JaxbIntrospector.<init>(JaxbIntrospector.java:18)
> at org.eoti.xml.JaxbIntrospector.main(JaxbIntrospector.java:12)
> Caused by: java.util.MissingResourceException: Can't find bundle for base
> name org.jvnet.jaxb.reflection.model.impl.Messages, locale en_US
> at java.util.ResourceBundle.throwMissingResourceException(
> ResourceBundle.java:1534)
> at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1278)
> at java.util.ResourceBundle.getBundle(ResourceBundle.java:733)
> at org.jvnet.jaxb.reflection.model.impl.Messages.<clinit>(Unknown
> Source)
> ... 6 more
> Caused by: java.lang.ClassCastException:
> org.jvnet.jaxb.reflection.model.impl.Messages cannot be cast to
> ResourceBundle
> at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java
> :2404)
> at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1424)
> at java.util.ResourceBundle.findBundle(ResourceBundle.java:1383)
> at java.util.ResourceBundle.findBundle(ResourceBundle.java:1310)
> at java.util.ResourceBundle.findBundle(ResourceBundle.java:1310)
> at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1252)
> ... 8 more
>
>
> The bug appears to be in the static block of the ModelBuilder,
>
> If you know what the problem is, you can fix your classpath and voila....
> but... I don't think average JRE user would know that.
>
> Malachi
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com