JAXB xjc Error
I am new to JAXB. I installed JWSDP 1.3 and tried to ran xjc.
I ran xjc in the example below and have the
following errors. Even I run the example in C:\jwsdp-1.3\jaxb\samples
and have same error. Any ideas??
http://java.sun.com/developer/technicalArticles/WebServices/jaxb/index.html
D:\jaxbtest>xjc -p test.jaxb book.xsd -d work
parsing a schema...
compiling 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.io.IOException: work: non-existent directory
at com.sun.codemodel.writer.FileCodeWriter.<init>(FileCodeWriter.java:43
at com.sun.tools.xjc.Driver.createCodeWriter(Driver.java:410)
at com.sun.tools.xjc.Driver.run(Driver.java:226)
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)
The eror report says:
work: non-existent directory
So: does the destination directory exist?
Similar Messages
-
JAXB xjc error on name collision
The xjc is invoked with the following command line:
C:\jwsdp-1.3\jaxb\bin>xjc -p com.multex.rrapi -d \multex -extension ReutersResearchAPI.xsd
The ReutersResearchAPI.xsd looks like below:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://api.reutersresearch.com/ReutersResearchAPI"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://api.reutersresearch.com/ReutersResearchAPI"
xmlns:ns1="http://api.reutersresearch.com/Estimates" xmlns:ns="http://api.reutersresearch.com/Collaboration"
elementFormDefault="qualified">
<xs:import namespace="http://api.reutersresearch.com/Collaboration" schemaLocation="Collaboration.xsd"/>
<xs:import namespace="http://api.reutersresearch.com/Estimates" schemaLocation="Estimates.xsd"/>
<xs:element name="ENTER_NAME_OF_ROOT_ELEMENT_HERE">
</xs:element>
</xs:schema>
The Collaboration.xsd looks like below:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://api.reutersresearch.com/Collaboration"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://api.reutersresearch.com/Collaboration"
elementFormDefault="qualified">
<xs:element name="status">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:int"/>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
The Estimates.xsd looks like below:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://api.reutersresearch.com/Estimates" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://api.reutersresearch.com/Estimates" elementFormDefault="qualified">
<xs:element name="Status">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="errorCode" type="errorCode_AttrT" use="optional"/>
<xs:attribute name="success" type="success_AttrT" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
The xjc generates the following error message:
[ERROR] A class/interface with the same name "com.multex.rrapi.Status" is alread
y in use.
line 285 of Estimates.xsd
[ERROR] (Relevant to above error) another one is generated from here.
line 2017 of Collaboration.xsdThank you. I read the fix-collision sample. In my case I have to fix collision between an <element> from one namespace and an <element> from another. Would appending the "element" suffix eliminate the collision?
-
JAXB: XJC src-resolve error when importing other schemes
Hi!
I keep getting a src-resolve error from the JAXB binding compiler whenever I try to import other XML schemes into my own.
For example:
I want to use a SignatureType element as defined in the official XML signature schema.
So I imported it into my own schema and use it as follows:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<xsd:import namespace="http://www.w3.org/2000/09/xmldsig#"
schemaLocation="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"/>
<xsd:complexType name="PayloadType">
<xsd:sequence>
<xsd:element name="signature" type="ds:SignatureType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>However if I run XJC to compile my schema I get this error:
[xjc] [ERROR] src-resolve: Cannot resolve the name 'ds:SignatureType' to a(n) 'type definition' component.I am using JAXB 2.0 EA from the JWSDP 2.0 and XJC is called from an Ant task.
I am pretty new to JAXB and XML schemes, so any help on this topic would be greatly appreciated.I got the the answer from another forum; it was a proxy problem. Just to inform succeeding readers, here is what I did:
To receive a better error output, I modified my ant buildfile to use the "nv" parameter:
<xjc schema="${path}/.../mySchema.xsd" package="mySchemaPackage" destdir="${path}/.../src">
<arg value="-nv" />
<produces dir="${path}/.../src/mySchemaPackage" includes="**/*.java" />
</xjc>Result:
The XJC compiler gives me a different (better) error message:
[xjc] [ERROR] java.net.ConnectException: Connection timed out: connectSo I looked in my Ant buildfile again to check the proxy settings. I merely used property-tags to define my proxy settings (<property name="http.proxyHost" value="nnn.nnn.nnn.nnn" /> and <property name="http.proxyPort" value="nnnn" /> ) which apparently do not work.
Instead this here does the trick:
<setproxy proxyhost="nnn.nnn.nnn.nnn" proxyport="nnnn"/>Good to now that "nv" might give you a better error report. -
JAXB validation error with sample applications
Hi,
When trying to generate the java from po.xsd in the first example I get two compile errors in the result :
"PurchaseOrderImpl.java": Error #: 454 : class {deleted root}.generated.impl.PurchaseOrderImpl should be declared abstract; it does not define method validateThis() in interface javax.xml.bind.Element at line 11, column 8
"CommentImpl.java": Error #: 454 : class {deleted root}.generated.impl.CommentImpl should be declared abstract; it does not define method validateThis() in interface javax.xml.bind.Element at line 11, column 8
where {deleted root} represents parent packages in our source tree.
Anyone else seen this?
I'm using Ant1.51 to kick off the build, with the patch referred to in Apache bug 14640. (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14640)
The target to do the build is defined as follows :-
<target name="schema" depends="init"
description="Compile schema">
<echo message="Compiling the schema..."/>
<jaxb destDir="${src}"
readOnly="true"
strictValidation="true"
xjcjar="${JAXB_HOME}\lib\jaxb-xjc.jar">
<schemas dir="${basedir}" includes="po.xsd"/>
<targetPackageMapper type="regexp"
from="(.*)\.xsd" to="{deleted root}.generated"/>
</jaxb>
</target>
where ${src} is the root of the source tree and ${basedir} is the parent directory of "generated", containing the build.xml.More precisely, this is a compile time error for the generated Java classes. The methods
void invalidate()
void validate()
void validate(Validator v)
void validateThis()
defined in
com.sun.xml.bind.validator.ValidatableObject
are not being built for
generated.impl/XTypeImpl.java
which extends
generated.impl/XImpl.java -
JAXB library error in oepe indigo 11.1.1.7.3.201107052114-win32
I have an project that use JAXB parsing libraries. This project was developed for the first time in eclipse oepe 11.1.1.7.2.201104061504-win32 released in April 2011. After I upgraded oepe to the new version, released in July 2011 I have the following library error: The currently selected JAXB library provider is invalid. The jars used is jaxb1-impl.jar, jaxb-api-2.2.4.jar, jaxb-impl-2.2.4-1.jar and jaxb-xjc-2.2.2.jar.
Edited by: 874638 on 24.07.2011 04:51The Eclipse Indigo release offers some new JAXB tooling from the Dali project (which is part of Web Tools Platform). You are now able to create a JAXB Project.
Configuration
A JAXB project can be configured to use the reference or EclipseLink MOXy implementation of JAXB. This can be done via:
1.Right click your JAXB Project
2.Select Properties
3.Select Project Facets
4.Check the JAXB facet (If you are using Java SE 6 set the JAXB version to 2.1, if you are using Java SE 7 then set the JAXB version to 2.2).
5.Click the "Further configuration required" or "Further configuration available" links.
Using the JAXB RI
-Choose Generic JAXB as your platform
-Choose JRE as your JAXB Implementation Type
Using EclipseLink JAXB (MOXy)
-Choose EclipseLink JAXB as your platform
-Choose User Library as your JAXB Implementation
-Click the Manage Libraries... icon
-Add a new User Library for EclipseLink (the binary can be obtained from http://www.eclipse.org/eclipselink/downloads/). - -
We are getting a JAXB unmarshalling error:
while processing the following <condition> tag which is of type xsd:string
<condition> x < 100 </condition>
The error is probably happening due to "<" token as a part of string type.
xml.bind.JAXBException: Unexpected error in Unmarshalling
at oracle.xml.jaxb.JaxbUnmarshaller.unmarshal(JaxbUnmarshaller.java:224)
Any ideas how to resolve this issue?
Note
<condition> x >100 </condition> is getting unmarshalled successfully by JAXB unmarshaller.
ThanksHi,
Did you tried to put & lt; (without space) instead of < ?
Best Regards,
Paweł -
JAXB unmarshalling error for " " token as part of xsd:string type element
JAXB unmarshalling error for "<" token as part of xsd:string type element
We are getting a JAXB unmarshalling error:
while processing the following <condition> tag which is of type xsd:string
<condition> x < 100 </condition>
The error is probably happening due to "<" token as a part of string type.
xml.bind.JAXBException: Unexpected error in Unmarshalling
at oracle.xml.jaxb.JaxbUnmarshaller.unmarshal(JaxbUnmarshaller.java:224)
Any ideas how to resolve this issue?
Note
<condition> x > 100 </condition> is getting unmarshalled successfully by JAXB unmarshaller.
ThanksHi,
Did you tried to put & lt; (without space) instead of < ?
Best Regards,
Paweł -
I have downloaded JAXB from java.sun.com through FTP and HTTP. When i tried to extract the zip file, i found the xjc compiler is existing as a file instead of an .exe file.Becoz of which i couldn't able to work with it.Pls help me out asap.
regards
MeenaExtract the following Jar files from jaxb-1.0-ea\lib to dircetroy where you want to keep your xml and generated java classes.
jxb-rt-1.0-ea
jaxb-xjc-1.0-ea
and then use the following commnad to run it:
java com.sun.tools.xjc.Main abc.dtd dcf.xjc
iam able generate the Java class with this commanad. -
Jaxb-xjc-1.0-ea.jar
Hi All
I downloaded the jwsdp-1_1-windows-i586.exe and installed jaxb1.0 (from the sun site). But I am not able to find jaxb-xjc-1.0-ea.jar and jaxb-rt-1.0-ea.jar
in the \jre\lib directory. Can I copy these two jars separately ?
Thanks allHi All
I downloaded the jwsdp-1_1-windows-i586.exe and
installed jaxb1.0 (from the sun site). But I am not
able to find jaxb-xjc-1.0-ea.jar and
jaxb-rt-1.0-ea.jar
in the \jre\lib directory. Can I copy these two jars
separately ?
Thanks allThe JWSDP1.1 will not contain the jaxb-xjc-1.0-ea.jar.
The JAXB1.0 Reference Implementation is based on 1.0 version of the JAXB spec and those jars are shipped with the JWSDP1.1
We no longer support the 1.0 EA release.
Regards,
Bhakti -
Getting error while using jaxb/xjc
hello every one,
i have a xsd and i want automated classes from it for which i am using jaxb and xjc compiler but when i am running it then i am getting error
parsing a schema...
compiling a schema...
Exception in thread "main" java.lang.IllegalArgumentException: Expected
class ja
vax.xml.bind.annotation.XmlAccessType but found class
javax.xml.bind.annotation.
my xsd is
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="clients"
type="ClientsDef"/>
<xs:complexType name=" ClientsDef ">
<xs:sequence>
<xs:element name="pers" type="Person"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Person">
<xs:sequence>
<xs:element name="name"
type="xs:string"/>
<xs:element name="date_of_birth"
type="xs:date"/>
<xs:element name="cnp"
type="xs:string"/>
<xs:element name="adress"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
any one please help me out...Hi,
XSD is well formed but for JAXB, it needs to have the complexType declaration inner the root element:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="clients">
<xs:complexType>
<xs:sequence>
<xs:element name="pers" type="Person" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="Person">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="date_of_birth" type="xs:date"/>
<xs:element name="cnp" type="xs:string"/>
<xs:element name="adress" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>Tested this works with this Main using jaxb-bindings in Netbeans (defining XSD compilation under clients package, Main in default package):
import clients.Clients;
import clients.ObjectFactory;
import clients.Person;
import java.io.ByteArrayOutputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
public class Main
public static void main(String args[]) throws Exception
ObjectFactory of = new ObjectFactory();
Clients cd = of.createClients();
Person p = of.createPerson();
p.setAdress("address");
p.setCnp("cnp");
p.setName("name");
cd.getPers().add(p);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try
JAXBContext ctx;
ctx = JAXBContext.newInstance(Clients.class);
Marshaller marshaller = ctx.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true));
marshaller.marshal(cd, bos);
System.out.println(bos.toString());
finally
bos.close();
}Generates:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<clients>
<pers>
<name>name</name>
<cnp>cnp</cnp>
<adress>address</adress>
</pers>
</clients> -
JAXB (XJC) problem with Java 1.4.2_02
Hi,
I am trying to migrate our system to Java version 1.4.2_02 (currently using 1.4.1_02). We use XJC from JAXB to compile XML schema files into java classes. JAXB is packaged in JWSDP (we are using version 1.3). I am currently experiencing a problem whereby if I use java version 1.4.2_02 and run XJC on the xml schema file its not generating any of the inner classes. All classes including inner are generated properly if I am pointing 1.4.1_02.
Just wondering if you came across this problem before and would know of a possible solution.
thanks for your help
ManishI was having this problem as well. I extracted the MSI from the InstallShield and found that it's looking for a property called "SystemFilesLocked" to equal 1. If you pass it as a parameter and give it a value of 0, this error message doesn't appear. I've installed now to 15 W2K desktops without any issues.
The 'silent installation' documentation for this product is sorely lacking. The install string I'm using is below:
j2re-1_4_2_03-windows-i586-p.exe /S /v/qn"ADDLOCAL=jrecore SYSTEMFILESLOCKED=0 CONTROLPANELLOCKED=1 SKDSILENT=1 IEXPLORER=0 SYSTRAY=0 REBOOT=Suppress JAVAUPDATE=0 JAVAJAVAWLOCKED=0 WEBSTARTICON=0 /L C:\TEMP\LogFiles\JRE_JWS_142_03.log"
Hope this helps... -
JAXB compiler error : Complex Type Definition Representation Error
Hi,
I have a problem when I try to generate Java classes for the XML Digital Signature schema along with the XAdES extension. Apparently, we got an XML validation issue when the XAdES schema is parsed.
Here is the xjc tool ouput :
[ERROR] src-ct.1: Complex Type Definition Representation Error for type 'IdentifierType'. When complexContent is used, the base type must be a complexType.
line 33 of XAdES.xsd
[ERROR] src-ct.1: Complex Type Definition Representation Error for type 'EncapsulatedPKIDataType'. When complexContent is used, the base type must be a complexType.
line 57 of XAdES.xsdNow these are the schema lines from XAdES.xsd that cause the problem :
<xsd:complexType name="IdentifierType">
<xsd:complexContent>
<xsd:extension base="xsd:anyURI">
<xsd:attribute name="Qualifier" type="QualifierType" use="optional"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="EncapsulatedPKIDataType">
<xsd:complexContent>
<xsd:extension base="xsd:base64Binary">
<xsd:attribute name="Id" type="xsd:ID" use="optional"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>The most disturbing thing is that those two schemas I used (e.g. xmldsig-core-schema.xsd and XAdES.xsd) come directly from the W3C, so they should be fully compliant to the XML schema spec, shouldn't they ?
Moreover, I tried to validate these two schemas with XML Spy 4.3 and the problem occurs in slightly different way. In fact, the <xsd:complexContent> tags are replaced silently by XML Spy with <xsd:simpleContent> tags in order to validate the schema. So XML Spy seems to have a problem too with these complex type definitions. Besides, if I replace the <xsd:complexContent> tags the same way as XML Spy does, and if I run again the JAXB compiler, it works fine...
Does anyone have any knowledge about this issue ? I'd like very much to hear about anyone who has experienced or better solved the same kind of issue.
By the way, here is the version of JAXB that I use :
xjc version "1.0.2-b15-fcs"
JavaTM Architecture for XML Binding(JAXB) Reference Implementation, (build 1.0.2-b15-fcs)Any help appreciated.
Thanks,
Gregory<xsd:extension base="xsd:anyURI">
<xsd:extension base="xsd:base64Binary">
The base attribute of the xs:extension elements shoule refer to a complexType.
For example,
<xs:complexType name="complexTypeA">
</xs:complexType>
<xsd:complexType name="IdentifierType">
<xsd:complexContent>
<xsd:extension base="complexTypeA">
<xsd:attribute name="Qualifier" type="QualifierType" use="optional"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType> -
Problem fixing XJC Errors ("already defined" in groups)
Hello,
I am using JAXB to generate code for some schemas created by a different group in my project, but I get an error that I kind of understand but don't know exactly how to resolve.
This is a pared-down version of the schema holding only the offending pieces:
MainSchema.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns_a="DATASET_A"
xmlns:ns_b="DATASET_B"
xmlns:ns_c="DATASET_C"
xmlns:ns_d="DATASET_D"
xmlns:ns_e="DATASET_E"
xmlns:ns_f="DATASET_F">
<xs:include schemaLocation="BASIC_TYPES.XSD" />
<!-- -->
<xs:import namespace="DATASET_A" schemaLocation="DATASET_A.xsd"/>
<xs:import namespace="DATASET_B" schemaLocation="DATASET_B.xsd"/>
<xs:import namespace="DATASET_C" schemaLocation="DATASET_C.xsd"/>
<xs:import namespace="DATASET_D" schemaLocation="DATASET_D.xsd"/>
<xs:import namespace="DATASET_E" schemaLocation="DATASET_E.xsd"/>
<xs:import namespace="DATASET_F" schemaLocation="DATASET_F.xsd"/>
<xs:complexType name="ReturnGetDataStatusType">
<xs:sequence>
<xs:element name="DATA_LIST">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:choice>
<xs:group ref="ns_a:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_b:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_c:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_d:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_e:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_f:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<!-- -->
<xs:complexType name="FileDataType">
<xs:sequence>
<xs:element name="DATA_LIST">
<xs:complexType>
<xs:choice>
<xs:group ref="ns_a:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_b:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_c:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_d:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_e:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_f:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:element name="RETURN_GET_DATA" type="ReturnGetDataStatusType"/>
<xs:element name="FILE_DATA" type="FileDataType"/>
</xs:schema>---
When I try to compile this schema and their underlying schemas, I get this error repeated for each "group" attribute of the FileDataType:
C:\dir\temp\fake_DataStore>xjc -d output -p com.company.stuff *.xsd *.XSD | more
parsing a schema...
[ERROR] Property "ReturnGetDataItemType" is already defined. Use <jaxb:property> to resolve this conflict.
line 49 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] The following location is relevant to the above error
line 50 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] Property "ReturnGetDataItemType" is already defined. Use <jaxb:property> to resolve this conflict.
line 50 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] The following location is relevant to the above error
line 51 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] Property "ReturnGetDataItemType" is already defined. Use <jaxb:property> to resolve this conflict.
line 51 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] The following location is relevant to the above error
line 52 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] Property "ReturnGetDataItemType" is already defined. Use <jaxb:property> to resolve this conflict.
line 52 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] The following location is relevant to the above error
line 53 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] Property "ReturnGetDataItemType" is already defined. Use <jaxb:property> to resolve this conflict.
line 53 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] The following location is relevant to the above error
line 54 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
Failed to parse a schema.---
It clearly has a problem with using the same group references in two different complexTypes, but I don't know how to use jaxb:property to resolve it.
Do I rename this ReturnGetDataItemType differently in the FileDataType complexType? If so, how?
Thank you for reading. Please let me know if you have any questions.
Edited by: jaylogan on Mar 18, 2010 6:49 PMyou need to pass a bindings file using the -b switch as explained here: http://java.sun.com/webservices/docs/1.5/tutorial/doc/JAXBUsing4.html
-
I am new to JAXB and I would like to access XML data directly from an XML file without regarding the XML format and structure. As a result, I have followed the steps mentioned in the http://java.sun.com/developer/technicalArticles/WebServices/jaxb/index.html.
Step 1>
I can successfully generate a set of java classes and interfaces that represent the schema.
Step 2>
I run the following command: javac GCCities/jaxb/*.java GCCities/jaxb/impl/*.java
and then get the following error:
"GCCities\jaxb\impl\GuaranteeCalculatorCitiesReturnMessagesImpl.java:1: illegal escape character"
"GCCities\jaxb\impl\GuaranteeCalculatorCitiesReturnMessagesImpl.java:2: illegal escape character"
"GCCities\jaxb\impl\GuaranteeCalculatorCitiesReturnMessagesImpl.java:27: illegal escape character"
For your Information:
My OS is windows XP and jwsdp 1.5. Please help!I dump the content of the GuaranteeCalculatorCitiesReturnMessagesImpl.java file.
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v@@BUILD_VERSION@@
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2005.05.12 於 11:22:12 GMT+08:00
\u000d\u000a\u0070\u0061\u0063\u006b\u0061\u0067\u0065\u0020\u0047\u0043\u0043\u0069\u0074\u0069\u0065\u0073\u002e\u006a .....
The content of the java file is very strange but it is generated by the jAXB bining compiler automatically by running the following command:
xjc.bat -p GCCities.jaxb GCCities.xsd -d work
On the other hands, Even if I try the sample attached with the JAXB(jwsdp-1.5), the same error "illegal escape character" is met. -
Hi.
I have a problem creating web service proxy in JDeveloper using particular WSDL. As I have deeply explored the cause of an error I found the complexType by name "objectFactory" inside WSDL which is mapped by JAXB to ObjectFactory object. So the tag inside WSDL file is :
<xs:complexType name="objectFactory"><xs:sequence/></xs:complexType>
And that is causing the error described below. Now the problem is ObjectFactory is also a name for object definition inside Java.
Hope I was clear enough. Is there a way to avoid this situation?
The error I get when creating web service proxy is
oracle.jdeveloper.webservices.model.WebServiceException: Error creating model from wsdl "file:/C:/temp/testVirWs.wsdl": null
at oracle.jdeveloper.webservices.model.java.JavaWebService.createPortTypes(JavaWebService.java:1635)
at oracle.jdeveloper.webservices.model.WebService.createServiceFromWSDL(WebService.java:2846)
at oracle.jdeveloper.webservices.model.WebService.createServiceFromWSDL(WebService.java:2611)
at oracle.jdeveloper.webservices.model.java.JavaWebService.<init>(JavaWebService.java:509)
at oracle.jdeveloper.webservices.model.java.JavaWebService.<init>(JavaWebService.java:461)
at oracle.jdeveloper.webservices.model.proxy.WebServiceProxy$ProxyJavaWebService.<init>(WebServiceProxy.java:2268)
at oracle.jdeveloper.webservices.model.proxy.WebServiceProxy.updateServiceModel(WebServiceProxy.java:1701)
at oracle.jdeveloper.webservices.model.proxy.WebServiceProxy.setDescription(WebServiceProxy.java:525)
at oracle.jdevimpl.webservices.wizard.jaxrpc.proxy.ProxyJaxWsSpecifyWSDLPanel.setDescription(ProxyJaxWsSpecifyWSDLPanel.java:238)
at oracle.jdevimpl.webservices.wizard.jaxrpc.common.SpecifyWsdlPanel.buildModel(SpecifyWsdlPanel.java:1109)
at oracle.jdevimpl.webservices.wizard.jaxrpc.common.SpecifyWsdlPanel$5.run(SpecifyWsdlPanel.java:661)
at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:655)
at java.lang.Thread.run(Thread.java:619)
Caused by: oracle.jdeveloper.webservices.tools.WsdlValidationException: Error creating model from wsdl "file:/C:/temp/testVirWs.wsdl": null
at oracle.jdevimpl.webservices.tools.wsa.WsaAdaptor.newWsdlValidationException(WsaAdaptor.java:825)
at oracle.jdevimpl.webservices.tools.wsa.WsaAdaptor.getSeiInfo(WsaAdaptor.java:515)
at oracle.jdeveloper.webservices.tools.WebServiceTools.getSeiInfo(WebServiceTools.java:523)
at oracle.jdeveloper.webservices.model.java.JavaWebService.getSeiInfo(JavaWebService.java:1741)
at oracle.jdeveloper.webservices.model.java.JavaWebService.createPortTypes(JavaWebService.java:1496)
... 12 more
Caused by: oracle.j2ee.ws.common.tools.api.ValidationException: Error creating model from wsdl "file:/C:/temp/testVirWs.wsdl": null
at oracle.j2ee.ws.tools.wsa.jaxws.JaxwsWsdlToJavaTool.getJAXWSModel(JaxwsWsdlToJavaTool.java:679)
at oracle.j2ee.ws.tools.wsa.WsdlToJavaTool.createJAXWSModel(WsdlToJavaTool.java:478)
at oracle.j2ee.ws.tools.wsa.Util.getJaxWsSeiInfo(Util.java:1360)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.jdevimpl.webservices.tools.wsa.Assembler$2$1.invoke(Assembler.java:218)
at $Proxy36.getJaxWsSeiInfo(Unknown Source)
at oracle.jdevimpl.webservices.tools.wsa.WsaAdaptor.getSeiInfo(WsaAdaptor.java:505)
... 15 more
Caused by: java.lang.NullPointerException
at com.sun.tools.xjc.util.Util.equals(Util.java:67)
at com.sun.tools.xjc.util.CodeModelClassFactory.createClass(CodeModelClassFactory.java:130)
at com.sun.tools.xjc.util.CodeModelClassFactory.createClass(CodeModelClassFactory.java:77)
at com.sun.tools.xjc.generator.bean.ImplStructureStrategy$1.createClasses(ImplStructureStrategy.java:78)
at com.sun.tools.xjc.generator.bean.BeanGenerator.generateClassDef(BeanGenerator.java:410)
at com.sun.tools.xjc.generator.bean.BeanGenerator.getClazz(BeanGenerator.java:442)
at com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:209)
at com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:182)
at com.sun.tools.xjc.model.Model.generateCode(Model.java:286)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:252)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:85)
at oracle.j2ee.ws.common.tools.databinding.jaxb20.JAXB20TypeGenerator.generateJavaTypes(JAXB20TypeGenerator.java:121)
at oracle.j2ee.ws.tools.wsa.SchemaTool.genValueTypes(SchemaTool.java:186)
at oracle.j2ee.ws.tools.wsa.jaxws.JaxwsWsdlToJavaTool.getJAXWSModel(JaxwsWsdlToJavaTool.java:662)
... 24 more
Any suggestion appreciated. Thanks.ObjectFactory is a special class used by jaxb, so you need to rename the class which is generated for the wsdl. you can rename objects using a binding file, see here for details:
http://download.oracle.com/javaee/5/tutorial/doc/bnbbf.html
Maybe you are looking for
-
How to go back to previous os version
Hi, Could you please help to go back to previous iOs version because my mobile working dead slow...I have the following apps only Whatsapp,Facebook messanger,skype,online bank,candy crash game thats all remaning default application given by apple.. P
-
I plugged my flash drive into windows and now I can't open the files on my mac. Help??
-
Feature suggestions for Liquid E700
In the next incarnation of your tri-SIM phone some features to improve it.The E700 is a very good phone but it could be better. 3GB RAM32GB FlashWorldwide LTE (should include bands 1, 3, 7, 28)Software for Linux sync would be niceSD slot up to 128GBA
-
How To Install 2*4GB RAM=8GB Ram 1333mhz on a 13inch MacBook Pro 2.26ghz
Hi There, I would like to install 2*4G which is 8GB RAM with 1333mhz DDR3 on a 13inch MacBook Pro mid 2009 2.26 GHZ and the bus speed is 1067mhz, now how would I install this type of RAM or must I rather spend more money for a 1067mhz DDR3 2*4GB=8GB
-
How to Client Oracle 8i Client for window 95
I want to know how to obtain Net8 Driver for window 95. I already have Oracle 8i EE linux version. Is Linux version include net8 for window 95 or not. If havn't, Only Oracle 8i EE for window NT include it.