JAXB Classpath

Using JAXB -(schemagen.bat) i need to create the .xsd file.
To which , should i set the classpath.
(TO schemagen.bat OR any-other jar file )
After setting the classpath, how can i run it to create the .xsd
(Is this the way???)
c:\>schemagen MyJfile.java
C:\jaxb-ri-20060801\bin>schemagen.bat
When i do this it gives an exception like this -->
Exception in thread "main" java.lang.NoClassDefFoundError: Files\Java\jdk1/5/0_0
6\lib;/;F:\java\packages;C:\Program

Hello,
The problem comes from the way you have set the classpath variable.
Try to put each classpath entry with space in the path between ".
For example:
set CLASSPATH=c:\toto;"c:\program files\java";c:\temp
Use ", even if you have defined the classpath as an environment variable.
Marc

Similar Messages

  • Jaxb classpath / which jars?

    typical jaxb sample
      <path id="classpath">
        <fileset dir="${jwsdp.home}" includes="jaxb/lib/*.jar" />
        <fileset dir="${jwsdp.home}" includes="jwsdp-shared/lib/*.jar" />
        <fileset dir="${jwsdp.home}" includes="jaxp/lib/**/*.jar" />
      </path>definitely bad style, always the same cp with tons of jar-archives!
    there is absolutely no info in the jaxb docs which archives one has to use
    at "source-generation" time
    at compile time
    at runtime (which jars do I have to ship?)
    do I really have to figure it out with trial & error?
    activation.jar
    jaas.jar
    jax-qname.jar
    xalan.jar
    commons-beanutils.jar
    jaxb-api.jar
    jta-spec1_0_1.jar
    xercesImpl.jar
    commons-collections.jar
    jaxb-impl.jar
    mail.jar
    xsdlib.jar
    commons-digester.jar
    jaxb-libs.jar
    namespace.jar
    commons-logging.jar
    jaxb-xjc.jar
    relaxngDatatype.jar
    dom.jar
    jaxp-api.jar
    sax.jar

    Add <JWSDP>/jaxb/lib/jaxb-api.jar, <JWSDP>/jaxb/lib/jaxb-impl.jar, <JWSDP>/jaxb/lib/jaxb-libs.jar, and <JWSDP>/jaxb/lib/jaxb-xjc.jar to the Classpath variable. <JWSDP> is the directory in which Java Web Service Developer Pack is installed. Also, add the <JWSDP>/jwsdp-shared/lib/namespace.jar, <JWSDP>/jwsdp-shared/lib/jax-qname.jar, and <JWSDP>/jwsdp-shared/lib/relaxngDatatype.jar to the Classpath.

  • Jaxb+classpath+directory structure

    I have generated the files using xjc by giving xjc -b work\ItemList.xjs -dtd work\itemList.dtd -p test.jxml -d work from bin directory...
    When i try to compile the generated java files....
    " com.sun.xml.bind"...cannot find...like this its giving for all....Think classpath is not properly set or some problem with directory strcture.can someone help me...
    my cp is
    set JAVA_HOME=C:\j2sdk1.4.2_03
    set JWSDP_HOME=C:\jwsdp-1.4
    set JAXB_HOME=%JWSDP_HOME%\jaxb
    set JAXB_LIBS=%JAXB_HOME%\lib
    set JAXP_LIBS=%JWSDP_HOME%\jaxp\lib
    set JWSDP_LIBS=%JWSDP_HOME%\jwsdp-shared\lib
    set PATH=%JAXB_HOME%\bin;%JWSDP_HOME%\jwsdp-shared\bin;%PATH%
    set CLASSPATH=%JAXB_LIBS%\jaxb-api.jar;%JAXB_LIBS%\jaxb-ri.jar;%JAXB_LIBS%\jaxb-xjc.jar;%JAXB_LIBS%\jaxb-libs.jar;%JAXP_LIBS%\jaxb-api.jar;%JAXP_LIBS%\endorsed\xercesImpl.jar;%JAXP_LIBS%\endorsed\xalan.jar;%JAXP_LIBS%\endorsed\sax.jar;%JAXP_LIBS%\endorsed\dom.jar;%JWSDP_LIBS%\jax-qname.jar;%JWSDP_LIBS%namespace.jar;.
    According to me classpath i think its ok....Problem regarding directory structure.Pls xplain.
    Thanks in advance

    Right ... I just realized that %JAXP_LIBS%\jaxb-api.jar doesn't exist.
    Run any of the examples with "ant -v" to see what the classpath should be.
    -- Ed

  • JAXB.NewInstance requires jaxb.properties in JAXB 2.0

    The XJC in JAXB 2.0 does not generate the jaxb.properties file, but the JAXBContext.NewInstance requires it.
    I am sure that the old JAXB is not installed on my machine, because I just got a new machine and only installed the JAXB 2.0.
    I am using Oracle JDeveloper on Windows XP and I have the following environment vars:
    JAVA_HOME=C:\Oracle\10g\jdk\jre
    JAXB_HOME=C:\Oracle\10g\jaxb
    CLASSPATH=c:\oracle\10g\jaxb\lib\jaxb-api.jar;c:\oracle\10g\jaxb\lib\jaxb-impl.jar;c:\oracle\10g\jaxb\lib\jaxb-xjc.jar + some other files
    My code is nothing special:
    JAXBContext loJAXBContext = JAXBContext.newInstance("si.ixtlan_team.bibliotheque2.materialdata");
    Did anyone have a similar problem and knows the solution?
    Thanks,
    Bogdan

    Can you please let me know how did you solve it. I ahve the same problem in jdeveloper. even though I load jaxb2.0 library manually, runtimr jdeveloper picks up 1.o library.
    Thanks

  • JAXB runtime ClassNotFoundException

    I'm trying to set up some really basic build stuff using ant and JAXB to handle the transforming of some XML data, but I'm having some trouble getting it to not throw exceptions at runtime. I've successfully got an XJC task running in ant that is definitely outputting all the correct java classes, and they compile without an issue.
    The problems occur when I either try to unmarshall or marshall any data using a JAXBContext. basically, my code looks something like this:
    public class Deserializer<T>
         private JAXBContext m_context;
         private Unmarshaller m_unmarshaller;
         public Deserializer(String contextPath)
              try
                   JAXBContext m_context = JAXBContext.newInstance(contextPath);
                   Unmarshaller m_unmarshaller = m_context.createUnmarshaller();
              catch (JAXBException e)
                   System.out.println(e);
         public T deserialize(File xml)
              try
                   return (T)m_unmarshaller.unmarshal(new FileInputStream(xml));
              catch (FileNotFoundException e)
                   System.out.println(e);
              catch (IOException e)
                   System.out.println(e);
              catch (JAXBException e)
                   System.out.println(e);
              return null;
    }and the exception that I am seeing when the unmarshal function is called is this:
    [java] Caused by: javax.xml.datatype.DatatypeConfigurationException: Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found
         [java]      at javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:137)
         [java]      at com.sun.xml.bind.DatatypeConverterImpl.<clinit>(DatatypeConverterImpl.java:740)
         [java]      ... 39 more
         [java] Caused by: java.lang.ClassNotFoundException: org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl
         [java]      at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1400)
         [java]      at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1341)
         [java]      at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1094)
         [java]      at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
         [java]      at javax.xml.datatype.FactoryFinder.getProviderClass(FactoryFinder.java:115)
         [java]      at javax.xml.datatype.FactoryFinder.newInstance(FactoryFinder.java:146)
         [java]      at javax.xml.datatype.FactoryFinder.findJarServiceProvider(FactoryFinder.java:298)
         [java]      at javax.xml.datatype.FactoryFinder.find(FactoryFinder.java:223)
         [java]      at javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:131)
         [java]      ... 40 morewhich looks like maybe my classpath might be wrong? im really not sure. Ive tried downloading xerces .jar's and pointing the classpath at that, with identical results. For reference, I'm not using any IDE's, just good old vim on a fresh mac running snow leopard.
    Any help at all would be greatly appreciated.
    Thanks,
    s.

    This is the ant code im using:
         <java classname="testjaxb.testjaxbCLI">
                <classpath>
                   <pathelement path="${basedir}/tools/testjaxb/build" />
                   <fileset dir="${lib.dir}/commons-cli-1.2"/>
                   <fileset dir="${lib.dir}/jaxb"/>
                </classpath>
         </java>The buid directory is where all class files from the compilation stage (both my stuff and the stuff generated by xjc) are dumped. The commons-cli-1.2 directory is for apache commandline parsing classes. the jaxb directory contains these jars (just in case i'm missing one for some reason):
    activation.jar
    jaxb-impl.jar
    jaxb-xjc.jar     
    jaxb1-impl.jar
    jaxb-api.jar
    jsr173_1.0_api.jar
    s

  • Can't import schemas in classpath when generating JAXB

    I'm trying to create schemas that are used to provide basic components for more complex schemas, using the same design idea behind creating abstract Java classes and then extending them. I'm having trouble referring to classes in different modules, though. Below is the start of a schema that refers to a schema that is stored in another jar file:
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://xml.kitfox.com/schema/tw/ts"
        elementFormDefault="qualified"
        xmlns:tns="http://xml.kitfox.com/schema/tw/ts"
        xmlns:cmn="http://xml.kitfox.com/schema/common">
        <xsd:import schemaLocation="/com/kitfox/common.xsd" namespace="http://xml.kitfox.com/schema/common"/>
        <xsd:complexType name="sourceType">
            <xsd:attribute name="uid" type="cmn:uidType"/>
        </xsd:complexType>I'm generating my JAXB with the following task:
        <target name="bind-preferences" depends="init">
            <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
                <classpath>
                    <pathelement path="${javac.classpath}"/>
                </classpath>
            </taskdef>
            <xjc destdir="gen" extension="true" removeOldOutput="true">
                <schema dir="src">
                    <include name="**/*.xsd"/>
                </schema>
                <produces dir="gen">
                    <include name="**/*.java"/>
                </produces>
            </xjc>
        </target>Unfortunately, this causes the following error:
    [WARNING] schema_reference.4: Failed to read schema document '/com/kitfox/common.xsd', 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>.
      line 9 of file:/C:/dev/kitfox.com/gameEngine/proj/tileWorld/src/com/kitfox/tw/ts.xsd
    [ERROR] src-resolve: Cannot resolve the name 'cmn:uidType' to a(n) 'type definition' component.
      line 24 of file:/C:/dev/kitfox.com/gameEngine/proj/tileWorld/src/com/kitfox/tw/ts.xsd
    [ERROR] src-resolve: Cannot resolve the name 'cmn:uidType' to a(n) 'simpleType definition' component.
      line 24 of file:/C:/dev/kitfox.com/gameEngine/proj/tileWorld/src/com/kitfox/tw/ts.xsdI know that the classpath passed into the xjc task contains the jar with my original schema. What can I do so that JAXB finds it? Also, how would I tell JAXB to extend the classes already generated for common.xsd in my original jar rather than regenerating them in the jar I'm compiling?

    Thanks. I've looked into using a catalog (the ant task allows you to specify a catalog), but don't think I've got the syntax right. Does the following look right to you?
    <!DOCTYPE catalog
      PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
             "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
    <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
             prefer="public">
      <uri name="common.xsd"
       uri="../gb/src/com/kitfox/common.xsd"/>
    </catalog>I've changed my schema to look like:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://xml.kitfox.com/schema/tw/ts"
        elementFormDefault="qualified"
        xmlns:tns="http://xml.kitfox.com/schema/tw/ts"
        xmlns:cmn="http://xml.kitfox.com/schema/common">
        <xsd:import schemaLocation="common.xsd" namespace="http://xml.kitfox.com/schema/common"/>
        <xsd:complexType name="sourceType">
            <xsd:attribute name="uid" type="cmn:uidType"/>
        </xsd:complexType>I'm still getting errors:
    [WARNING] schema_reference.4: Failed to read schema document 'common.xsd', 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>.
      line 9 of file:/C:/dev/kitfox.com/proj/tw/src/com/kitfox/tw/ts.xsd
    [ERROR] src-resolve: Cannot resolve the name 'cmn:uidType' to a(n) 'type definition' component.
      line 24 of file:/C:/dev/kitfox.com/proj/tw/src/com/kitfox/tw/ts.xsd
    [ERROR] src-resolve: Cannot resolve the name 'cmn:uidType' to a(n) 'simpleType definition' component.
      line 24 of file:/C:/dev/kitfox.com/proj/tw/src/com/kitfox/tw/ts.xsdI've tried some variations such as leaving out the import/@schemaLocation attribute and hoping that the catalog could resolve that with the namespace alone or creating a fake http:// url for the schemaLocation, but none of that works. Would you know what I'm doing wrong with this catalog? The catalog and ant file are in the same directory and the relative path to the common.xsd file is correct.

  • Set classpath in JAXB - schemagen

    Using JAXB -(schemagen.bat) i need to create the .xsd file.
    To which , should i set the classpath.
    (TO schemagen.bat OR any-other jar file )
    After setting the classpath, how can i run it to create the .xsd
    (Is this the way???)
    c:\>schemagen MyJfile.java
    C:\jaxb-ri-20060801\bin>schemagen.bat
    When i do this it gives an exception like this -->
    Exception in thread "main" java.lang.NoClassDefFoundError: Files\Java\jdk1/5/0_0
    6\lib;/;F:\java\packages;C:\Program
    https://jaxb.dev.java.net/nonav/2.0.2/docs/schemagen.html

    The first major problem with the Runtime.exec() method is that path is obviously a variable and would need to be placed outside the quote marks: Process p = Runtime.exec("set classpath=" + path); Secondly this would only work under Windows, in Unix/BASH the command to set an environment variable would be export CLASSPATH=path.
    I had a similar problem two years ago, unfortunately I can't remember exactly how I did it, but I'm fairly certain it involved using the system properties of the System class. There is a system property called java.class.path, more info can be found in the API for the System class: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html
    Look especially at the methods getProperties() (contains a list of the system property names), and setProperty().

  • Error while running simple JAXB test class

    I am new to JAXB and trying to run simple tutorial code.
    I created Java project and added required jar files in a classpath.
    But I get error as
    "com.jaxbtest" doesnt contain ObjectFactory.class or jaxb.index
    I am using Eclipse and I have added these external jars in build path as well as in "Open Run Dialog" classpath.
    Thank you in advance.
    YB

    Hi Timo,
    Im using JDev version 11.1.1.6.0.
    I checked the class path on the jdev console. All the library references are mentioned in the manifest.mf classpath of the test project like below:
    Manifest-Version: 1.0
    Class-Path: lib/identitystore.jar
    lib/adfm.jar
    lib/groovy-all-1.6.3.jar
    lib/adftransactionsdt.jar
    lib/adf-dt-at-rt.jar
    lib/adfdt_common.jar
    lib/adflibrary.jar
    lib/xmlparserv2.jar
    lib/db-ca.jar
    lib/jdev-cm.jar
    lib/ojmisc.jar
    lib/commons-el.jar
    lib/jsp-el-api.jar
    etc...
    So I expect the library references should be resolved looking at the manifest file.
    Another set of entries that I see in the jdev classpath are related to the Model project which is under test.
    -classpath
    D:\CurrentProject_1\16_7_2013_3pm\11_7_2013\.adf;
    D:\CurrentProject_1\16_7_2013_3pm\11_7_2013\Model\classes;
    How do I put these entries into my class path? Will it be sufficient if I add the Model.jar into my test project classpath?
    Thanks,
    Sapna

  • WSIF calling EJB 3.0 beans, with JAXB 2.0.2 as the JavaSerializer

    I'm working with SOA suite (10.1.3.1.0 [build #0 ]), and I am trying to allow my BPEL processes to call my EJB 3.0 stateless session beans via WSIF.
    This works fine when I am passing primitives (strings, dates and so-forth) between BPEL and my EJB's using WSIF.
    However I want to be able to pass my 'business objects" across the BPEL/EJB boundary directly. I started off by following the BPEL cookbook article "Using WSIF for Integration" which was usefull in showing how to use JAXB 1.x generated classes across the BPEL/EJB boundary.
    However in the project I am working on we want to use JAXB 2.0 as it allows us to create an XML schmea binding directly from our existing "business objects".
    So I am using the knowlege gained in the article mentioned above to implement a custom JavaSerializer for my bpel process that will use JAXB 2.0. My custom JavaSerilizer is being invoked correctly, when I invoke my BPEL process, but it is unable to load the correct JAXB (2.0.2) classes - it keeps getting the JAXB 1.0 classes that come standard with oracle.
    My debug code that prints out the classloaders for my serializers (and parent classloaders) reports the following:
    06/09/05 11:18:18 CustomSerializer.serialize
    06/09/05 11:18:18 Classloader =oracle.bpel.common:10.1.3
    06/09/05 11:18:18 Classloader =api:1.4.0
    06/09/05 11:18:18 Classloader =jre.extension:0.0.0
    06/09/05 11:18:18 Classloader =jre.bootstrap:1.5.0_06
    The Jaxb classes it is loading a coming from classloader:
    06/09/05 11:18:18 JAXBContext classloader =oracle.xml:10.1.0_2
    My question is how do I get the JAXB 2.0 classes in my classpath?
    Thanks,
    Dave Oram

    Hello,
    About WSIF, we are currently working on a WSIF-EJB30 binding that will allow you to direclty annotate the session ben and get the EJB exposed as SOAP and WSIF binding out of the box.
    This will be available in OracleAS 10.1.3.1 production.
    Regards
    Tugdual Grall

  • Help needed regarding change of system CLASSPATH

    Hi All,
    I need to change the system CLASSPATH using my java programe. I tried the following code but its not working though it returns the correct CLASSPATH, but unable to do the modification. All I need is to append a new jar file in the existing CLASSPATH..
    code]
    try{
              sysMap = System.getenv();
              }catch(Exception se1){
                        System.out.println("Exception in finding Environment properties");
              Set Keys = sysMap.keySet();
              Iterator It = Keys.iterator();
              while(It.hasNext()){
                   String strNow =(String) It.next();
                   if(strNow.contains("CLASSPATH")){
                        System.setProperty("CLASSPATH", ".;C:\\Calypso\\Software\\\\Release\\jars\\calypso.jar;C:\\Calypso\\Software\\Release\\build;C:\\Calypso\\Software\\Release\\build\\calypsofx;C:\\Calypso\\Software\\Release\\resources;C:\\Calypso\\Software\\Release;C:\\Calypso\\Software\\Release\\jars\\jconn2.jar;C:\\Calypso\\Software\\Release\\jars\\jaxb-1.0.4\\;C:\\Calypso\\Software\\Release\\jars\\javacup.jar;C:\\Calypso\\Software\\Release\\jars\\antlr.jar;C:\\Calypso\\Software\\Release\\jars\\ojdbc14.zip;C:\\Calypso\\Software\\Release\\jars\\web\\servlet.jar;C:\\Calypso\\Software\\Release\\jars\\web\\webserver.jar;C:\\Calypso\\Software\\Release\\jars\\ftp.jar;C:\\Calypso\\Software\\Release\\jars\\itext-1.02b.jar;C:\\Calypso\\Software\\Release\\jars\\Jama-1.0.1.jar;C:\\jdk1.5.0_10\\bin;C:\\Calypso\\Software\\Release\\webfx\\calypsoWebFXServer.jar;C:\\XXX.jar");
                        System.out.println("Classpath changed");
    Any help will be appreciated.

    Hi Kaj ,
    Well I am in a situation where we need to extend a
    existing system and we are providing the client with
    a new jar file for every modification. Now all I need
    is that our programe automatically add (infect
    append) the jar file in the existing system
    CLASSPATH, so that the client need not to add(append)
    the new jar files all the time.
    Can you provide any help??As others have said, use -cp as argument when you start your application. It's quite common that people write a script that adds all jars in a certain directory to the argument to -cp.
    Kaj

  • Can't create a JAXB binding for ejb-jar.xml using xjc

    Hi all,
    I have been trying to build a JAXB binding for EJB deployment descriptors, mainly because I have to update a hand-cranked ejb-jar.xml file on the fly with some additions that have come from a code generator.
    I have tried to use
    xjc ejb-jar_2_1.xsd j2ee_1_4.xsd ejb-jar_2_1.xsd
    xjc on the schema definitions I found at http://java.sun.com/xml/ns/j2ee/ but I can't get it to work. It produces reams of errors, see below for a short extract.
    Of course, someone could put me out of my misery and tell me where to find a binding that someone else has done. I can't be the first chimp on the planet that has wanted to do this!
    Any help much appreciated.
    errors:
    [WARNING] warning: "blockDefault" attribute of <schema> is not supported
    line 3 of xml.xsd
    [WARNING] warning: "finalDefault" attribute of <schema> is not supported
    line 3 of xml.xsd
    [WARNING] warning: <key> identity constraint will be ignored by JAXB validation
    line 117 of j2ee_web_services_client_1_1.xsd
    [WARNING] warning: <key> identity constraint will be ignored by JAXB validation
    line 115 of ejb-jar_2_1.xsd
    [WARNING] warning: <keyref> identity constraint will be ignored by JAXB validation
    line 129 of ejb-jar_2_1.xsd
    [WARNING] warning: <key> identity constraint will be ignored by JAXB validation
    line 145 of ejb-jar_2_1.xsd
    [WARNING] warning: <keyref> identity constraint will be ignored by JAXB validation
    line 159 of ejb-jar_2_1.xsd

    Exception initializing 'oracle.dbtools.raptor.MonitorJDBCAddin' in extension 'Oracle SQL Developer': oracle.classloader.
    util.AnnotatedNoClassDefFoundError:
    Missing class: oracle.jdbc.OracleDriverThe Oracle driver is not on the classpath.

  • Parsing Problem in JAXB

    Hi, I am getting run time exception. I have kept all 4 jar files in classpath..
    Exception::javax.xml.bind.JAXBException: Provider com.sun.xml.bind.ContextFactor
    y_1_0_1 not found
    - with linked exception:
    [java.lang.ClassNotFoundException: com.sun.xml.bind.ContextFactory_1_0_1]
    Exception in thread "main" java.lang.NullPointerException
    at com.veritas.ProcessItem.readItem(ProcessItem.java:117)
    at com.veritas.ProcessItem.<init>(ProcessItem.java:86)
    at com.veritas.ProcessItem.main(ProcessItem.java:126)
    So wht could be the reason??
    Thanks
    Chintan

    I've the same problem, but in java 6.
    The jaxb jars are included in jdk6, right?

  • Jaxb with weblogic -- java.lang.NoClassDefFoundError: javax/xml/bind/MarshallableRootElement

    I am trying to use jaxb with Weblogic 6.1. I kept both the jaxb jar file in weblogic
    classpath in setEnv script. I am getting the following error, when I am trying
    to use jaxb
    java.lang.NoClassDefFoundError: javax/xml/bind/MarshallableRootElement
    I tried other options also like coping both jar file in jre/ext dir but then I
    got security error.
    I will appreciate if someone in this newsgroup comments or suugest some solution.
    Thanks
    Jeewan

    On 06 Aug 2002, Jeewan wrote:
    >
    I am trying to use jaxb with Weblogic 6.1. I kept both the jaxb jar
    file in weblogic classpath in setEnv script. I am getting the
    following error, when I am trying to use jaxb
    java.lang.NoClassDefFoundError: javax/xml/bind/MarshallableRootElement
    I tried other options also like coping both jar file in jre/ext dir
    but then I got security error.
    I will appreciate if someone in this newsgroup comments or suugest
    some solution. Put the jaxb jar file in in your webapp's WEB-INF/lib directory and it
    should work fine.
    Barry

  • JAXB: not able to get Attribute value

    Hi there,
    I am using oracle JAXB for XML processing. I am not able to get the value of an attribute. I ran the same code in SUN JWSDP 1.3, which worked correctly. I am not able to get the "foo" attribute for <Table> element using oracle JAXB.
    The XML schema follows:
    <?xml version='1.0' encoding='UTF-8' ?>
    <schema targetNamespace="http://www.oracle.com/iAS/aggregator"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:ag="http://www.oracle.com/iAS/aggregator"
    xmlns="http://www.w3.org/2001/XMLSchema"
    jaxb:version="1.0"
    elementFormDefault="qualified">
    <annotation>
    <appinfo>
    <jaxb:globalBindings fixedAttributeAsConstantProperty="true"
    />
    <jaxb:schemaBindings>
    <jaxb:package name="oracle.dms.aggregator.adml"/>
    </jaxb:schemaBindings>
    </appinfo>
    </annotation>
    <complexType name="Adml_T">
    <sequence>
    <element name="Table" type="ag:Table_T" minOccurs="0" maxOccurs="unbounded"/>
    </sequence>
    <attribute name="Version" type="token" fixed="10.1.3"/>
    </complexType> <!-- Adml -->
    <complexType name="Table_T">
    <attribute name="foo" type="Name"/>
    </complexType> <!-- Table -->
    <element name="Adml" type="ag:Adml_T"/>
    </schema>
    The XML file is:
    <?xml version='1.0' encoding='UTF-8' ?>
    <Adml xmlns="http://www.oracle.com/iAS/aggregator">
    <Table foo="foosailor">
    </Table>
    </Adml>
    The java file is:
    import javax.xml.bind.JAXBContext;
    import javax.xml.bind.Unmarshaller;
    import java.io.File;
    import java.util.List;
    import java.util.Iterator;
    import oracle.dms.aggregator.adml.Adml;
    import oracle.dms.aggregator.adml.TableT;
    public class JaxbQA
    public static void main (String[] args)
    throws Exception
    Adml adml;
    String fileName = "aggregator.xml";
    String instancePath = "oracle.dms.aggregator.adml";
    JAXBContext jc = JAXBContext.newInstance(instancePath);
    Unmarshaller u = jc.createUnmarshaller();
    u.setValidating(true);
    Object obj = u.unmarshal(new File(fileName));
    adml = (Adml)obj;
    List tables = adml.getTable();
    for (Iterator iter = tables.iterator();
    iter.hasNext();)
    TableT admlTable = (TableT)iter.next();
    String name = admlTable.getFoo();
    System.err.println("table foo=" + name);
    c:\oracle\jdk\bin\java.exe -classpath .;c:\oracle\xdk\lib\xmlparserv2.jar;c:\oracle\xdk\lib\xml.jar JaxbQA
    table foo=null

    I tested in both 10.1.0.2.0 and 10.1.0.3, which both showed the same problem. A bug #3621204 has been filed.

  • Injest XML (JAXB) with Apache CXF on Weblogic 9.2.3

    I have tried all of the suggestions I can find out there, but still can not get Weblogic and CXF to play along when injesting XML.
    CXF is deployed and working in production.
    Now that I want add a method to XML results, I declared with JAX-RS like this:
    @POST
    @Consumes( "application/xml")
    @Path( "{order_id}/" + ANALYSE_PARAM )
    public void reportResult( @PathParam( "order_id") int orderId, AnalyseResults analyseResults ) {
    // NOTE: AnalyseResults is a JAXB object which we've created (i.e. mappings to Java provided)
    However, when this method is invoked, I get this:
    , I get this:
    2011-10-26 14:02:46,766 WARN org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper - WebApplicationException has been caught : no cause is available
    java.lang.IllegalArgumentException: Unable to access unsupported property javax.xml.stream.supportDTD
    at weblogic.xml.stax.ConfigurationContextBase.check(ConfigurationContextBase.java:60)
    at weblogic.xml.stax.ConfigurationContextBase.setProperty(ConfigurationContextBase.java:54)
    at weblogic.xml.stax.XMLStreamInputFactory.setProperty(XMLStreamInputFactory.java:280)
    at org.apache.cxf.staxutils.StaxUtils.createXMLInputFactory(StaxUtils.java:195)
    at org.apache.cxf.staxutils.StaxUtils.getXMLInputFactory(StaxUtils.java:166)
    at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1164)
    at org.apache.cxf.jaxrs.provider.JAXBElementProvider.unmarshalFromInputStream(JAXBElementProvider.java:214)
    at org.apache.cxf.jaxrs.provider.JAXBElementProvider.doUnmarshal(JAXBElementProvider.java:180)
    at org.apache.cxf.jaxrs.provider.JAXBElementProvider.readFrom(JAXBElementProvider.java:149)
    at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1013)
    at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:594)
    at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:559)
    at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230)
    at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3244)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2010)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1916)
    I've done all the reading out there and taken all the suggestions:
    - the woodstox and stax2 JARs are on my classpath
    - the weblogic-application.xml file has been modified to include (a number of varieties have been tried):
    <prefer-application-packages>
              <package-name>javax.jws.*</package-name>
              <package-name>javax.xml.*</package-name>
              <package-name>org.apache.*</package-name>
    </prefer-application-packages>
    I understand the root of the issue: the System properties / JAR files which are first read by Weblogic force the loading of the weblogic.xml.stax.XMLStreamInputFactory as "the way" to create StAX InputFactories.
    But ... that Factory (for whatever reason) is incompatible with the way that CXF invokes it.
    So ... is there ANY way to get WebLogic to allow CXF to use an alternate parser?

    A support ticket (SR 3-4866617511) with Oracle has confirmed that the Weblogic StAX parser has a defect. A patch is available for WLS 10mp2 (and possibly for 9.2.4).
    However, it is also possible to work around with a different StAX implementation.
    Our choice was Woodstox and after putting the JARs (Woodstox and StaX2 mentioned below plus the xml-apis.jar and a xerces implementation JAR) in WEB-INF/lib and removing the changes to weblogic-application.xml (below), the magic was changing WEB-INF/weblogic.xml file (as described in http://download.oracle.com/docs/cd/E13222_01/wls/docs92/programming/classloading.html )to include:
    <container-descriptor>
    <servlet-reload-check-secs>-1</servlet-reload-check-secs>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
    Why does this work?
    By using the "prefer-web-inf-classes" node, the WL Classloader looks first in the JAR files of the Web Application (rather than it's own classes). In this case it finds the META-INF/services/javax.xml.stream.XMLInputFactory from the Woodstox JAR (rather than the one from weblogic.jar). Note how this is not just about loading classes from the WEB-INF/lib JARs first ... it also affects how Weblogic interacts with the JAR Service Provider Interface (SPI ... http://docs.oracle.com/javase/tutorial/sound/SPI-intro.html).
    However, the XercesImpl.jar is becomes necessary because when running without it, the following error occurs:
    javax.xml.datatype.FactoryFinder:Using context class loader: weblogic.utils.classloaders.ChangeAwareClassLoader@1a3c1d6 finder: weblogic.utils.classloaders.CodeGenClassFinder@488280 annotation: appsdirtbiis_dir@btb-ws/ic
    javax.xml.datatype.FactoryFinder:found null in $java.home/jaxp.properties
    javax.xml.datatype.FactoryFinder:loaded from fallback value: org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl
    <Nov 8, 2011 11:58:41 AM EST> <Error> <HTTP> <BEA-101017> <[weblogic.servlet.internal.WebAppServletContext@e02837 - appName: '_appsdir_tbiis_dir', name: '/btb-ws/ic', context-path: '/btb-ws/ic'] Root cause of ServletException.
    java.lang.Error: javax.xml.datatype.DatatypeConfigurationException: Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found
    Truncated. see log file for complete stacktrace
    >
    THAT issue is due to the fact that the javaee-5.0.5-api.jar's implementation of javax.xml.datatype.DatatypeFactory provides org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl (rather than com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl which is the fallback for the JDK 1.5 implementation that ships with WL 9.2) as the fallback value.
    However, this mechanism is only used because none of the JARs (either in my app or in the standard WL distro) contain an file named "META-INF/services/java.xml.datatype.DatatypeFactory" which points to an existing Xerces implementation.
    The xml-apis.jar was necessary because of unit test I was running on the package. YMMV with the xml-apis.jar.

Maybe you are looking for

  • Simple definitions of terms

    I am new to OBIEE and am trying to understand the blogs, etc. that I read. I only work with the front-end of OBIEE so I am not as familiar with the back-end. Would someone please give a simple definition of the difference between the Presentation Lay

  • Could not initialize photoshop because there is not enough memory

    Hello there i am using Windows XP in Bootcamp on a MacBook Pro. This system goes phantastic without any problems since more than half a year now. Now i decided to use this MacBook for my work as well, but unfortunately my CS2 Photoshop can not be ins

  • Receiving ASN -- IDoc application error

    Hi experts, I am working on Auto-ID integration Scenario. when i am sending ASN (DESADV.DELVRY03 IDoc) to receiving R3 system using XI, i am getting the following error, <b>POSEX field empty --> Application document not posted</b> I gone thru the IDo

  • Sharepoint Authentication with OWIN

    Hello, I am working on Publishing site on SP 2013 with Object Model. I tried to use OWIN Middleware to authenticate the customer. The steps I follow are: -> deployement of OWIN assemblies in the web application: OK -> Startup Class: OK public void Co

  • Logs link in App Server control

    Hi, I have installed OAS 10g 10.1.3.1 and facing a strange issue. The "Logs" link is not active on my AS Control page. Please help. Thanks, AP