Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with xjc utility (JAXB)

277 views
Skip to first unread message

Alejandro

unread,
Jun 8, 2007, 8:51:46 AM6/8/07
to
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.java:
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(BeanGenerator.java:
371)
at
com.sun.tools.xjc.generator.bean.BeanGenerator.getClazz(BeanGenerator.java:
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.java:
281)
at
com.sun.tools.xjc.generator.bean.BeanGenerator.getUsedPackages(BeanGenerator.java:
337)
at
com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:
169)
at
com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:
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 = C:\Program Files\Java\jdk1.6.0_01
JWSDP_HOME = C:\Sun\jwsdp-2.0
PATH = C:\Sun\jwsdp-2.0\jwsdp-shared\bin;C:\Sun\jwsdp-2.0\jaxb\bin

my XML schema:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="flux">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="fichier" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="regleNommage">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="regleDescription" type="xsd:string"/>
<xsd:element name="regleDetails" type="xsd:string"
minOccurs="0"/>
<xsd:element name="regexIdentification" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="repertoireCible" minOccurs="1" maxOccurs="2">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="cheminEnvironemment" type="xsd:string"/>
<xsd:element name="cheminFixe" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="applicationCible" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="mcf1|mcf2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="traitement" minOccurs="0" maxOccurs="2">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="commandeInvocation" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="applicationCible" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="mcf1|mcf2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="sens" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="acquisition|restitution|technique"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="canal" type="xsd:string" use="required"/>
<xsd:attribute name="format" type="xsd:string" use="required"/>
<xsd:attribute name="nature" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>


what's wrong? Any ideas?

Thanks

checkm...@gmail.com

unread,
Jun 16, 2007, 7:45:46 PM6/16/07
to
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.jav­a:

> 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(BeanGenerat­or.java:

> 371)
> at
> com.sun.tools.xjc.generator.bean.BeanGenerator.getClazz(BeanGenerator.java:
> 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­ava:
> 281)
> at
> com.sun.tools.xjc.generator.bean.BeanGenerator.getUsedPackages(BeanGenerato­r.java:

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

0 new messages