Packages in JAXB

Hi
I am trying out JAXB and have been sucessful in my test :-))
One thing i observe is when to xjc i supply my xsd files it generates java files and by default it makes GENERATED as package and everything works fine
Now i try to use my own packege by using -p option of xjc.
It generates all the relevant files and compile them too. But when i write the client (JAXBContext jbc = JAXBContext.newInstance("com.mypackage");)
and compile and try to execute it, it throws me exception
Exception in thread "main" javax.xml.bind.JAXBException: Unable to locate jaxb.properties for packag
e com.mypackage
at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:209)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:153)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:238)
at ProjectClient.<init>(ProjectClient.java:14)
at ProjectClient.main(ProjectClient.java:35)
I verfied jaxb.properties file is present in custom\mypackage
What is the problem
Thanks

why is the folder custom\mypackage when the package is com.mypackage?

Similar Messages

  • Unable to compile the JAXB generated java files

    Hi
    I am using JAXB 2.0 API for binding process.
    I have products.xml file as
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE PRODUCTDATA SYSTEM "products.dtd">
    <PRODUCTDATA>
    <PRODUCT PRODID="P001" CATEGORY="Books">
    <PRODUCTNAME>Gone with the wind</PRODUCTNAME>
    <DESCRIPTION>This is abt American Civil War</DESCRIPTION>
    <PRICE>25.00</PRICE>
    <QUANTITY>3</QUANTITY>
    </PRODUCT>
    </PRODUCTDATA>
    and products.xsd(Schema file) as
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="PRODUCTDATA" type="prdt"/>
    <xsd:complexType name="prdt">
    <xsd:sequence>
    <xsd:element name="PRODUCT" type="prd" maxOccurs="unbounded" />
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="prd">
    <xsd:sequence>
    <xsd:element name="PRODUCTNAME" type="xsd:string"/>
    <xsd:element name="DESCRIPTION" type="xsd:string"/>
    <xsd:element name="PRICE" type="xsd:positiveInteger"/>
    <xsd:element name="QUANTITY" type="xsd:nonNegativeInteger"/>
    </xsd:sequence>
    <xsd:attribute name="PRODID" type="pid" use="required"/>
    <xsd:attribute name="CATEGORY" type="xsd:string" use="optional"/>
    </xsd:complexType>
    <xsd:simpleType name="pid">
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[p]{1}/d{3}"/>
    <xsd:length value="4"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:schema>
    I am converting these schema file to java files by using binding compiler xjc.
    So that three java files are genearated automatically.
    1) ObjectFactory.java
    // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
    // See http://java.sun.com/xml/jaxb
    // Any modifications to this file will be lost upon recompilation of the source schema.
    // Generated on: 2008.06.23 at 04:09:25 PM IST
    package testing.jaxb;
    import javax.xml.bind.JAXBElement;
    import javax.xml.bind.annotation.XmlElementDecl;
    import javax.xml.bind.annotation.XmlRegistry;
    import javax.xml.namespace.QName;
    * This object contains factory methods for each
    * Java content interface and Java element interface
    * generated in the testing.jaxb package.
    * <p>An ObjectFactory allows you to programatically
    * construct new instances of the Java representation
    * for XML content. The Java representation of XML
    * content can consist of schema derived interfaces
    * and classes representing the binding of schema
    * type definitions, element declarations and model
    * groups. Factory methods for each of these are
    * provided in this class.
    @XmlRegistry
    public class ObjectFactory {
    private final static QName PRODUCTDATAQNAME = new QName("", "PRODUCTDATA");
    * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: testing.jaxb
    public ObjectFactory() {
    * Create an instance of {@link Prd }
    public Prd createPrd() {
    return new Prd();
    * Create an instance of {@link Prdt }
    public Prdt createPrdt() {
    return new Prdt();
    * Create an instance of {@link JAXBElement }{@code <}{@link Prdt }{@code >}}
    @XmlElementDecl(namespace = "", name = "PRODUCTDATA")
    public JAXBElement<Prdt> createPRODUCTDATA(Prdt value) {
    return new JAXBElement<Prdt>(_PRODUCTDATA_QNAME, Prdt.class, null, value);
    2)Prdt.java
    // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
    // See http://java.sun.com/xml/jaxb
    // Any modifications to this file will be lost upon recompilation of the source schema.
    // Generated on: 2008.06.23 at 04:09:25 PM IST
    package testing.jaxb;
    import java.util.ArrayList;
    import java.util.List;
    import javax.xml.bind.annotation.XmlAccessType;
    import javax.xml.bind.annotation.XmlAccessorType;
    import javax.xml.bind.annotation.XmlElement;
    import javax.xml.bind.annotation.XmlType;
    * <p>Java class for prdt complex type.
    * <p>The following schema fragment specifies the expected content contained within this class.
    * <pre>
    * <complexType name="prdt">
    * <complexContent>
    * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    * <sequence>
    * <element name="PRODUCT" type="{}prd" maxOccurs="unbounded"/>
    * </sequence>
    * </restriction>
    * </complexContent>
    * </complexType>
    * </pre>
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "prdt", propOrder = {
    "product"
    public class Prdt {
    @XmlElement(name = "PRODUCT", required = true)
    protected List<Prd> product;
    * Gets the value of the product property.
    * <p>
    * This accessor method returns a reference to the live list,
    * not a snapshot. Therefore any modification you make to the
    * returned list will be present inside the JAXB object.
    * This is why there is not a <CODE>set</CODE> method for the product property.
    * <p>
    * For example, to add a new item, do as follows:
    * <pre>
    * getPRODUCT().add(newItem);
    * </pre>
    * <p>
    * Objects of the following type(s) are allowed in the list
    * {@link Prd }
    public List<Prd> getPRODUCT() {
    if (product == null) {
    product = new ArrayList<Prd>();
    return this.product;
    3) Prd.java
    // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
    // See http://java.sun.com/xml/jaxb
    // Any modifications to this file will be lost upon recompilation of the source schema.
    // Generated on: 2008.06.23 at 04:09:25 PM IST
    package testing.jaxb;
    import java.math.BigInteger;
    import javax.xml.bind.annotation.XmlAccessType;
    import javax.xml.bind.annotation.XmlAccessorType;
    import javax.xml.bind.annotation.XmlAttribute;
    import javax.xml.bind.annotation.XmlElement;
    import javax.xml.bind.annotation.XmlType;
    * <p>Java class for prd complex type.
    * <p>The following schema fragment specifies the expected content contained within this class.
    * <pre>
    * <complexType name="prd">
    * <complexContent>
    * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    * <sequence>
    * <element name="PRODUCTNAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
    * <element name="DESCRIPTION" type="{http://www.w3.org/2001/XMLSchema}string"/>
    * <element name="PRICE" type="{http://www.w3.org/2001/XMLSchema}positiveInteger"/>
    * <element name="QUANTITY" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger"/>
    * </sequence>
    * <attribute name="CATEGORY" type="{http://www.w3.org/2001/XMLSchema}string" />
    * <attribute name="PRODID" use="required" type="{}pid" />
    * </restriction>
    * </complexContent>
    * </complexType>
    * </pre>
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "prd", propOrder = {
    "productname",
    "description",
    "price",
    "quantity"
    public class Prd {
    @XmlElement(name = "PRODUCTNAME", required = true)
    protected String productname;
    @XmlElement(name = "DESCRIPTION", required = true)
    protected String description;
    @XmlElement(name = "PRICE", required = true)
    protected BigInteger price;
    @XmlElement(name = "QUANTITY", required = true)
    protected BigInteger quantity;
    @XmlAttribute(name = "CATEGORY")
    protected String category;
    @XmlAttribute(name = "PRODID", required = true)
    protected String prodid;
    * Gets the value of the productname property.
    * @return
    * possible object is
    * {@link String }
    public String getPRODUCTNAME() {
    return productname;
    * Sets the value of the productname property.
    * @param value
    * allowed object is
    * {@link String }
    public void setPRODUCTNAME(String value) {
    this.productname = value;
    * Gets the value of the description property.
    * @return
    * possible object is
    * {@link String }
    public String getDESCRIPTION() {
    return description;
    * Sets the value of the description property.
    * @param value
    * allowed object is
    * {@link String }
    public void setDESCRIPTION(String value) {
    this.description = value;
    * Gets the value of the price property.
    * @return
    * possible object is
    * {@link BigInteger }
    public BigInteger getPRICE() {
    return price;
    * Sets the value of the price property.
    * @param value
    * allowed object is
    * {@link BigInteger }
    public void setPRICE(BigInteger value) {
    this.price = value;
    * Gets the value of the quantity property.
    * @return
    * possible object is
    * {@link BigInteger }
    public BigInteger getQUANTITY() {
    return quantity;
    * Sets the value of the quantity property.
    * @param value
    * allowed object is
    * {@link BigInteger }
    public void setQUANTITY(BigInteger value) {
    this.quantity = value;
    * Gets the value of the category property.
    * @return
    * possible object is
    * {@link String }
    public String getCATEGORY() {
    return category;
    * Sets the value of the category property.
    * @param value
    * allowed object is
    * {@link String }
    public void setCATEGORY(String value) {
    this.category = value;
    * Gets the value of the prodid property.
    * @return
    * possible object is
    * {@link String }
    public String getPRODID() {
    return prodid;
    * Sets the value of the prodid property.
    * @param value
    * allowed object is
    * {@link String }
    public void setPRODID(String value) {
    this.prodid = value;
    Next step is to compile these three files
    So I am compiling these three files it gives me compiler error as:
    testing/jaxb/ObjectFactory.java:31: illegal character: \64
    @XmlRegistry
    ^
    testing/jaxb/ObjectFactory.java:63: illegal character: \64
    @XmlElementDecl(namespace = "", name = "PRODUCTDATA")
    ^
    testing/jaxb/ObjectFactory.java:65: <identifier> expected
    return new JAXBElement<Prdt>(_PRODUCTDATA_QNAME, Prdt.class, null, value
    ^
    testing/jaxb/ObjectFactory.java:65: <identifier> expected
    return new JAXBElement<Prdt>(_PRODUCTDATA_QNAME, Prdt.class, null, value
    ^
    testing/jaxb/ObjectFactory.java:65: '{' expected
    return new JAXBElement<Prdt>(_PRODUCTDATA_QNAME, Prdt.class, null, value
    ^
    testing/jaxb/Prdt.java:38: illegal character: \64
    @XmlAccessorType(XmlAccessType.FIELD)
    ^
    testing/jaxb/Prdt.java:39: illegal character: \64
    @XmlType(name = "prdt", propOrder = {
    ^
    testing/jaxb/Prdt.java:44: illegal character: \64
    @XmlElement(name = "PRODUCT", required = true)
    ^
    testing/jaxb/Prdt.java:45: <identifier> expected
    protected List<Prd> product;
    ^
    testing/jaxb/Prdt.java:69: <identifier> expected
    public List<Prd> getPRODUCT() {
    ^
    testing/jaxb/Prdt.java:75: ';' expected
    ^
    testing/jaxb/Prd.java:43: illegal character: \64
    @XmlAccessorType(XmlAccessType.FIELD)
    ^
    testing/jaxb/Prd.java:44: illegal character: \64
    @XmlType(name = "prd", propOrder = {
    ^
    testing/jaxb/Prd.java:52: illegal character: \64
    @XmlElement(name = "PRODUCTNAME", required = true)
    ^
    testing/jaxb/Prd.java:53: <identifier> expected
    protected String productname;
    ^
    testing/jaxb/Prd.java:54: illegal character: \64
    @XmlElement(name = "DESCRIPTION", required = true)
    ^
    testing/jaxb/Prd.java:55: <identifier> expected
    protected String description;
    ^
    testing/jaxb/Prd.java:56: illegal character: \64
    @XmlElement(name = "PRICE", required = true)
    ^
    testing/jaxb/Prd.java:57: <identifier> expected
    protected BigInteger price;
    ^
    testing/jaxb/Prd.java:58: illegal character: \64
    @XmlElement(name = "QUANTITY", required = true)
    ^
    testing/jaxb/Prd.java:59: <identifier> expected
    protected BigInteger quantity;
    ^
    testing/jaxb/Prd.java:60: illegal character: \64
    @XmlAttribute(name = "CATEGORY")
    ^
    testing/jaxb/Prd.java:61: <identifier> expected
    protected String category;
    ^
    testing/jaxb/Prd.java:62: illegal character: \64
    @XmlAttribute(name = "PRODID", required = true)
    ^
    testing/jaxb/Prd.java:63: <identifier> expected
    protected String prodid;
    ^
    25 errors
    I want all three files to compiled successfully.If it is compiled only then I will continue on Unmarshalling process

    I suspect you are trying to compile the files one by one. You may also be trying to compile them disregarding the package structure.
    From your post, I gather these files are in the package: com.geindustrial.sqms
    Therefore, if they are not so already, put them under a directory structure:
    com/geindustrial/sqms
    and then compile with:
    javac com/geindustrial/sqms/AddCtq.java com/geindustrial/sqms/Ctq.java com/geindustrial/sqms/VariableData.java
    (The above is all on one line.)
    HTH,
    Manuel Amago.

  • Using JAXB 2.0 with JDeveloper 10.1.3

    Hi there,
    I'm having a wee bit of trouble getting JDeveloper to load my version of the JAXB 2.0 libraries.
    Everything compiles o.k. However when I run my application (on the embedded OC4J container in Jdeveloper), I get runtime errors that the OC4j container is Unable to locate jaxb.properties for my package. JAXB.properties is no longer created for JAXB 2.0. so it must be loading the JAXB 1.0 libraries.
    I know that JDeveloper has the JAXB libraries as part of it's xml.jar file, I've tried altering this but it's just caused more problems.
    Any ideas?

    Refer
    Re: SUN Jaxb2.0 incompatible with OC4J included in JDEV/OC4J ??

  • JAXB Configuration

    how to configure JAXB to add equal and hashCode methods to the generated classes ?

    In fact, I am familiar with JAXB and used it in several projects. I wrote the ObjectFactory by myself, of course, we can generate it by using xjc command. The project runs well in eclipse or netbeans without this exception because the file is there.
    This exceptioin occurs only when I make installation package by using BuildDesk. I find when I don't choose the obfuscation options in BuildDesk, it runs well. I think the shrink/optimize/obfuscate operation destroyed the ObjectFactory.class when processing the .jar file. I think the solution is package the JAXB model into a separate jar and use it as a external library, so BuildDesk doesn't process it in any case. Thank you all the same. :)
    Edited by: 807218 on Nov 3, 2010 7:29 AM

  • JAXB Exception: doesn't contain ObjectFactory.class or jaxb.index

    I'm able to run this fine using Idea, but as soon as I package the project into BuildDesk and install it, I keep getting this JAXB Exception.
    I do have the ObjectFactory.class file which was automatically generated for me, but I really don't know what's that jaxb.index. Any Idea on
    how to make this work, I just need to package this project up and submit it.
    Thanks.

    In fact, I am familiar with JAXB and used it in several projects. I wrote the ObjectFactory by myself, of course, we can generate it by using xjc command. The project runs well in eclipse or netbeans without this exception because the file is there.
    This exceptioin occurs only when I make installation package by using BuildDesk. I find when I don't choose the obfuscation options in BuildDesk, it runs well. I think the shrink/optimize/obfuscate operation destroyed the ObjectFactory.class when processing the .jar file. I think the solution is package the JAXB model into a separate jar and use it as a external library, so BuildDesk doesn't process it in any case. Thank you all the same. :)
    Edited by: 807218 on Nov 3, 2010 7:29 AM

  • Minimum packaging to deploy JAXB?

    What is the minimum set of jars I should ship to deploy XJC-generated classes?
    I'm trying to decide whether I can use JAXB, and one important factor is deployability. For my project, I can assume that the customer already has Java 1.4, but otherwise the application must be self-contained.
    I cannot ship the entire Web Services Developer Pack: that's far too large and complex for my needs, as I'm not building a web service. All I want is XML <-> Java translation using standardized APIs, and in the case of a known, fixed schema JAXB objects have better programmer convenience and memory efficiency than generic DOM trees.
    Is there an official distribution with a simple "jaxb-runtime.jar" I can use? At the moment, I'm taking individual jars out of the WSDP, trying to find the smallest set that works.
    Here's the minimum set of Jars that seem to work for running XJC generated classes.
    <fileset dir="${jwsdp}/jaxb/lib">
    <include name="jaxb-api.jar"/>
    <include name="jaxb-impl.jar"/>
    <include name="jaxb-libs.jar"/>
    </fileset>
    <fileset dir="${jwsdp}/jwsdp-shared/lib">
    <include name="jax-qname.jar"/>
    <include name="namespace.jar"/>
    <include name="relaxngDatatype.jar"/>
    <include name="xsdlib.jar"/>
    </fileset>
    Notably absent are the jars in jaxp/lib/endorsed. The large "xsdlib.jar" overlaps a lot with xercesImpl, but not enough to use it as a standalone xsd-aware jaxp parser, which I need for other reasons.
    Noteably present is a dependency on Relax NG, which I am not using.
    Unless JAXB packaging improves, I'll be using Xerces-J plus bare DOM. Tell me there's a better way?

    I think we do not have to take the files mentioned in second <fileset/> to the client. At runtime we need:
    jaxb-api.jar, jaxb-ri.jar(jaxb-impl.jar), jaxb-libs.jar, xerces.jar and generated jar for the package. It worked for me.
    Is there an official distribution with a simple
    "jaxb-runtime.jar" I can use? The JAXB system is divided into two main parts that are completely independent.
    1. Generating classes
    2. Creating objects at runtime
    Obviouly first part needs more XML specific jars, but for second part (in which client is interested) we don't need them.
    So there can't be a true "jaxb-runtime.jar".

  • Jaxb error when using -p to create package

    I have been using jaxb in its various forms for a couple years. I am currently using jaxb 2.0 (with JAVA 1.5) and have run it successfully for about a year. Now all of a sudden it is giving me an error (even when I try to re-generate XML files that I could previously generate successfully). I have narrowed down the problem (I think) to the -p argument. If I don't use the -p argument and let jaxb create the XML files and put them in the "generated" directory, it works just fine. But if I try to use -p and specify a directory to put the files in, it gives me two errors:
    [ERROR] schema_reference.4: Failed to read schema document 'file:/C:/Pythagoras2
    .0/src/ûp', because 1) could not find the document; 2) the document could not be
    read; 3) the root element of the document is not <xsd:schema>.
    unknown location
    [ERROR] schema_reference.4: Failed to read schema document 'file:/C:/Pythagoras2
    .0/src/com.prototype.xml', because 1) could not find the document; 2) the docume
    nt could not be read; 3) the root element of the document is not <xsd:schema>.
    unknown location
    I am starting at the src directory and using the command: C:\jaxb-ri-2.0\bin\xjc -p com.prototype.xml ..\classes\Pythagoras.xsd
    I thought I could just get around the problem by not using the -p argument and just copying the XML files from the generated directory to the xml directory where my application is looking for them, but jaxb embeds the "package generated" in each XML file and that gives me a compiler error.
    Any ideas on why the -p argument would all of a sudden give me errors? Thanks!
    Donna

    Hi,
    In IDT - you can't create a BusinessLayer on a BEX query OLAP Connection, and generate a .UNX.
    As the warning says: Not supported.
    That tutorial shows "adventure works" which is a MS SQL Server Analysis Services demo/sample cube.
    As i said above: MSAS is OK for OLAP UNX.
    Regards,
    H
    please vote for these items if you feel so inclined https://cw.sdn.sap.com/cw/ideas/8701
    and https://cw.sdn.sap.com/cw/ideas/3657

  • Javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package ...

    I want to marshall a java content tree (generated with jaxb api) in xml stream
    in an EJB.
    Generated classes are archived in a jar file containing its jaxb.properties, when
    I test it
    in a classic java process it runs well.
    When I try to do it in an EJB with weblogic 8.1 I get the following error:
    javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package
    I've checked:
    - jaxb.properties is in the archive file
    I've tried to put the jar file in the classpath of the server in the starter script.
    I've tried to put reference classpath in the manifest of the ejb jar and of application
    ear.
    I've tried to put both reference in server classpath and ear/jar manifest.
    I still doesn't run.
    Any idea?
    Thanks a lot
    Franck

    Add the directory of the generated classes in the classpath.
    "franck" <[email protected]> wrote:
    >
    I want to marshall a java content tree (generated with jaxb api) in xml
    stream
    in an EJB.
    Generated classes are archived in a jar file containing its jaxb.properties,
    when
    I test it
    in a classic java process it runs well.
    When I try to do it in an EJB with weblogic 8.1 I get the following error:
    javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package
    I've checked:
    - jaxb.properties is in the archive file
    I've tried to put the jar file in the classpath of the server in the
    starter script.
    I've tried to put reference classpath in the manifest of the ejb jar
    and of application
    ear.
    I've tried to put both reference in server classpath and ear/jar manifest.
    I still doesn't run.
    Any idea?
    Thanks a lot
    Franck

  • JAXB: Unable to locate jaxb.properties for package com.globalrefund.jaxb

    When I package my classes into a jar and try to run my app with
    java -jar myapp.jar
    I get "Unable to locate jaxb.properties for package com.globalrefund.jaxb"
    Everything works fine when I run my app by setting the classpath followed by "java com.globalrefund.MainClass".
    "jaxb.properties" is in the jar in the directory "com.globalrefund.jaxb". I use JRE 1.4.1.
    What's wrong?
    Regards,
    Bernhard

    a little additional info:
    It works when I put jaxb.properties in the directory com.globalrefund.jaxb and let classpath point to the root of the directory structure.
    If I create a jar containing exactly the same directory structure and add the jar to the classpath it does not work.
    Looks like JAXB cannot read jaxb.properties from a jar?!
    Any ideas?
    Thanks
    Bernhard

  • JAXB unable to compile generated package

    following the tutorial I ran xjc.sh on my xsd file generating a package with a -p option.
    when I ran javac user/*.java /usr/impl/*.java I received 100 error message all basicly complaining about missing classes
    ex:
    user/impl/UserDataImpl.java:13: package com.sun.xml.bind does not exist
    implements user.UserData, com.sun.xml.bind.RIElement, com.sun.xml.bind.JAXBObject, user.impl.runtime.UnmarshallableObject, user.impl.runtime.XMLSerializable, user.impl.runtime.ValidatableObject
    user/impl/UserDataTypeImpl.java:11: package com.sun.xml.bind does not exist
    public class UserDataTypeImpl implements user.UserDataType, com.sun.xml.bind.JAXBObject, user.impl.runtime.UnmarshallableObject, user.impl.runtime.XMLSerializable, user.impl.runtime.ValidatableObject
    how do I fix this? where do I find sun.com.xml and other related packages could my xaxb.properties have anything to do with this?
    Here it is:
    #Sun Jan 04 22:52:08 EST 2004
    javax.xml.bind.context.factory=com.sun.xml.bind.ContextFactory_1_0_1
    com.sun.xml.bind.jaxbContextImpl=user.impl.runtime.DefaultJAXBContextImpl
    I am using the web services development pack version 1.3
    here's my xsd file
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="userData" type="userDataType"/>
    <xsd:complexType name="userDataType">
    <xsd:sequence>
    <xsd:element name="userInfo" type="userInfoType" minOccurs="1" m
    axOccurs="1"/>
    <xsd:element name="buddy" type="buddyType" minOccurs="0" maxOccu
    rs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="userInfoType">
    <xsd:sequence>
    <xsd:element name="userID" type="xsd:unsignedShort"/>
    <xsd:element name="userName" type="xsd:string"/>
    <xsd:element name="hashedPW" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="buddyType">
    <xsd:sequence>
    <xsd:element name="userID" type="xsd:unsignedShort"/>
    <xsd:element name="userName" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    drop a line if yo have any idea as to how to fix this

    I wonder if you come across any soultion or suggestion regarding your problem. I have the same kind of problem you are having eventhough I have copied the JWSDP_HOME\jre\lib\endorsed to my <JAVA_HOME>.
    I also updated my CLASSPATH to point to all the required jar files as mentioned in the forum.
    The number of errors have reduced, but I am running into the runtime error. Any idea on what the solution is? Thanks.
    givemethatjava
    I am glad your were able to run it. I, however, am
    still having problems even after placing all the .jar
    files in the jaxb, jaxp, jaxrpc directories in my
    path. 100 errors such as
    .\primer\po\impl\runtimeDefaultJAXBContextImpl.java:128
    cannot resolve symbol
    symbol: class Validator
    location: class primer.po.impl.runtime.Default
    JAXBContextImpl
    public Validator createValidator() throws
    s JAXBException{
    ^
    ...Property Exceptions, and
    .\primer\po\impl\runtime\UnmarshallingContext.java:18:
    package javax.xml.bind does not exist
    import javax.xml.bind.ValidationEvent;
    and
    .\primer\po\impl\runtime\ValidationContext.java:27:
    package com.sun.xml.bind does not exist
    import com.sun.xml.bind.ProxyGroup
    ^
    etc...
    I will continue searching the forums, and other
    sources. Thanks for your help!

  • Specifying package structure and inheritance for jaxb generated classes ??

    Friends,
    Now I am tuned up with the sweet JAXB utility...
    I need answers to this..
    1. How do I specify a package structure in my generated java files?
    2. How do I specify inheritance heirarchy to my generated java files ?
    I assume, there must be some way of doing this, without opening the actuall source.
    any ideas ??
    Thanks
    Rakesh

    how about inheritance heirarchy ? What if i plan to include theses generated classes in my inheritance heirarchy ?
    Bhakti, any idea what is the final version release date ? I desperately need answer to this.
    Thanks
    Rakesh

  • Upgrading to JAXB/JWSDP1.3 from JAXB/JWSDP 1.2 -- problems

    I am seeing 2 problems after upgrading to the JAXB found in WSDP 1.3 (from 1.2)
    We are using JAXB in a client/server style app where the server is accessed via a web interface and the client is delivered via Java Web Start (JWS). Both the server and client use JAXB-generated classes.
    We have an ant build.xml file that invokes xjc and this was working for us as expected.
    For the JWS piece, we need to sign the jars we use and for testing purposes we were self-signing them, including the jar files needed for JAXB also self-signed. This is also coordinated through an ant task.
    After replacing the jar files in our lib area with the ones from my recent download of the 1.3 version of JAXB the following happens.
    1. I am seeing compiler deprecation warnings for the generated code -- this did not happen in our use of JAXB from 1.2. For example:
    [javac] /Users/jjs/Projects/SGS-Install-Fixed/sgs/src/com/gestalt/sgs/uobdif/impl/runtime/SAXMarshaller.java:259: warning: ERR_MISSING_OBJECT in com.sun.xml.bind.marshaller.Messages has been deprecated
    [javac] Messages.format(Messages.ERR_MISSING_OBJECT), null,
    [javac] ^
    I am using Java 1.4.1 on Max OS X (I know... not supported but this doesn't seem like a platform dependency) and these warnings go away if I revert back to the JAXB jars from the 1.2 release of WSDP.
    2. These are only warnings, so my build proceeds with ant. But, when I get to the jar signing step I see:
    [signjar] Signing Jar : /Users/jjs/Projects/SGS-Install-Fixed/sgs/lib/jaxb-libs.jar
    [signjar] jarsigner: unable to sign jar: java.util.zip.ZipException: invalid entry compressed size (expected 63854 but got 19845 bytes)
    I looked at the jar file using the jar command and there are entries there:
    4038 Wed Dec 03 22:16:20 EST 2003 META-INF/MANIFEST.MF
    3303 Wed Dec 03 22:16:20 EST 2003 META-INF/SUN_MICR.RSA
    3780 Wed Dec 03 22:16:20 EST 2003 META-INF/SUN_MICR.SF
    0 Wed Dec 03 22:16:20 EST 2003 META-INF/pack.properties
    that suggest to me that perhaps the jar is now sigend by Sun and therefore can't be signed again. If I look at the corresponding jar from the JAXB/1.2, these SUN_MICR entries do not appear.
    Is this assumption correct? Can I deliver my app through web start with my apps own jars self-signed and the JAXB jars signed by Sun? I suppose I can un-jar the JAXB jars, remove the manifest material and then re-jar the files and sign those. I expect this might work.
    I am looking to share migration experiences (1.2 to 1.3) and to see what work-arounds there might be.
    Thanks
    Jim

    Replying to my own post.
    It seems that with the JWSDP 1.3 release, most (if not all) of the included jars are signed by Sun. You can NOT include jars with different signatures in the same web start application -- that's the error I get when I tried to do this.
    This means that if I want to package my jars using a self-signed certificate, I have to first un-jar all of the JAXB lib jars I want to include, get rid of the parts of the manifest that deal with signing, re-jar them and then sign all of the jars in my web start app using my own cert. More work for me, but not a show-stopper.
    I still am not sure why I am getting deprecated warnings from javac though.
    Jim

  • How to install and run a JAXB example

    I have given a work to install and run an example of JAXB. I didn't have any idea about it.
    What is the procedure and the necessary fiels are needed to download, so that JAXB program can run.....
    Please some one help me out.
    Thanks

    At first I used an xjc.bat command to generate JAXB Java classes from the source XML Schema
    C:\jwsdp-1.3\jaxb\bin\xjc.bat po.xsd -p primer.po
    It works, and created the Java files. But when i try to compile it like this
    C:\jwsdp-1.3\jaxb\bin\javac Main.java primer\po\*.java primer\po\impl\*.java
    it genertaes 100 errors and prompting that package java.xml.bind does not exist.
    package com.sun.msv.verifier does not exist.
    I am not getting where is the problem,
    Please help me out ...
    Thanks

  • JAXB 1.0 release date?

    According to the JAXB web site, http://java.sun.com/xml/jaxb/index.html:
    "JAXB 1.0 will be available as an optional package for the Java(TM) 2 Platform, Standard Edition (J2SE(tm)). JAXB may be included in future releases of J2SE or the Java� 2 Platform, Enterprise Edition (J2EE�)."
    Does anyone know the scheduled release date of the JAXB 1.0 optional package, or if the release date will be around the same time as the J2SE 1.4 scheduled release?
    Regards,
    Vanita

    <xml-java-binding-schema>
         <options package="my.package.com"/>
         <element name="test" type="class" root="true"/>
    </xml-java-binding-schema>

  • JAXB question

    DB Structure
    Parent Table - Incident --> Child Table - IncidentCharges --> Child Table of IncidentCharges --> IncidentChargeWeapons
    Container
    Oracle Containers for JAVA(OC4J)
    We have a schema (Incident.xsd) which comprises of our entire database structure. We unmarshalled the schema using JAXB to Java classes and interfaces .
    It created 2 .java classes and 2 .java interfaces for each high level tag . for eg for our Incident tag it created a Incident interface and a IncidentType Interface
    and also it created 2 classes IncidentImpl and IncidentTypeImpl . The IncidentTypeImpl has all the get and set properties we require eg. getIncidentType,
    setIncidentType,getIncidentNumber,setIncidentNumber,getOccuranceDate,setOccuranceDate etc.
    Our objective is to create a JSP page which has form fields to enter data which use these JAXB generated classes get and set properties. In other words
    we want to bind the JSP form fields to these JAXB generated classes. And once these JAXB objects are populated we want to marshal it and create a XML file with the data from those JAXB . Our database would then consume the generated XML. We tried creating a simple incident form with just 3 fields IncidentType,Occurance date and Incident Number and tried to bind these fields with the properties from IncidentTypeImpl classes using the <jsp:usebean> tag . When we deployed it to our container and tried to load the Incident.jsp page , it would not load up . Only when we cleared all the bindings it loaded up .
    Then we tried another workaround (just to get it working. Not a preferred approach) . We created another simple JAVA bean(not JAXB generated beans) which has set and get properties for the form fields and bound the form fields to it.
    On submitting the JSP page we called a servlet which takes data from our created bean and transfers it to the JAXB generated IncidentTypeImpl bean. When we deployed this the jsp page loads up and also our bean is filled with data . But the servlet bombs with this error below.
    500 Internal Server Error
    java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
    at Servlets.IncidentServlet.doPost(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
    at java.lang.Thread.run(Thread.java:534)
    We have 2 questions .
    1. Can a JSP page be bound directly to this JAXB generated bean in pretty much the same way as we bind it to our own bean ? (We would like to do this so that we dont have to create duplicate classes which mirror the JAXB generated classes.)
    2. Is there something special we have to do to deploy this application to recognize the JAXB classes. Do we have to deploy some jar file for it to recognize those classes ?

    Nevermind, I have then answer to my question - use this flag - use-runtime <pkg> : suppress the generation of the impl.runtime package and simply

Maybe you are looking for