Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

java.util.MissingResourceException during JAXB unmarschal

Posted on 2006-06-27
9
1,141 Views
Last Modified: 2012-08-13
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
Comment
Question by:PierreHoffmann
  • 5
  • 3
9 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 16990975
Do your own classes set a specific locale somewhere in the code?
0
 

Author Comment

by:PierreHoffmann
ID: 16991061
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
 
LVL 35

Expert Comment

by:girionis
ID: 16991110
I believe it is classpath issue. Can you post your classpath?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:PierreHoffmann
ID: 16991461
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
 
LVL 35

Expert Comment

by:girionis
ID: 16991653
Hmmm.. Can't see anythign weird. Are there any german resource bundle files? Can you make a search?
0
 

Author Comment

by:PierreHoffmann
ID: 17001100
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
 
LVL 35

Expert Comment

by:girionis
ID: 17001135
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
 
LVL 35

Expert Comment

by:girionis
ID: 17001137
> FAQ

I meant PAQ
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 17004527
Closed, 250 points refunded.
GhostMod
Community Support Moderator
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question