• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1175
  • Last Modified:

java.util.MissingResourceException during JAXB unmarschal

Hi,

I am using JAXB 1.0 (from Java WSDP 1.4) and I get the following error while unmarshalling a file:

Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name javax.xml.bind.helpers.Messages, locale de_DE
      at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:825)
      at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:794)
      at java.util.ResourceBundle.getBundle(ResourceBundle.java:532)
      at javax.xml.bind.helpers.Messages.format(Messages.java:31)
      at javax.xml.bind.helpers.Messages.format(Messages.java:12)
      at javax.xml.bind.helpers.DefaultValidationEventHandler.handleEvent(DefaultValidationEventHandler.java:57)

The java classes were generated with XJC from a *.xsd file. I use RAD 6.0 and imported the generated classes and the libs from the jwsdp-1.4 directorys "jaxb\lib" and "jwsdp-shared\lib" in my RAD project.
The sample application for unmarshalling works fine but if I use my own classes I get the above error.
Why JAXB want to use the german locale? Is there a javax.xml.bind.helpers.Messages bundle for DE and where can I find it? Or if not, how can I switch to english (hopefully the bundle for EN exists)?

Thankful for any help!!
0
PierreHoffmann
Asked:
PierreHoffmann
  • 5
  • 3
1 Solution
 
girionisCommented:
Do your own classes set a specific locale somewhere in the code?
0
 
PierreHoffmannAuthor Commented:
No (unfortunatly). I use only the JAXB classes and the java classes generated with XJC from the xsd file. For a small test I wrote a Main class (modified unmarshal example) like shown below:

/*
 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
 
import java.io.FileInputStream;
import java.io.IOException;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

// import java content classes generated by binding compiler
import com.db.gdb.as.caaa.*;

/*
 * $Id: Main.java,v 1.1.10.1 2004/04/02 19:48:28 ofung Exp $
 *
 * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
 *
 * This software is the proprietary information of Sun Microsystems, Inc.  
 * Use is subject to license terms.
 *
 */
 
public class Main {
   
    // This sample application demonstrates how to unmarshal an instance
    // document into a Java content tree and access data contained within it.
   
    public static void main( String[] args ) {
        try {
            JAXBContext jc = JAXBContext.newInstance( "com.db.gdb.as.caaa" );
           
            // create an Unmarshaller
            Unmarshaller u = jc.createUnmarshaller();
           
            // unmarshal a instance document into a tree of Java content
            // objects composed of classes from the package.
            DataImportType imp = (DataImportType)u.unmarshal( new FileInputStream( "C://Temp//x-caaa1.xml" ) );
           
        } catch( JAXBException je ) {
            je.printStackTrace();
        } catch( IOException ioe ) {
            ioe.printStackTrace();
        }
    }
   
}

The error occurs while executing the following line:
DataImportType imp = (DataImportType)u.unmarshal( new FileInputStream( "C://Temp//x-caaa1.xml" ) );
0
 
girionisCommented:
I believe it is classpath issue. Can you post your classpath?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
PierreHoffmannAuthor Commented:
The classpath is managed by RAD so I post the .classpath config file of the RAD project:

<classpath>
      <classpathentry kind="src" path="JavaSource"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jta-spec1_0_1.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jaxb-api.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/activation.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jaxb-xjc.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jaas.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-collections.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/PackageFormat.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-digester.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/xsdlib.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/namespace.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jaxb-impl.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jaxb-libs.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/mail.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/relaxngDatatype.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jax-qname.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-beanutils.jar"/>
      <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-logging.jar"/>
      <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/WebSphere v5.1 JRE"/>
      <classpathentry kind="con" path="com.ibm.wtp.server.java.core.container/com.ibm.etools.websphere.runtime.core.runtimeTarget.v51/was.base.v51"/>
      <classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
</classpath>

As Java runtime the JRE implemented in WAS 5.1 is used.
0
 
girionisCommented:
Hmmm.. Can't see anythign weird. Are there any german resource bundle files? Can you make a search?
0
 
PierreHoffmannAuthor Commented:
After some examinations I found out:
Some of the imported jars (e.g. "jaxb-api.jar") contains *.properties files for the creation of the ResourceBundle (e.g. "Messages.properties"). But the files seems to be ignored. After extracting the *.properties files from the jars and copying to the appropriate package directorys the files were used and the exception no longer occurs.

Maybe someone has a hint why the *.properties files in the jars will be ignored ....
0
 
girionisCommented:
They shouldn't be ignored. Maybe the class was trying to find them but they were in differemt location. Anyway since you foudn a solution I suggest you ask for a FAQ & points refunded.
0
 
girionisCommented:
> FAQ

I meant PAQ
0
 
GhostModCommented:
Closed, 250 points refunded.
GhostMod
Community Support Moderator
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now