| checkmessage@gmail.com 2007-06-16, 7:09 pm |
| On Jun 8, 8:51 am, Alejandro <altud...@gmail.com> wrote:
> I'm trying to generate Java classes from a XML Schema using the xjc
> utility, but i get :
>
> parsing a schema...
> compiling a schema...
> Exception in thread "main" java.lang.IllegalArgumentException:
> Expected class javax.xml.bind.annotation.XmlAccessType but found class
> javax.xml.bind.annotation.AccessType
> at
> com.sun.codemodel.TypedAnnotationWriter.checkType(TypedAnnotationWriter.j=
av=ADa:
> 187)
> at
> com.sun.codemodel.TypedAnnotationWriter.invoke(TypedAnnotationWriter.java:
> 101)
> at $Proxy0.value(Unknown Source)
> at com.sun.tools.xjc.generator.bean.ImplStructureStrategy
> $1.createClasses(ImplStructureStrategy.java:46)
> at
> com.sun.tools.xjc.generator.bean.BeanGenerator.generateClassDef(BeanGener=
at=ADor.java:
> 371)
> at
> com.sun.tools.xjc.generator.bean.BeanGenerator.getClazz(BeanGenerator.jav=
a:
> 403)
> at com.sun.tools.xjc.generator.bean.BeanGenerator
> $1.onBean(BeanGenerator.java:291)
> at com.sun.tools.xjc.generator.bean.BeanGenerator
> $1.onBean(BeanGenerator.java:299)
> at com.sun.tools.xjc.model.CClassInfo.accept(CClassInfo.java:
> 359)
> at
> com.sun.tools.xjc.generator.bean.BeanGenerator.getContainer(BeanGenerator=
..j=ADava:
> 281)
> at
> com.sun.tools.xjc.generator.bean.BeanGenerator.getUsedPackages(BeanGenera=
to=ADr.java:
> 337)
> at
> com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:
> 169)
> at
> com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.jav=
a:
> 151)
> at com.sun.tools.xjc.model.Model.generateCode(Model.java:228)
> at com.sun.tools.xjc.Driver.run(Driver.java:293)
> at com.sun.tools.xjc.Driver.run(Driver.java:170)
> at com.sun.tools.xjc.Driver._main(Driver.java:95)
> at com.sun.tools.xjc.Driver.access$000(Driver.java:53)
> at com.sun.tools.xjc.Driver$1.run(Driver.java:75)
>
> I'm using Windows XP version 2002 service pack 2
> Java version 1.6.0_01
> Java Web Services Developer Pack 2.0
>
> my environment variables
> JAVA_HOME =3D C:\Program Files\Java\jdk1.6.0_01
> JWSDP_HOME =3D C:\Sun\jwsdp-2.0
> PATH =3D C:\Sun\jwsdp-2.0\jwsdp-shared\bin;C:\Sun\jwsdp-2.0\jaxb\bin
>
> my XML schema:
>
> <?xml version=3D"1.0"?>
> <xsd:schema xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema">
> <xsd:element name=3D"flux">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name=3D"fichier" maxOccurs=3D"unboun=
ded">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name=3D"regl=
eNommage">
> <xsd:complexType>
> <xsd:sequ=
ence>
> <=
xsd:element name=3D"regleDescription" type=3D"xsd:string"/>
> <=
xsd:element name=3D"regleDetails" type=3D"xsd:string"
> minOccurs=3D"0"/>
> <=
xsd:element name=3D"regexIdentification" type=3D"xsd:string"/>
> </xsd:seq=
uence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name=3D"repe=
rtoireCible" minOccurs=3D"1" maxOccurs=3D"2">
> <xsd:complexType>
> <xsd:sequ=
ence>
> <=
xsd:element name=3D"cheminEnvironemment" type=3D"xsd:string"/>
> <=
xsd:element name=3D"cheminFixe" type=3D"xsd:string"/>
> </xsd:seq=
uence>
> <xsd:attr=
ibute name=3D"applicationCible" use=3D"required">
> <=
xsd:simpleType>
> =
<xsd:restriction base=3D"xsd:string">
> =
<xsd:pattern value=3D"mcf1|mcf2"/>
> =
</xsd:restriction>
> <=
/xsd:simpleType>
> </xsd:att=
ribute>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name=3D"trai=
tement" minOccurs=3D"0" maxOccurs=3D"2">
> <xsd:complexType>
> <xsd:sequ=
ence>
> <=
xsd:element name=3D"commandeInvocation" type=3D"xsd:string"/>
> </xsd:seq=
uence>
> <xsd:attr=
ibute name=3D"applicationCible" use=3D"required">
> <=
xsd:simpleType>
> =
<xsd:restriction base=3D"xsd:string">
> =
<xsd:pattern value=3D"mcf1|mcf2"/>
> =
</xsd:restriction>
> <=
/xsd:simpleType>
> </xsd:att=
ribute>
> </xsd:complexType>
> </xsd:element>
> </xsd:sequence>
> <xsd:attribute name=3D"sens" use=
=3D"required">
> <xsd:simpleType>
> <xsd:restriction =
base=3D"xsd:string">
> <xsd:patt=
ern value=3D"acquisition|restitution|technique"/>
> </xsd:restriction>
> </xsd:simpleType>
> </xsd:attribute>
> <xsd:attribute name=3D"canal" typ=
e=3D"xsd:string" use=3D"required"/>
> <xsd:attribute name=3D"format" ty=
pe=3D"xsd:string" use=3D"required"/>
> <xsd:attribute name=3D"nature" ty=
pe=3D"xsd:string"/>
> </xsd:complexType>
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
>
> what's wrong? Any ideas?
>
> Thanks
probably you found the answer by now. Anyhow this seems to be the
problem with windows using JRE 1.6. Change the PATH to use JRE 1.5
|