JAXB UTFDataFormatException
Please, can any body help me with my encoding:
I am trying to unmashall an xml document, but while unmashalling I got an UTFDataFormatException.
The xml document is in a byte[] and this is the way I try to unmashall it:
tringReader source = new StringReader(new String(bytes, "UTF-8"));
InputSource input = new InputSource(source);
input.setEncoding("UTF-8");
JAXBContext jc = JAXBContext.newInstance("de.ropardo.bob.domain");
Unmarshaller unmarshaller = jc.createUnmarshaller();On Windows it works fine, but when I try to deploy it on a linux server I got the following exception:
javax.xml.bind.JAXBException
- with linked exception:
[java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.]
at com.sun.xml.bind.v2.runtime.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:162)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:129)Thanks,
Sebastian
We're getting the same problem, did you find a solution to this one ?
If you did, please post your solution - would much appreciate it
Thanks
Simon
Similar Messages
-
Marshaling problem in creation of xml thru JAXB
Hi java gurus,
I am trying to create an XML which will has the data of database using JAXB. I am able to generate JAXB classes, but its giving some error the stack trace is like this
java.lang.NoSuchMethodError: com.sun.xml.bind.marshaller.XMLWriter.setXmlDecl(Z)V
at org.bas.dss.common.vo.bii.impl.runtime.MarshallerImpl.createWriter(MarshallerImpl.java:223)
at org.bas.dss.common.vo.bii.impl.runtime.MarshallerImpl.createWriter(MarshallerImpl.java:238)
at org.bas.dss.common.vo.bii.impl.runtime.MarshallerImpl.createWriter(MarshallerImpl.java:233)
at org.bas.dss.common.vo.bii.impl.runtime.MarshallerImpl.marshal(MarshallerImpl.java:126)
at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:66)
at org.bas.dss.common.dao.MetaDAO.createInstInformation(MetaDAO.java:627)
at org.bas.core.fidownload.DownloadActionHandler.getInstInfoXMLData(DownloadActionHandler.java:163)
at org.bas.core.fidownload.DownloadActionHandler.performPreDownloadAction(DownloadActionHandler.java:74)
at org.bas.core.fidownload.DownloadAction.perform(DownloadAction.java:129)
at org.bas.core.fidownload.DownloadAction.execute(DownloadAction.java:79)
the method is like this,
valueObject = getInstInformation (registrationId, appVersionId);
System.out.println("MetaDAO-->valueObject:"+valueObject); //here i am gettingthe object
context = JAXBContext.newInstance("org.bas.dss.common.vo.bii");
System.out.println("MetaDAO-->context:"+context); //here i am getting the context
sumissionInfoMarshaller = context.createMarshaller();
System.out.println("MetaDAO-->sumissionInfoMarshaller:"+sumissionInfoMarshaller); //here also i am getting some object type
sumissionInfoMarshaller.setProperty(
Marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE);
System.out.println("MetaDAO-->MetaDAO-->");
sumissionInfoMarshaller.marshal (valueObject, streamToWrite); // the problem is coming here.
anyone can suggest what will be the problem, and tell me how can i resolve this issue,
thanks in advance,
varmaPl post this question to SDK Forum
-
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
JimReplying 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 read the attribute of the xml file using jaxb
Thanks,
Buddy as i have a issue i have to read the xml file using jaxb and xml file contains this data and i have read the attribute like name , desc and action for a particular menu name pls tell the code how to do this it will be a great favour to me
thanx in advance
Rasool
<contextmenu>
<menu name='Lead' >
<menuitem name='newlead' desc='New Lead' action='/leads.do?dispatch=insert' />
<menuitem name='editlead' desc='Edit Lead' action='' />
<menuitem name='leadinfo' desc='Lead Information' action='' />
</menu>
<menu name='Cases' >
<menuitem name='' desc='' action='' />
<menuitem name='' desc='' action='' />
<menuitem name='' desc='' action='' />
</menu>
<menu name='Contact' >
<menuitem name='' desc='' action='' />
<menuitem name='' desc='' action='' />
<menuitem name='' desc='' action='' />
</menu>
</contextmenu>What my program do is to get the encoding of XML files and convert them to UTF-8 encoding files, while I need this "encoding" information of the original XML document thus I can convert...
After reading specifications and JDOM docs, the truth turns to be disappointed, no function is provided to get this information in JDOM level 2(the current released one), while it's promissed that this function will be provided in JDOM level API....
Thanx all for your help and attention!!! -
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.
YBHi 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 OramHello,
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 -
JAXB Problem: xjc gives an error
Hello everyone,
I would like to use JAXB to extract various information from a class of XML documents that conform to a schema. After tweaking the schema so that I avoid namespace conflicts with xjc, I settled the namespace conflicts, but I got the following error. Even if you don't have an answer, could you give me some pointers so that I can at least begin tackling the problem?
Thank you very much!
Here is the output of the command I ran:
C:\Documents and Settings\Berk Kapicioglu\Desktop>xjc -p test.jaxb ownership4ADocument.xsd.xml -d work
parsing a schema...
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.launcher.ChildMain.run(ChildMain.java:269)
Caused by: java.util.MissingResourceException: Can't find resource for bundle ja
va.util.PropertyResourceBundle, key parser.cc.8
at java.util.ResourceBundle.getObject(ResourceBundle.java:314)
at java.util.ResourceBundle.getString(ResourceBundle.java:274)
at com.sun.msv.datatype.xsd.regex.RegexParser.ex(RegexParser.java:138)
at com.sun.msv.datatype.xsd.regex.ParserForXMLSchema.parseCharacterClass
(ParserForXMLSchema.java:291)
at com.sun.msv.datatype.xsd.regex.RegexParser.parseAtom(RegexParser.java
:736)
at com.sun.msv.datatype.xsd.regex.RegexParser.parseFactor(RegexParser.ja
va:638)
at com.sun.msv.datatype.xsd.regex.RegexParser.parseTerm(RegexParser.java
:342)
at com.sun.msv.datatype.xsd.regex.RegexParser.parseRegex(RegexParser.jav
a:320)
at com.sun.msv.datatype.xsd.regex.RegexParser.parse(RegexParser.java:158
at com.sun.msv.datatype.xsd.regex.RegularExpression.setPattern(RegularEx
pression.java:3040)
at com.sun.msv.datatype.xsd.regex.RegularExpression.setPattern(RegularEx
pression.java:3051)
at com.sun.msv.datatype.xsd.regex.RegularExpression.<init>(RegularExpres
sion.java:3017)
at com.sun.msv.datatype.xsd.PatternFacet.compileRegExps(PatternFacet.jav
a:79)
at com.sun.msv.datatype.xsd.PatternFacet.<init>(PatternFacet.java:67)
at com.sun.msv.datatype.xsd.TypeIncubator.derive(TypeIncubator.java:261)
at com.sun.tools.xjc.reader.xmlschema.DatatypeBuilder.restrictionSimpleT
ype(DatatypeBuilder.java:82)
at com.sun.xml.xsom.impl.RestrictionSimpleTypeImpl.apply(RestrictionSimp
leTypeImpl.java:66)
at com.sun.tools.xjc.reader.xmlschema.DatatypeBuilder.build(DatatypeBuil
der.java:65)
at com.sun.tools.xjc.reader.xmlschema.SimpleTypeBuilder.buildPrimitiveTy
pe(SimpleTypeBuilder.java:161)
at com.sun.tools.xjc.reader.xmlschema.SimpleTypeBuilder.access$100(Simpl
eTypeBuilder.java:50)
at com.sun.tools.xjc.reader.xmlschema.SimpleTypeBuilder$Functor.checkCon
version(SimpleTypeBuilder.java:201)
at com.sun.tools.xjc.reader.xmlschema.SimpleTypeBuilder$Functor.restrict
ionSimpleType(SimpleTypeBuilder.java:276)
at com.sun.xml.xsom.impl.RestrictionSimpleTypeImpl.apply(RestrictionSimp
leTypeImpl.java:66)
at com.sun.tools.xjc.reader.xmlschema.SimpleTypeBuilder.build(SimpleType
Builder.java:93)
at com.sun.tools.xjc.reader.xmlschema.cs.DefaultClassBinder.simpleType(D
efaultClassBinder.java:130)
at com.sun.xml.xsom.impl.SimpleTypeImpl.apply(SimpleTypeImpl.java:89)
at com.sun.tools.xjc.reader.xmlschema.cs.ClassSelector._bindToClass(Clas
sSelector.java:212)
at com.sun.tools.xjc.reader.xmlschema.cs.ClassSelector.bindToType(ClassS
elector.java:177)
at com.sun.tools.xjc.reader.xmlschema.TypeBuilder.elementDeclFlat(TypeBu
ilder.java:213)
at com.sun.tools.xjc.reader.xmlschema.FieldBuilder.elementDecl(FieldBuil
der.java:384)
at com.sun.xml.xsom.impl.ElementDecl.apply(ElementDecl.java:174)
at com.sun.tools.xjc.reader.xmlschema.FieldBuilder.build(FieldBuilder.ja
va:76)
at com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder$Builder.part
icle(DefaultParticleBinder.java:399)
at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.applyRecursively(BGMBui
lder.java:490)
at com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder$Builder.mode
lGroup(DefaultParticleBinder.java:462)
at com.sun.xml.xsom.impl.ModelGroupImpl.apply(ModelGroupImpl.java:80)
at com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder$Builder.buil
d(DefaultParticleBinder.java:368)
at com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder$Builder.part
icle(DefaultParticleBinder.java:433)
at com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder$Builder.buil
d(DefaultParticleBinder.java:371)
at com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder.build(Defaul
tParticleBinder.java:70)
at com.sun.tools.xjc.reader.xmlschema.ct.FreshComplexTypeBuilder$1.parti
cle(FreshComplexTypeBuilder.java:48)
at com.sun.xml.xsom.impl.ParticleImpl.apply(ParticleImpl.java:68)
at com.sun.tools.xjc.reader.xmlschema.ct.FreshComplexTypeBuilder.build(F
reshComplexTypeBuilder.java:35)
at com.sun.tools.xjc.reader.xmlschema.ct.ComplexTypeFieldBuilder.build(C
omplexTypeFieldBuilder.java:56)
at com.sun.tools.xjc.reader.xmlschema.FieldBuilder.complexType(FieldBuil
der.java:228)
at com.sun.xml.xsom.impl.ComplexTypeImpl.apply(ComplexTypeImpl.java:194)
at com.sun.tools.xjc.reader.xmlschema.FieldBuilder.build(FieldBuilder.ja
va:76)
at com.sun.tools.xjc.reader.xmlschema.cs.ClassSelector.build(ClassSelect
or.java:340)
at com.sun.tools.xjc.reader.xmlschema.cs.ClassSelector.access$000(ClassS
elector.java:54)
at com.sun.tools.xjc.reader.xmlschema.cs.ClassSelector$Binding.build(Cla
ssSelector.java:107)
at com.sun.tools.xjc.reader.xmlschema.cs.ClassSelector.executeTasks(Clas
sSelector.java:240)
at com.sun.tools.xjc.reader.xmlschema.BGMBuilder._build(BGMBuilder.java:
118)
at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.build(BGMBuilder.java:8
0)
at com.sun.tools.xjc.GrammarLoader.annotateXMLSchema(GrammarLoader.java:
424)
at com.sun.tools.xjc.GrammarLoader.load(GrammarLoader.java:130)
at com.sun.tools.xjc.GrammarLoader.load(GrammarLoader.java:79)
at com.sun.tools.xjc.Driver.run(Driver.java:177)
at com.sun.tools.xjc.Driver._main(Driver.java:80)
at com.sun.tools.xjc.Driver.access$000(Driver.java:46)
at com.sun.tools.xjc.Driver$1.run(Driver.java:60)Hi,
A similar error occur to me twice.
One because pattern specification error (The pattern was incorrectly written)
The other one was because I had in the directory JAVA_HOME\jre\lib\endorsed the files that come from JWSDP_HOME\jaxb\lib.
This files (jaxb-api.jar, jaxb-impl.jar, jaxb-libs.jar, jaxb-xjc.jar) should only be in the directory where they come from JWSDP_HOME\jaxb\lib
If you have them in the JAVA_HOME\jre\lib\endorsed directory try removing them from there.
Hope I help you. -
How to prevent JaxB creation of 2 Interfaces for each Element?
hi,
does any body know how to prevent JaxB creation of 2 Interfaces for each Element (The Content Interface and the element interface)?
I want to configure JaxB to use only one Interface and only one implementation Class.
Thank's,I am sorry I can not answer your question, I have got the same problem. Could you please email me to
[email protected] when you know the answer, please.
I have a question for you. When and complex type is validated, I get the object which contains the error. ( or objects ).
However. How do know the position in the actual parent object. basically. Is there a way to know exactly the position of that attribute in that object. I need to store errors strings.
The first problem derives from this one:
It is not possible to execute validate function for a primitive attribute inside an structure.
I would appreciate your help.
Thanks.
Gustavo. -
Problem validating xml file - jaxb
hi people, I'm working with jaxb to generate Java source classes from the .xsd schemas that I have. I work with 17 schemas that, a priori, I can't modify. In those schemas there are a lot of types and structures that I can use when creating an .xml file. I've read other threads with the problem of namespaces but as a solution they provide a modification on the schemas. The generation of java source is ok, I've done custoization classes and no problem, but when I try to unmarshal an input xml file I get an error of validation:
DefaultValidationEventHandler: [ERROR]: Probably namespace URI of tag "XFFile" is wrong (correct one is "http://ww........
A possible xml file is :
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><!DOCTYPE XFFile><XFFile xmlns:rp210Elements="http://www.smpte-ra.org/schemes/434/200X/multiplex/S377M/2004" xmlns:s377mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S377M/2004" xmlns:s377mMux="http://www.smpte-ra.org/schemes/434/200X/multiplex/S377M/2004" xmlns:s377mTypes="http://www.smpte-ra.org/schemes/434/200X/types/S377M/2004" xmlns:s380mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S380M/2004" xmlns:s381mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S381M/200X" xmlns:s382mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S382M/200X" xmlns:s385mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S385M/2004" xmlns:s422mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S422M/200X" xmlns:s422mTypes="http://www.smpte-ra.org/schemes/434/200X/types/S422M/200X" xmlns:s423mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S423M/200X">
<s380mGroups:ClipFramework rp210Elements:InstanceID="a6.67.7a.47.19.2f.4b.10.8f.ee.1e.59.6d.4c.f1.70" rp210Elements:LinkedGenerationID="0e.10.a8.9c.96.1c.4c.11.b1.fb.0a.a9.40.22.a4.e2">
<rp210Elements:ClipCreationDateTime>
<rp210Elements:Year>2006</rp210Elements:Year>
<rp210Elements:Month>4</rp210Elements:Month>
<rp210Elements:Day>18</rp210Elements:Day>
<rp210Elements:Hour>12</rp210Elements:Hour>
<rp210Elements:Minute>0</rp210Elements:Minute>
<rp210Elements:Second>0</rp210Elements:Second>
<rp210Elements:mSec4>0</rp210Elements:mSec4></rp210Elements:ClipCreationDateTime>
<rp210Elements:FrameworkExtendedTextLanguageCode>fr</rp210Elements:FrameworkExtendedTextLanguageCode>
</s380mGroups:ClipFramework>
</XFFile>
I think it's ok because someone has provided it to my company but I can't validate it because it takes elements from many schemas (am I wrong and I can?)
i can't post the schemas because of the copyrights (damn it). I'm not asking for a solution but if someone has an idea or has had a similar problema.. I'll appreciate all comments, thanks
Jordi
Message was edited by:
WuWeiIn the schema root element xs:schema add namespace declaration.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
In the XML document root element add xmlns:xsi and xsi:noNamespaceSchemaLocation attributes.
<root_element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://c:/testing.xsd"> -
JAXB compiler problem in handling xsd:any and nillble = "true"
Dear all,
i am using jdeveloper 10.1.3.1 production release version.
i am designing a xml schema that contain element of attribute nillable="true", for extensible, contain tag <xsd:any>.
but i encounter 2 problem:
1. for xml schema element with attribute nillable="true", no corresponding isNil(), setNil
method is generated (refer to jaxb 1.0 spec. 5.7.1)
2. cannot handle tag <xs:any> that generate incorrect java source code (cannot compile) [refer to jaxb 1.0 spec 5.9.5)
*** i have add jaxb customization tag inside the <xs:any> tag
*** <xs:annotation><xs:appinfo>
*** <jaxb:property name="Extension"/>
***</xs:appinfo></xs:annotation>
Does oracle's JAXB implementation conform to the JAXB 1.0 spec?
Is it a known bug?
Could anybody help me?Refer to section
E.2 Not Required XML Schema
concepts
"A JAXB implementation is not required to support the following XML Schema
concepts for this version of the specification. A JAXB implementation may
choose to support these features in an implementation dependent manner."
E.2.2 Not supported while manipulating the XML
content
Schema component: wildcard
(any)
how can i know if an xml element with xsi:nil="true" (unmarshal)
and set xsi:nil="true" for an element (marshal) ?
According to the JAXB 1.0 specification:
If {nillable} is "true", the methods setNil() and isNil() are
generated. -
Problem in JAXB for processing XML files
hello
I have been working on a project where i need to process data in XML format. the flow goes thus
I have 28 data elements that i need to represent as a XML so i compile the schema files and generate the class files for each of the tags and thus i can use the get and set methods to read and write to a XML file respectively(example getName and setName)......
Now the problem is that my coding is done if i change my xml file and add say 2 more tags how do i handle it in my code.........
1>Do i have recomplie the schema file and generate new class files every time the xml structure changes. can i avoid this recompiling process and use a one time genrated class files even if the xml structure changes.
2>Now i have hard coded the get and set methods for processing the xml file if i add new tags to my xml i wouldnt have the get set methods for the new tags in my code(say i add a new tag as Phone then i wouldnt have the codes getPhone and setPhone called in my code and this tage was added after the coding was done)........how do i handle this situation. Is is possible that i can get and set data without using these methods and use some sort of a dynamic way of getting and setting data.............
3>Any other approach available to meet the above requirements other than JAXB.
Please help for the above problem
Thank youhi,
i had written a xml and schema to validate.
my xml would be
<output>
<table>
<row>
<column></column>
<column></column>
</row>
</table>
<document>
<properties>
</properties>
<contents>
</contents>
</document>
<table>
<row>
<column></column>
<column></column>
</row>
</table>
<document>
<properties>
</properties>
<contents>
</contents>
</document>
<table>
<row>
<column></column>
<column></column>
</row>
</table>
<document>
<properties>
</properties>
<contents>
</contents>
</document>
</output>
schema should validate : each table should contain atleast one row element and each row element should have atleast one column. similarly, each document should have atleast one properties and contents element.
if any of these things occur. for ex: if there is no row element in table, i need to delete the table tag. similary if there is no properties/content or both element in document it should delete the corresponding document from the xml.
i tried for table if there is no row element am getting the line number of the </table> tag, based on that am deleting the table element. if there is no properties tag and contents tag is there. am getting the line number for <contents>start tag, with which i could not able to delete the whole document.
can anybody plz help me out for this requirement -
Beehive 2.0.1.4.0 JDK JAXB error
I'm developing a module that communicates with Beehive.
From what I understand there aren't SOAP webservices on version 2, only REST?!
I'm trying to follow the BDK sample client (http://www.oracle.com/technetwork/middleware/beehive/java-bdk-082633.html), and I'm stuck in the JAXB generation part.
I'm using JAXB 2.0.1-b01-fcs and JDK 1.6.0_18 (also tried with older JDK and even beehive JDK), but I keep getting 244 of this errors (only changes the type):
Cannot resolve the name 'tns:accessControlFieldsUpdater' to a(n) 'type definition' component.
I'm calling
jaxb-ri-20060607\bin\xjc.bat schema-obh-xjc.xsd schema-obr.xsd -extension
What am I doing wrong?From what I understand there aren't SOAP webservices on version 2, only REST?!SOAP is also available with Oracle Beehive 2.0.1.4. For now, the SOAP API is not exposed in the OTN site " [Oracle Beehive Collaboration Platform|http://www.oracle.com/technetwork/middleware/beehive/platform-098968.html] " but we are currently trying to fix this. In the meantime, you can access the SOAP API documentation in your Beehive environment at the following location: http://host:port/ws/docs
Regards,
Ward -
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.xsdException 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. -
JAXB 2.0 : Issue with custom bindings
I have defined an inline JAXB 2.0 customization in my schema as follows:
<xs:annotation>
<xs:appinfo>
<jxb:globalBindings>
<jxb:javaType name="int" xmlType="xs:integer"
parseMethod="javax.xml.bind.DatatypeConverter.parseInt" printMethod="javax.xml.bind.DatatypeConverter.printInt"/>
<jxb:javaType name="double" xmlType="xs:decimal" parseMethod="javax.xml.bind.DatatypeConverter.parseDouble" printMethod="javax.xml.bind.DatatypeConverter.printDouble"/>
</jxb:globalBindings>
</xs:appinfo>
</xs:annotation>
But when I compile the schema, all the elements in it defined as xs:integer are converted to Integer objects instead of a primitive int.
An Adapter1.java file is created as follows:
public Integer unmarshal(String value) {
return (javax.xml.bind.DatatypeConverter.parseInt(value));
public String marshal(Integer value) {
return (javax.xml.bind.DatatypeConverter.printInt(value));
I even tried using a custom binding class and defining its print and parse methods but same result.
Why is the Adapter class created and why is the custom binding not followed?
Can somebody help me here.
Thanks.JDeveloper 10.1.3.2 does not support JAXB 2.0.
JAXB 2.0 support may be added.
Using JAXB 2.0 with JDeveloper 10.1.3 -
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.
Maybe you are looking for
-
Boa tarde, senhores! Estou testando o cenário de devolução de IPI para NF-e 3.10 e constatei que o sistema do cliente não está calculando o percentual de IPI devolvido (impostoDevol:pDevol), resultando na rejeição Rejeição 610: "Total da NF difere do
-
How to Sync the session timeout of Portal with CMS Server
Hi Experts, We have a custom application build on our portal which will launch the reports of InfoView. It works fine untill the portal session timeout. Whenever the session timeout occurs and reloads it I am unable to launch the reports and getting
-
Itunes for windows - burning issues - 4280 error
I have been able to burn cd's until I updated I-tunes with the 7.0 version. I can import but cannot burn at all. I have updated all my drivers and firmware, uninstalled and installed I-tunes, updated xp pro and windows, changed burn speeds, etc. etc.
-
IPhoto suddenly crashing; reinstalled; now can't open library . 8.1.2
My iPhoto suddenly started to crash upon startup (missing a FaceRecognition library component?) It's been working fine for a couple of years - not sure what changed (a bad update??) I reinstalled from the original disk that came with my Mac (had to r
-
BIG5 and HKSCS Character Set Support
Hi, We're experiencing some problems inserting a string containing both BIG5 and HKSCS characters to a 7.3.4 Oracle DB using JDBC. The underlying character set used by the DB is ZHT16BIG5 (this cannot be changed). The characters can be inserted corre