Solved

java.util.MissingResourceException during JAXB unmarschal

Posted on 2006-06-27
9
1,144 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
[X]
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
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
fibonacci ten numbers 4 54
use lov values 2 72
SequenceInputStream example 3 21
jsp error 6 45
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

756 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