The following xml part in the
'http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd' is causing the
problem.  Once I removed this part from the local xsd, then source
generation was successful. But Now I am getting the compilation error on
the generated source.

Any kind of help is appreciated. 

Source compilation exceptions:

[javac] Compiling 412 source files to C:\buil
d\generated\webapp\classes
    [javac] C:\build\generated\webapp\src\com\inf
ormative\anttools\xml\schema\webapp\ServiceRef_handlerChainTypeChoice.ja
va:67: c
annot find symbol
    [javac] symbol  : class ServiceRef_protocolBindingListType
    [javac] location: class
com.informative.anttools.xml.schema.webapp.ServiceRe
f_handlerChainTypeChoice
    [javac]             final ServiceRef_protocolBindingListType
vProtocolBindin
gs)
    [javac]                   ^
    [javac] C:\build\generated\webapp\src\com\inf
ormative\anttools\xml\schema\webapp\ServiceRef_handlerChainTypeChoice.ja
va:82: c
annot find symbol
    [javac] symbol  : class ServiceRef_protocolBindingListType
    [javac] location: class
com.informative.anttools.xml.schema.webapp.ServiceRe
f_handlerChainTypeChoice
    [javac]             final ServiceRef_protocolBindingListType
vProtocolBindin
gs)
    [javac]                   ^
    [javac] C:\build\generated\webapp\src\com\inf
ormative\anttools\xml\schema\webapp\ServiceRef_handlerChainTypeChoice.ja
va:117:
cannot find symbol
    [javac] symbol  : class ServiceRef_protocolBindingListType
    [javac] location: class
com.informative.anttools.xml.schema.webapp.ServiceRe
f_handlerChainTypeChoice
    [javac]     public ServiceRef_protocolBindingListType
