Article:
  Understanding JAXB: Java Binding Customization
Subject:   Date problem...
Date:   2004-12-09 03:32:27
From:   AnupK
Response to: Date problem...

hi
i tried to write on customized jaxb :
following is the content of my.xsd
<xsd:annotation>
<xsd:appinfo>
<jxb:globalBindings>
<jxb:javaType name="java.util.Date" xmlType="xsd:date" printMethod="SimpleDateFormatter.print" parseMethod="SimpleDateFormatter.parse"/>
</jxb:globalBindings>
</xsd:appinfo>
</xsd:annotation>
then i compile it using xjc commond.

MY XSD AND SimpleDateFormatter JAVA CLASS ARE IN THE SAME FOLDER....

i am getting the followng error...
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(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.launcher.ChildMain.run(ChildMain.java:269)
Caused by: java.lang.NoClassDefFoundError: SimpleDateFormatter
at com.sun.tools.xjc.grammar.xducer.UserTransducer.generateDeserializer(UserTransducer.java:165)
at com.sun.tools.xjc.grammar.xducer.TransducerDecorator.generateDeserializer(TransducerDecorator.java:56)
at com.sun.tools.xjc.grammar.xducer.WhitespaceTransducer.generateDeserializer(WhitespaceTransducer.java:67)
at com.sun.tools.xjc.generator.unmarshaller.PerClassGenerator.generateEatTextFunction(PerClassGenerator.java:422)
at com.sun.tools.xjc.generator.unmarshaller.PerClassGenerator.eatText(PerClassGenerator.java:384)
at com.sun.tools.xjc.generator.unmarshaller.TextMethodGenerator.performTransition(TextMethodGenerator.java:143)
at com.sun.tools.xjc.generator.unmarshaller.HandlerMethodGenerator.onState(HandlerMethodGenerator.java:184)
at com.sun.tools.xjc.generator.unmarshaller.HandlerMethodGenerator.generate(HandlerMethodGenerator.java:249)
at com.sun.tools.xjc.generator.unmarshaller.PerClassGenerator.generate(PerClassGenerator.java:192)
at com.sun.tools.xjc.generator.unmarshaller.UnmarshallerGenerator._generate(UnmarshallerGenerator.java:91)
at com.sun.tools.xjc.generator.unmarshaller.UnmarshallerGenerator.generate(UnmarshallerGenerator.java:55)
at com.sun.tools.xjc.Driver.generateCode(Driver.java:384)
at com.sun.tools.xjc.Driver.run(Driver.java:220)
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)


Can u plz help me....
thanks
anup K

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Date problem...
    2004-12-09 05:55:55  hashimisayed [View]

    It looks like the compiler cannot find your custom class. You need to make the class available to the xjc compiler. Compile you schema with the schema compiler (jaxb-xjc.jar) and use the -cp switch to tell the compiler where your class is.

    sayed