users@jaxb.java.net

Re: [HJ3] Cannot attach annotations to 'ref' elements

From: Kostis Anagnostopoulos <ankostis_at_gmail.com>
Date: Fri, 26 Jan 2007 18:02:37 +0200

On 1/25/07, Kostis Anagnostopoulos <ankostis_at_gmail.com> wrote:
> Hi to all,
>
> it may be a jaxb-2.x problem but it still does botther me!
>
> I have a schema like this:
> <xsd:complexType name="portsType">
> <xsd:sequence>
> <xsd:element ref="proci:problems" minOccurs="0" >
> <xsd:annotation>
> <xsd:appinfo>
> <hj:ignored/>
> </xsd:appinfo>
> </xsd:annotation>
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
>
> And the XJC complains:
>
> [ERROR] XJC while parsing schema(s)
> file:/home/kana/work/hyperjaxb3-hibernate-sample-0.1/src/main/resources/larysi.xsd[54,26]:
> org.xml.sax.SAXParseException: The prefix "hj" for element
> "hj:ignored" is not bound.
>
>
> Any ideas why this happens?

Here is the updated XJC error i get concerning the 'ref' element:

[ERROR] XJC while compiling schema(s)[770]:
com.sun.istack.SAXParseException2: compiler was unable to honor this
hj:ignored customization. It is attached to a wrong place, or its
inconsistent with other bindings.
        at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:66)
        at com.sun.tools.xjc.model.Model.generateCode(Model.java:246)
        at org.jvnet.jaxb2.maven2.AbstractXJC2Mojo.runXJC(AbstractXJC2Mojo.java:468)
        at org.jvnet.jaxb2.maven2.AbstractXJC2Mojo.executeImp(AbstractXJC2Mojo.java:131)
        at org.jvnet.hyperjaxb3.maven2.Hyperjaxb3Mojo.execute(Hyperjaxb3Mojo.java:391)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
        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 org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

[ERROR] XJC while compiling schema(s)
file:/home/kana/work/hyperjaxb3-hibernate-sample-0.1/src/main/resources/larysi.xsd[378,57]:
com.sun.istack.SAXParseException2: (the above customization is
attached to the following location in the schema)
        at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:66)
        at com.sun.tools.xjc.model.Model.generateCode(Model.java:252)
        at org.jvnet.jaxb2.maven2.AbstractXJC2Mojo.runXJC(AbstractXJC2Mojo.java:468)
        at org.jvnet.jaxb2.maven2.AbstractXJC2Mojo.executeImp(AbstractXJC2Mojo.java:131)
        at org.jvnet.hyperjaxb3.maven2.Hyperjaxb3Mojo.execute(Hyperjaxb3Mojo.java:391)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
        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 org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)