getProtocolBindings(
    [javac]            ^
    [javac] C:\build\generated\webapp\src\com\inf
ormative\anttools\xml\schema\webapp\ServiceRef_handlerChainTypeChoice.ja
va:138:
cannot find symbol
    [javac] symbol  : class ServiceRef_protocolBindingListType
    [javac] location: class
com.informative.anttools.xml.schema.webapp.ServiceRe
f_handlerChainTypeChoice
    [javac]     public ServiceRef_protocolBindingListType[]
getProtocolBindings(

    [javac]            ^
    [javac] C:\build\generated\webapp\src\com\inf
ormative\anttools\xml\schema\webapp\ServiceRef_handlerChainTypeChoice.ja
va:236:
cannot find symbol
    [javac] symbol  : class ServiceRef_protocolBindingListType
    [javac] location: class
com.informative.anttools.xml.schema.webapp.ServiceRe
f_handlerChainTypeChoice
    [javac]             final ServiceRef_protocolBindingListType
vProtocolBindin
gs) {
    [javac]                   ^
    [javac] C:\build\generated\webapp\src\com\inf
ormative\anttools\xml\schema\webapp\ServiceRef_handlerChainTypeChoice.ja
va:247:
cannot find symbol
    [javac] symbol  : class ServiceRef_protocolBindingListType
    [javac] location: class
com.informative.anttools.xml.schema.webapp.ServiceRe
f_handlerChainTypeChoice
    [javac]     public ServiceRef_protocolBindingListType
removeProtocolBindings
At(
    [javac]            ^
    [javac] C:\build\generated\webapp\src\com\inf
ormative\anttools\xml\schema\webapp\ServiceRef_handlerChainTypeChoice.ja
va:273:
cannot find symbol
    [javac] symbol  : class ServiceRef_protocolBindingListType
    [javac] location: class
com.informative.anttools.xml.schema.webapp.ServiceRe
f_handlerChainTypeChoice
    [javac]             final ServiceRef_protocolBindingListType
vProtocolBindin
gs)
    [javac]                   ^
    [javac] C:\build\generated\webapp\src\com\inf
ormative\anttools\xml\schema\webapp\ServiceRef_handlerChainTypeChoice.ja
va:289:
cannot find symbol
    [javac] symbol  : class ServiceRef_protocolBindingListType
    [javac] location: class
com.informative.anttools.xml.schema.webapp.ServiceRe
f_handlerChainTypeChoice
    [javac]             final ServiceRef_protocolBindingListType[]
vProtocolBind
ingsArray) {
    [javac]                   ^
    [javac] C:\build\generated\webapp\src\com\inf
ormative\anttools\xml\schema\webapp\LocalHomeType.java:43:
com.informative.antto
ols.xml.schema.webapp.FullyQualifiedClassType is abstract; cannot be
instantiate
d
    [javac]             this._content =  new
FullyQualifiedClassType(defaultValu
e);
    [javac]                              ^
    [javac] C:\build\generated\webapp\src\com\inf
ormative\anttools\xml\schema\webapp\LocalHomeType.java:60: getContent()
in com.i
nformative.anttools.xml.schema.webapp.LocalHomeType cannot override
getContent()
 in com.informative.anttools.xml.schema.webapp.FullyQualifiedClassType;
attempti
ng to use incompatible return type
    [javac] found   :
com.informative.anttools.xml.schema.webapp.FullyQualifiedC
lassType
    [javac] required: java.lang.String
    [javac]     public FullyQualifiedClassType getContent(
    [javac]                                    ^
    [javac] C:\build\generated\webapp\src\com\inf
ormative\anttools\xml\schema\webapp\LocalType.java:43:
com.informative.anttools.
xml.schema.webapp.FullyQualifiedClassType is abstract; cannot be
instantiated
    [javac]             this._content =  new
FullyQualifiedClassType(defaultValu
e);
    [javac]                              ^
    [javac] C:\build\generated\webapp\src\com\inf
ormative\anttools\xml\schema\webapp\LocalType.java:60: getContent() in
com.infor
mative.anttools.xml.schema.webapp.LocalType cannot override getContent()
in com.
informative.anttools.xml.schema.webapp.FullyQualifiedClassType;
attempting to us
e incompatible return type
    [javac] found   :
com.informative.anttools.xml.schema.webapp.FullyQualifiedC
lassType

...



Part causing the issue:

<xsd:complexType name="web-appType">
        <xsd:choice minOccurs="0" maxOccurs="unbounded">
            <xsd:group ref="javaee:descriptionGroup" />
            <xsd:element name="distributable" type="javaee:emptyType" />
            <xsd:element name="context-param"
                type="javaee:param-valueType">
                <xsd:annotation>
                    <xsd:documentation>
                        The context-param element contains the
                        declaration of a web application's servlet
                        context initialization parameters.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="filter" type="javaee:filterType" />
            <xsd:element name="filter-mapping"
                type="javaee:filter-mappingType" />
            <xsd:element name="listener" type="javaee:listenerType" />
            <xsd:element name="servlet" type="javaee:servletType" />
            <xsd:element name="servlet-mapping"
                type="javaee:servlet-mappingType" />
            <xsd:element name="session-config"
                type="javaee:session-configType" />
            <xsd:element name="mime-mapping"
                type="javaee:mime-mappingType" />
            <xsd:element name="welcome-file-list"
                type="javaee:welcome-file-listType" />
            <xsd:element name="error-page" type="javaee:error-pageType"
/>
            <xsd:element name="jsp-config" type="javaee:jsp-configType"
/>
            <xsd:element name="security-constraint"
                type="javaee:security-constraintType" />
            <xsd:element name="login-config"
                type="javaee:login-configType" />
            <xsd:element name="security-role"
                type="javaee:security-roleType" />
            <xsd:group ref="javaee:jndiEnvironmentRefsGroup" />
            <xsd:element name="message-destination"
                type="javaee:message-destinationType" />
            <xsd:element name="locale-encoding-mapping-list"
                type="javaee:locale-encoding-mapping-listType" />
        </xsd:choice>
        <xsd:attribute name="version" type="javaee:web-app-versionType"
            use="required" />
        <xsd:attribute name="id" type="xsd:ID" />
        xsd:attribute name="metadata-complete" type="xsd:boolean">
        <xsd:annotation>
            <xsd:documentation>
                The metadata-complete attribute defines whether this
                deployment descriptor is complete, or whether the class
                files of the jar file should be examined for annotations
                that specify deployment information. If
                metadata-complete is set to "true", the deployment tool
                must ignore any Servlet annotations present in the class
                files of the application. If metadata-complete is not
                specified or is set to "false", the deployment tool must
                examine the class files of the application for
                annotations, as specified by the Servlet specifications.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:attribute />
    </xsd:complexType>




Thank you,
=Sreeni.


-----Original Message-----
From: Werner Guttmann [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 06, 2008 1:36 PM
To: [email protected]
Subject: Re: [castor-user] Exception while generating the source code
using the SourceGeneratorMain for web-app_2_5.xsd.



Sreeni Gaddam wrote:
> Hello,
> 
>  
> 
> I regret my the previous incomplete post.
No worries.

> Got the following exception while generating the source code for the
> web-app_2_5.xsd using org.exolab.castor.builder.SourceGeneratorMain
with
> the following options.
Hmm. Can you please raise a new Jira issue and attach a *minimal*
XML schema that allows us to reproduce this problem. As wel as all other
required files.


> -package com.anttools.xml.schema.webapp -fail -verbose -i
> web-app_2_5.xsd -f -types j2 -binding-file build/bindingWebApp.xml
-dest
> build/generated/webapp/src"
> 
>  
> 
> Exception:
> 
>  
> 
>      [java] -- Suppressing non fatal warnings.
> 
>      [java] org.exolab.castor.xml.XMLException: An annotation must
> appear as the
> 
>  first child of 'complexType' elements.
> 
>      [java]     at
> org.exolab.castor.xml.schema.reader.ComponentReader.error(Com
> 
> ponentReader.java:193)
> 
>      [java]     at
> org.exolab.castor.xml.schema.reader.ComplexTypeUnmarshaller.s
> 
> tartElement(ComplexTypeUnmarshaller.java:445)
> 
>      [java]     at
> org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startE
> 
> lement(SchemaUnmarshaller.java:484)
> 
>      [java]     at
> org.exolab.castor.xml.schema.reader.Sax2ComponentReader.start
> 
> Element(Sax2ComponentReader.java:255)
> 
>      [java]     at
> org.apache.xerces.parsers.AbstractSAXParser.startElement(Unkn
> 
> own Source)
> 
>      [java]     at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanSta
> 
> rtElement(Unknown Source)
> 
>      [java]     at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragmen
> 
> tContentDispatcher.dispatch(Unknown Source)
> 
>      [java]     at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDoc
> 
> ument(Unknown Source)
> 
>      [java]     at
> org.apache.xerces.parsers.XML11Configuration.parse(Unknown So
> 
> urce)
> 
>      [java]     at
> org.apache.xerces.parsers.XML11Configuration.parse(Unknown So
> 
> urce)
> 
>      [java]     at org.apache.xerces.parsers.XMLParser.parse(Unknown
> Source)
> 
>      [java]     at
> org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Sou
> 
> rce)
> 
>      [java]     at
> org.exolab.castor.builder.SourceGenerator.generateSource(Sour
> 
> ceGenerator.java:613)
> 
>      [java]     at
> org.exolab.castor.builder.SourceGenerator.generateSource(Sour
> 
> ceGenerator.java:548)
> 
>      [java]     at
> org.exolab.castor.builder.SourceGeneratorMain.main(SourceGene
> 
> ratorMain.java:309)
> 
>      [java] org.castor.core.exceptions.CastorRuntimeException: Source
> Generator:
> 
>  schema parser threw an Exception
> 
>      [java]     at
> org.exolab.castor.builder.SourceGenerator.generateSource(Sour
> 
> ceGenerator.java:638)
> 
>      [java]     at
> org.exolab.castor.builder.SourceGenerator.generateSource(Sour
> 
> ceGenerator.java:548)
> 
>      [java]     at
> org.exolab.castor.builder.SourceGeneratorMain.main(SourceGene
> 
> ratorMain.java:309)
> 
>      [java] Caused by: org.exolab.castor.xml.XMLException: An
annotation
> must ap
> 
> pear as the first child of 'complexType' elements.
> 
>      [java]     at
> org.exolab.castor.xml.schema.reader.Sax2ComponentReader.start
> 
>  
> 
>  
> 
>  
> 
> Binding webapp.xml:
> 
>  
> 
> <?xml version="1.0"?>
> 
> <!-- This file contains the binding information -->
> 
> <!-- for the invoice XML Schema -->
> 
> <!-- It is meant to be used by the Castor Source Code Generator -->
> 
> <cbf:binding xmlns:cbf="http://www.castor.org/SourceGenerator/Binding";
> defaultBindingType="element">
> 
>      
> 
>      <!-- Binding the web-app element to a class -->
> 
>      <cbf:elementBinding name="web-app">
> 
>         <cbf:java-class name="WebAppSchema" final="true"
equals="true"/>
> 
>      </cbf:elementBinding>
> 
>      
> 
> </cbf:binding>
> 
>  
> 
>  
> 
> Details and environment.
> 
>  
> 
> Upgraded to castor 1.2 from 0.9.x and we were generating for
> web-app_2_3.dtd earlier. Also all dependent required jar files are
> upgraded.
> 
> As a background,  In our application, web.xml was build dynamically
from
> different components. For this, the source is generated for the
2_5.xsd
> and used (un)marshalling mechanism to build web.xml from different
> fragments.  
> 
>  
> 
> Currently using jdk1.6.0_07 and ant 1.6.5.
> 
>  
> 
> Any type of suggestion or help will be appreciated.
> 
>  
> 
> Thank you,
> 
> -Sreeni. 
> 
> 

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to