ClassNotFoundException with jaxb / annox and user annotation

I was a bit stuck in the annotation usage scenario, and I was hoping for your input.

Given the following annotation (defined in the same project with the ExistingCustomerValidator class ), package com.tktserver.constraints;

@Target({ ElementType.TYPE, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = { ExistingCustomerValidator.class })
@Documented
public @interface ExistingCustomerMatch {
    String message() default "{customer.notfound}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    /**
     * @return The field
     */
    String field();
}

and the next jxb setup

<jaxb:bindings node="xsd:complexType[@name='customer']">
    <annox:annotate>
        <annox:annotate
            annox:class="com.tktserver.constraints.ExistingCustomerMatch"
            field="electronicUserId" />
    </annox:annotate>
</jaxb:bindings>

I get this when I generate my sources through Maven (the whole project is processed by it)

Caused by: org.jvnet.annox.annotation.AnnotationClassNotFoundException: Annotation class [com.tktserver.constraints.ExistingCustomerMatch] could not be found.
    ... 32 more
Caused by: java.lang.ClassNotFoundException: com.bgc.ticketserver.constraints.ExistingCustomerMatch
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at org.jvnet.annox.parser.XAnnotationParser.parse(XAnnotationParser.java:76)
    ... 31 more

Other JSR-303 annotations seem to work fine. I am wondering if I get dependent on the cyclic dependence here, i.e. source sources are started first and then compiled, so there is no ExistingCustomerMatch annotation class available when starting source sources, or is it a completely different beast.

Thank you, Ioannis

+3
2

annox JAXB, xjc, antrun maven org.jvnet XJC2Task maven.compile.classpath. (. http://confluence.highsource.org/display/J2B/JAXB2+Basics+XJC+Ant+Task) maven.

, . , , Google, - JAXB annox. , . , : , .

, "compile-xsd-to-jaxb- beans", JAXB beans annox - . , XSD, XSD - .

XML- JAXB beans , , pojos , XSD. . , Javadoc , XSD . beans , Javadocs . JAXB ( , @XMLTransient), , annox maven , antrun hacky Ant, kludge. , ?

, XSD - : JSON, EclipseLink MOXy, JSON XML. .

, -JAXB- beans. - JAXB beans JAXB MOXy, .xsd. !? . .xsd , , ! beans, , XML MOXy, beans JSON.

, JAXB beans, , . , JAXB beans; (xjc ). MOXy-. MOXy , Oracle JAXB impl. MOXy - JAXB.

, , , XJC . , . , , .

+1

maven .

0

All Articles